Problems withe the template

Hello everybody !

I have in a view something like this :

<% unless (method_name?(id)) then %>

<%= link_to h(t(:BTN)), new_url_path(id) %>


<% else %>

<%= link_to_function h(t(:BTN)), ‘return false;’ %>

<% end %>

all of this works well …

and in my spec I try to do this to go in the else part :

@controller.template.stub!(:get_courtier_expire?).and_return (false)

I tried a lot of combinations like …

@template.stub!(
template.stub!(
@controller.template.should_receive(
template.should_receive(

and it does’nt work … it always goes in the if not in the else
part … any suggestions ?

On Wed, Apr 22, 2009 at 11:27 AM, Alex [email protected] wrote:

   <span class="Notactive">
           <%= link_to_function h(t(:BTN)), 'return false;' %>
   </span>

<% end %>

all of this works well …

and in my spec I try to do this to go in the else part :

@controller.template.stub!(:get_courtier_expire?).and_return (false)

So I’m clear - method_name? above is really get_courtier_expire? ??

The statement in the view is unless, not if - so if the method is
returning false, then it’s behaving as you would expect. Unless I’m
missing something :slight_smile:

Problem solved!

Sorry about that, turns out it wasn’t an error…

Thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs