Problems withe the template


#1

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 ?


#2

On Wed, Apr 22, 2009 at 11:27 AM, Alex removed_email_address@domain.invalid 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:


#3

Problem solved!

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

Thanks!