alex
April 22, 2009, 6:47pm
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 ?
alex
April 22, 2009, 7:59pm
2
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
alex
April 22, 2009, 8:26pm
3
Problem solved!
Sorry about that, turns out it wasn’t an error…
Thanks!