[rspec-users] Problems withe the template...
dchelimsky at gmail.com
Wed Apr 22 12:58:08 EDT 2009
On Wed, Apr 22, 2009 at 11:27 AM, Alex <afolgueras at gmail.com> wrote:
> Hello everybody !
> I have in a view something like this :
> <% unless (method_name?(id)) then %>
> <span class="active">
> <%= link_to h(t(:BTN)), new_url_path(id) %></span>
> <% else %>
> <span class="Notactive">
> <%= 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)
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 :)
> I tried a lot of combinations like ...
> and it does'nt work ... it always goes in the if not in the else
> part ... any suggestions ?
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users