What's the difference between these two forms, in a spec file?

 get '/prefix/resources' # get index of resources
 get :index              # get index of resources

I have some tests that work one way, some that work the other way, and seems 
like none work any way but the way they're presently written. But I'm 
perilously close to having to try a form at random until I find which one works!

A bit more specifically,

In spec/controllers/some_resource_controller_spec.rb, I have
> describe SomeResourcesController do
>   describe "some behavior" do
>     it "should return index of SomeResources" do
>       get :index

(Using the path form here results in 'No route matches 
{:controller=>"some_resources", :action="/some_resources"}')

But in spec/integration/some_others_resource_spec.rb, I have
> describe "some other resource" do
>   describe "GET /some_others"
>     it "should return index of SomeOthers" do
>       get "/some_others"

(Using the symbol form here results in 'bad argument(expected URI object or URI 
string)'.)

Is it the difference between living in controllers/ vs. integration/ that 
determines the get form? Or the difference in whether I name the class in the 
outermost "describe"? Something else? Some combination?


-==-
Jack Repenning
Technologist
CollabNet Cloud Services
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
office: +1 650.228.2562
twitter: http://twitter.com/jrep










_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to