Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
> In the spec, the method being spec'd should be invoked through the helper: > >   it "does something" do >     helper.method_being_specified >   end > > I did not mean to reference a helper object inside the implementation. > > Make sense? Ah, now I got it ... you meant the template helper method

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread David Chelimsky
On Mar 21, 2011, at 12:52 PM, Kai Schlamp wrote: >>> Failure/Error: order_link(:name) >>> NoMethodError: >>> undefined method `fetch_param' for #<#: >>> 0xb63be118> >> >> That's not the same error message you posted earlier: >> >> NoMethodError: >> undefined method `sort_directio

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
> > undefined local variable or method `helper' for #<#: > > 0xb665532c> > > What's the full backtrace? 1) ApplicationHelper order link should create html link Failure/Error: order_link(:name) NoMethodError: undefined method `fetch_param' for #<#: 0xb64a1ef4> # ./app/helper

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
> > Failure/Error: order_link(:name) > >     NoMethodError: > >       undefined method `fetch_param' for #<#: > > 0xb63be118> > > That's not the same error message you posted earlier: > > NoMethodError: >       undefined method `sort_direction' for > #" error shows up when using helper.check_param

Re: [rspec-users] rake spec loads development environment

2011-03-21 Thread Jared M.
This thread has been dead for awhile, but I'm having the same issue. I don't have a bash variable set. I'm also having this issue with Cucumber. It always runs in development mode. If I put "p Rails.env" in spec_helper.rb:8 (after spec_helper already declares ENV["RAILS_ENV"] ||= "test") and

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread David Chelimsky
On Mar 21, 2011, at 11:15 AM, Kai Schlamp wrote: >>> module ApplicationHelper >>> def order_link(column, title = nil) >>>fetch_param(:order) >> >> Change this ^^ to this: >> >> helper.fetch_param(:order) > Ok, the tests now runs fine, but unfortunately the site itself doesn't > work anym

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
> From this error message, it looks like you can just def it inside your > describe block. Thanks Matt, that seems to work. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
Ok, the tests now runs fine, but unfortunately the site itself doesn't work anymore. When the view gets rendered I get the following error: undefined local variable or method `helper' for #<#: 0xb665532c> > > module ApplicationHelper > >  def order_link(column, title = nil) > >    fetch_param(:or

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread David Chelimsky
On Mar 21, 2011, at 11:19 AM, Kai Schlamp wrote: >> Change this ^^ to this: >> >> helper.fetch_param(:order) > > I was wrong the test fails also with the same error message: > > Failure/Error: order_link(:name) > NoMethodError: > undefined method `fetch_param' for #<#: > 0xb63be118>

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
> Change this ^^ to this: > >   helper.fetch_param(:order) I was wrong the test fails also with the same error message: Failure/Error: order_link(:name) NoMethodError: undefined method `fetch_param' for #<#: 0xb63be118> ___ rspec-users maili

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread David Chelimsky
On Mar 21, 2011, at 8:40 AM, Kai Schlamp wrote: >> This error ^^ suggests that sort_direction is being called on the example >> itself rather than the helper object. Please post the spec so we can see >> what's going on. > > Sure ... > > describe ApplicationHelper do > describe "order link"

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
> This error ^^ suggests that sort_direction is being called on the example > itself rather than the helper object. Please post the spec so we can see > what's going on. Sure ... describe ApplicationHelper do describe "order link" do it "should create html link" do # things I tried

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Matt Wynne
On 21 Mar 2011, at 10:41, Kai Schlamp wrote: > My ApplicationController exposes a method (e.g. sort_direction) to the > view templates by using > helper_method :sort_direction. > I then use this method in another method (e.g. sort_link) in a view > helper (application_helper.rb). > > When testin

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread David Chelimsky
On Mar 21, 2011, at 5:41 AM, Kai Schlamp wrote: > My ApplicationController exposes a method (e.g. sort_direction) to the > view templates by using > helper_method :sort_direction. > I then use this method in another method (e.g. sort_link) in a view > helper (application_helper.rb). > > When test

Re: [rspec-users] RSpec & DataMapper Open Source Projects?

2011-03-21 Thread Chris Mear
On 16 March 2011 12:15, Sid Wood wrote: > Does anyone know of any open source projects that are using RSpec and > DataMapper together that I can dissect? A project I work on, One Click Orgs, was using Merb + DataMapper with RSpec and Machinist. We've since migrated to Rails with ActiveRecord, but

[rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Kai Schlamp
My ApplicationController exposes a method (e.g. sort_direction) to the view templates by using helper_method :sort_direction. I then use this method in another method (e.g. sort_link) in a view helper (application_helper.rb). When testing the sort_link method with RSpec (in application_helper_spec