Mike Mondragon
2008-Jun-12 09:03 UTC
[rspec-users] map.resources :foo_items, :as => :foo confusing my controller specs
I have following resource defined in my config/routes.rb (the model
name is contrived)
map.resources :foo_items, :as => :foo
that I originally generated with rspec_scaffold:
ruby script/generate rspec_scaffold foo_item
but when I use the :as attribute in resources to make the URI path be
''/foo'' instead of ''/foo_items'' the
default/generated controller specs
for AdAssetsController become broken e.g.
it "should be successful" do
do_get
response.should be_success
end
''FooItemsController route generation should map { :controller =>
''foo_items'', :action => ''index'' } to
/foo_items'' FAILED
expected: "/foo_items",
got: "/foo (using ==)
How can I make my controller spec honor the modified resource?
I searched through rspec group mail list to see if anyone else had
this problem. Another person asked about it but it was not addressed.
I also poked around the rspec code and documentation before resorting
to mailing the list.
Thanks
mike
--
Mike Mondragon
Work> http://sas.quat.ch/
Blog> http://blog.mondragon.cc/
David Chelimsky
2008-Jun-12 11:35 UTC
[rspec-users] map.resources :foo_items, :as => :foo confusing my controller specs
On Jun 12, 2008, at 4:03 AM, Mike Mondragon wrote:> I have following resource defined in my config/routes.rb (the model > name is contrived) > > map.resources :foo_items, :as => :foo > > that I originally generated with rspec_scaffold: > > ruby script/generate rspec_scaffold foo_item > > but when I use the :as attribute in resources to make the URI path be > ''/foo'' instead of ''/foo_items'' the default/generated controller specs > for AdAssetsController become broken e.g. > > it "should be successful" do > do_get > response.should be_success > end > > ''FooItemsController route generation should map { :controller => > ''foo_items'', :action => ''index'' } to /foo_items'' FAILED > expected: "/foo_items", > got: "/foo (using ==) > > How can I make my controller spec honor the modified resource?Sounds like either a bug or a missing feature. Please enter a ticket at the lighthouse: http://rspec.lighthouseapp.com> I searched through rspec group mail list to see if anyone else had > this problem. Another person asked about it but it was not addressed. > I also poked around the rspec code and documentation before resorting > to mailing the list. > > Thanks > mike > > -- > Mike Mondragon > Work> http://sas.quat.ch/ > Blog> http://blog.mondragon.cc/ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users