Re: [rspec-users] controller.expect_render has me beat!
On 9/15/07, s.ross <[EMAIL PROTECTED]> wrote: > Look at your test.log and you can see exactly what was rendered. That should > explain why the example is failing. This works best if you can silence the > logs for all examples other than the one you are testing. > Better if you run just that example: spec spec\controllers\my_controller_spec.rb -e "My failing example name" -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] controller.expect_render has me beat!
Look at your test.log and you can see exactly what was rendered. That should explain why the example is failing. This works best if you can silence the logs for all examples other than the one you are testing. On Sep 14, 2007, at 7:35 PM, sinclair bain wrote: Hi, A controller has a method with the following def update ... if @config.update_attributes ( params[:new_config] ) redirect_to :action => :index else render :action => :edit, :id => params[:id] # this line here end ... end The example has the following it 'should render the "edit" config url on an unsuccessful save' do @config.should_receive(:update_attributes).once.and_return(false) controller.expect_render ( :action => :edit, :id => 1 ).once # my prob do_update end This fails with ... Mock 'expect_render_mock_proxy' expected :render with ({:action=>:edit, :id=>1}) once, but received it 0 times I have tried controller.expect_render( :action => :edit ).once Am I using #expect_render correctly? Thanks for all and any help! Cheers! sinclair ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Posted this in "dev" last night but I'm not sure that anyone reads it
On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote: > I agree that it would be nice if story runner treats an empty > Given/When/Then as pending. But what do you mean it treats pending as > an error case? The actual implementation of how a Scenario is defined as pending. The implementation raises a particular type of Error (name eludes me as I'm not steeped in code at the moment, sorry) which the ScenarioRunner rescues and, based on that, then processes the Scenario as pending. Typically, this would simply be a conditional branch in the code and, frankly, seems like an abuse of error handling. Incidentally, I submitted the patch last night to allow Scenarios without blocks to default to pending. Hopefully, Dan (North) likes it. It makes sense that the expectation metaphors through RSpec (and now Story Runner) would behave consistently. This just makes Scenario behave like "it". I have yet to look closely at the implementations of Given/Then/When/ And (forgot about that one, thanks!). Maybe if I get some time this weekend. Unfortunately, I'm spending the rest of tonight and most of tomorrow doing some work for the office... The deeper I get into it, the more that I love this tool Evan ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Posted this in "dev" last night but I'm not sure that anyone reads it
On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote: > I agree that it would be nice if story runner treats an empty > Given/When/Then as pending. But what do you mean it treats pending as > an error case? > Resending. Believe that my re-reponse, sent a couple of hours ago, was eaten. ;-) The actual implementation of how a Scenario is defined as pending. The implementation raises a particular type of Error (name eludes me as I'm not steeped in code at the moment, sorry) which the ScenarioRunner rescues and, based on that, then processes the Scenario as pending. Typically, this would simply be a conditional branch in the code and, frankly, seems like an abuse of error handling. Incidentally, I submitted the patch last night to allow Scenarios without blocks to default to pending. Hopefully, Dan (North) likes it. It makes sense that the expectation metaphors through RSpec (and now Story Runner) would behave consistently. This just makes Scenario behave like "it". I have yet to look closely at the implementations of Given/Then/When/ And (forgot about that one, thanks!). Maybe if I get some time this weekend. Unfortunately, I'm spending the rest of tonight and most of tomorrow doing some work for the office... The deeper I get into it, the more that I love this tool Evan ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Mocks in StoryRunner
On 9/14/07, Pat Maddox <[EMAIL PROTECTED]> wrote: > On 9/14/07, James Hughes <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I'm trying to get up and running with StoryRunner. I have a story that > > looks something like the following, but the call to mock_model > > produces the exception listed below. Am I just misunderstanding the > > concept? Are mocks not meant to be used in stories like this? Or is > > this a bug? Changing @user to be an actual AR object makes things run > > without error. > > > > ENV["RAILS_ENV"] = "test" > > require File.expand_path(File.dirname(__FILE__) + "/../config/environment") > > require 'spec' > > require 'spec/rails' > > require 'spec/rails/story_adapter' > > > > Story 'Something happens', %{ > > As a user > > I want to do something > > So that something will happen. > > }, :type => RailsStory do > > > > Scenario 'User doing something for first time' do > > Given 'a user' do > > @user = mock_model(User) > > end > > When 'the user makes a request' do > > end > > Then 'something should happen' do > > end > > end > > end > > > > > > Here's the stack trace: > > > > 1 scenarios: 0 succeeded, 1 failed, 0 pending > > > > FAILURES: > > 1) Something happens (User doing something for first time) FAILED > > NoMethodError: You have a nil object when you didn't expect it! > > You might have expected an instance of Array. > > The error occurred while evaluating nil.each > > > > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:519:in > > `open_session' > > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:490:in > > `reset!' > > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:546:in > > `method_missing' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/matchers.rb:146:in > > `method_missing' > > stories/use_case_story.rb:38:in `a logged-in user' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in > > `__send__' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in > > `perform' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/world.rb:58:in > > `store_and_call' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/world.rb:68:in > > `Given' > > stories/use_case_story.rb:36 > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:13:in > > `instance_eval' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:13:in > > `run' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:48:in > > `run_stories' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in > > `each' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in > > `run_stories' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in > > `each' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in > > `run_stories' > > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner.rb:36:in > > `register_exit_hook' > > stories/use_case_story.rb:29 > > ___ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > No, you shouldn't be calling mock_model in Story Runner. The whole > point of stories is to exercise the full functionality of your app. > > Pat Right, get it now, thanks. jh ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] controller.expect_render has me beat!
Hi, A controller has a method with the following def update ... if @config.update_attributes ( params[:new_config] ) redirect_to :action => :index else * render :action => :edit, :id => params[:id] # this line here* end ... end The example has the following it 'should render the "edit" config url on an unsuccessful save' do @config.should_receive(:update_attributes).once.and_return(false) c*ontroller.expect_render( :action => :edit, :id => 1 ).once # my prob* do_update end This fails with ... Mock 'expect_render_mock_proxy' expected :render with ({:action=>:edit, :id=>1}) once, but received it 0 times I have tried controller.expect_render( :action => :edit ).once Am I using #expect_render correctly? Thanks for all and any help! Cheers! sinclair ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Mocks in StoryRunner
On 9/14/07, James Hughes <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to get up and running with StoryRunner. I have a story that > looks something like the following, but the call to mock_model > produces the exception listed below. Am I just misunderstanding the > concept? Are mocks not meant to be used in stories like this? Or is > this a bug? Changing @user to be an actual AR object makes things run > without error. > > ENV["RAILS_ENV"] = "test" > require File.expand_path(File.dirname(__FILE__) + "/../config/environment") > require 'spec' > require 'spec/rails' > require 'spec/rails/story_adapter' > > Story 'Something happens', %{ > As a user > I want to do something > So that something will happen. > }, :type => RailsStory do > > Scenario 'User doing something for first time' do > Given 'a user' do > @user = mock_model(User) > end > When 'the user makes a request' do > end > Then 'something should happen' do > end > end > end > > > Here's the stack trace: > > 1 scenarios: 0 succeeded, 1 failed, 0 pending > > FAILURES: > 1) Something happens (User doing something for first time) FAILED > NoMethodError: You have a nil object when you didn't expect it! > You might have expected an instance of Array. > The error occurred while evaluating nil.each > > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:519:in > `open_session' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:490:in > `reset!' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:546:in > `method_missing' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/matchers.rb:146:in > `method_missing' > stories/use_case_story.rb:38:in `a logged-in user' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in > `__send__' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in > `perform' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/world.rb:58:in > `store_and_call' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/world.rb:68:in > `Given' > stories/use_case_story.rb:36 > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:13:in > `instance_eval' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:13:in > `run' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:48:in > `run_stories' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in > `each' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in > `run_stories' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in > `each' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in > `run_stories' > /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner.rb:36:in > `register_exit_hook' > stories/use_case_story.rb:29 > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > No, you shouldn't be calling mock_model in Story Runner. The whole point of stories is to exercise the full functionality of your app. Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Mocks in StoryRunner
Hi, I'm trying to get up and running with StoryRunner. I have a story that looks something like the following, but the call to mock_model produces the exception listed below. Am I just misunderstanding the concept? Are mocks not meant to be used in stories like this? Or is this a bug? Changing @user to be an actual AR object makes things run without error. ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'spec' require 'spec/rails' require 'spec/rails/story_adapter' Story 'Something happens', %{ As a user I want to do something So that something will happen. }, :type => RailsStory do Scenario 'User doing something for first time' do Given 'a user' do @user = mock_model(User) end When 'the user makes a request' do end Then 'something should happen' do end end end Here's the stack trace: 1 scenarios: 0 succeeded, 1 failed, 0 pending FAILURES: 1) Something happens (User doing something for first time) FAILED NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:519:in `open_session' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:490:in `reset!' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/integration.rb:546:in `method_missing' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/matchers.rb:146:in `method_missing' stories/use_case_story.rb:38:in `a logged-in user' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in `__send__' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in `perform' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/world.rb:58:in `store_and_call' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/world.rb:68:in `Given' stories/use_case_story.rb:36 /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:13:in `instance_eval' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:13:in `run' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:48:in `run_stories' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in `each' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in `run_stories' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `each' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `run_stories' /home/jhughes/dev/rj/csite/config/../vendor/plugins/rspec/lib/spec/story/runner.rb:36:in `register_exit_hook' stories/use_case_story.rb:29 ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Posted this in "dev" last night but I'm not sure that anyone reads it
On 9/14/07, Evan David Light <[EMAIL PROTECTED]> wrote: > > I've been using RSpec in anger for perhaps a total of a few days and just > started playing with Story Runner. Love it. > > I also started working on a patch, which ought to be simple, to allow for > Scenarios without supplied blocks to be treated as pending -- much like "it" > in Spec::DSL::ExampleAPI. > > That said, I noticed something that seemed odd and chatted with Rein > Henrichs a little about it on #rspec. ScenarioRunner#run treats "pending" > scenarios as an error case. We both believed this to be a little odd as we > both thought that pending would just be a branch and not an error. That > said, I thought that there may be a reasonable explanation. > > Evan Light > IMs (all): sleight42 > Twitter: elight > http://evan.tiggerpalace.com > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > Hrm...I added And "this should be pending" do pending "need something else" end to the end of one of my stories and got: And this should be pending P 4 scenarios: 3 succeeded, 0 failed, 1 pending I agree that it would be nice if story runner treats an empty Given/When/Then as pending. But what do you mean it treats pending as an error case? Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] controller.expect_render has me beat!
Hi, A controller has a method with the following def update ... if @config.update_attributes( params[:new_config] ) redirect_to :action => :index else * render :action => :edit, :id => params[:id] # this line here* end ... end The example has the following it 'should render the "edit" config url on an unsuccessful save' do @config.should_receive(:update_attributes).once.and_return(false) c*ontroller.expect_render( :action => :edit, :id => 1 ).once # my prob* do_update end This fails with Mock 'expect_render_mock_proxy' expected :render with ({:action=>:edit, :id=>1}) once, but received it 0 times I have tried controller.expect_render( :action => :edit ).once Am I using #expect_render correctly? Thanks for all and any helpv Cheers! sinclair ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] ProfileFormatter (Top 10 slowest examples)
Hey list, The time it takes for my specs to run is starting to get a little long (~45 seconds), and annoying enough for me to do something about it. I've written a simple formatter that prints out the top 10 slowest examples in an attempt to identify any low hanging fruit amongst a spec suite. http://rubyforge.org/tracker/index.php?func=detail&aid=13943&group_id=797&atid=3151 Just for fun... here's my Top 10: (I haven't tried speeding any of these up yet, by the way.) 0.4318470 /users/new.html.erb should render new form 0.4248100 /users/edit.html.erb should not dipslay the brand admin checkbox if the current user is also the target user and a brand admin 0.4230980 /users/edit.html.erb should have a new user heading 0.4189370 /users/edit.html.erb should not display the brand admin checkbox if the current user is not a brand admin 0.2828910 <> Sorry, this one gave away some business details -- we're a start-up still in stealth mode. 0.2748610 /users/edit.html.erb should display the brand admin checkbox if the current user is a brand admin 0.2747120 /users/edit.html.erb should not dipslay the brand admin checkbox if the current user is also the target user but not a brand admin 0.2699700 /users/edit.html.erb should render edit form 0.2692280 /users/new.html.erb should have a new user heading 0.2124850 GiftsController handling GET /active.js should construct the Gift::GiftActiveBrandQuery Cheers Ian ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Posted this in "dev" last night but I'm not sure that anyone reads it
I've been using RSpec in anger for perhaps a total of a few days and just started playing with Story Runner. Love it. I also started working on a patch, which ought to be simple, to allow for Scenarios without supplied blocks to be treated as pending -- much like "it" in Spec::DSL::ExampleAPI. That said, I noticed something that seemed odd and chatted with Rein Henrichs a little about it on #rspec. ScenarioRunner#run treats "pending" scenarios as an error case. We both believed this to be a little odd as we both thought that pending would just be a branch and not an error. That said, I thought that there may be a reasonable explanation. Evan Light IMs (all): sleight42 Twitter:elight http://evan.tiggerpalace.com___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] using #include in shared behaviours
Hi folks, Is there any way I can call #include from within a shared behaviour without it blowing up?: > vendor/plugins/rspec/lib/spec/dsl/shared_behaviour.rb:48:in > `included': private method `include' called for # > (NoMethodError) More detail: I have a spec/concerns directory which contains specs corresponding to mixins in app/concerns (cf Jamis Buck), so each spec/ concerns/*_spec.rb really just contains a shared behaviour which is used in the appropriate specs in spec/models (i.e. of those models whose app/models counterpart mixes in that concern). Each such model says require File.dirname(__FILE__) + '/../concerns/ animal_spec' and describe Dog do before(:each) do @animal = Dog.new end; it_should_behave_like 'all animals' end, which works fine. Some of the concern specs need helpers from modules in spec_helper, but any attempt to include those modules within the shared behaviour blows up as above, so at the moment I'm including the helper modules in the model specs themselves. That also works fine, but leaves an unpleasant taste since the model spec itself doesn't (syntactically) refer to any of the helper methods, so I'd really rather leave the #including to the shared behaviour if possible. Any thoughts? Cheers, -Tom ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Testing a nested controller
On 14.9.2007, at 12.02, Andreas Wolff wrote: Hey everyone. I really stuck on testing a nested controller. I'm trying to make a request using get and afterwards checking the response by response.should ... My routes.rb looks like this: map.resources :writers do |writers| writers.resources :notes end In my notes_controller_spec.rb def do_get writer_id = 1 note_id = 1 get note_path(writer_id, note_id) end it "should show a note" do do_get response.should be_success end But this always ends in an error message: You have a nil object when you didn't expect it! The error occurred while evaluating nil.rewrite Can anybody help here?? You shouldn't test the routing stack in controller tests. Just say get :show, :id => 1, :writer_id => 1 It will automatically use the correct controller, given that you have either used "describe NotesController" or use the controller helper to identify the controller. I think the former way is now considered best practice. If you want to test routes, do it separately. IIRC generating an rspec_scaffold will create you examples of how to do that. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Testing a nested controller
Ok. this was stupid :) I found the answer two minutes later: You cannot use the url helper here, but if you provide the writers id in the request everything works fine: testing the route: route_for(:controller => "notes", :action => "show", :id => 1, :writer_id => 1) testing the request by: get :show, :id => 1, :writer_id => 1 bye On 9/14/07, Andreas Wolff <[EMAIL PROTECTED]> wrote: > Hey everyone. > I really stuck on testing a nested controller. I'm trying to make a > request using get and afterwards checking the response by > response.should ... > > My routes.rb looks like this: > > map.resources :writers do |writers| > writers.resources :notes > end > > > In my notes_controller_spec.rb > > def do_get > writer_id = 1 > note_id = 1 > get note_path(writer_id, note_id) > end > > it "should show a note" do > do_get > response.should be_success > end > > > But this always ends in an error message: > You have a nil object when you didn't expect it! > The error occurred while evaluating nil.rewrite > > Can anybody help here?? > > -- > by(e) > Andreas Wolff > -- by(e) Andreas Wolff http://rubyblog.de | http://activerails.de ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Testing a nested controller
Hey everyone. I really stuck on testing a nested controller. I'm trying to make a request using get and afterwards checking the response by response.should ... My routes.rb looks like this: map.resources :writers do |writers| writers.resources :notes end In my notes_controller_spec.rb def do_get writer_id = 1 note_id = 1 get note_path(writer_id, note_id) end it "should show a note" do do_get response.should be_success end But this always ends in an error message: You have a nil object when you didn't expect it! The error occurred while evaluating nil.rewrite Can anybody help here?? -- by(e) Andreas Wolff ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users