You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rs...@googlegroups.com
Hi all
I might found issue or it couldn't be. In my routes file I have RESTful routes for movies as follows:
``` resource :movies
```
When I write test for movies controller#index action
``` it "assigns to @movies" do post :index expect(assigns[:movies]).to eq([@movie]) end ```
I defined a route for movies#index with request type as `get` but when I use `post :index` in my test controller it passes the test. Ideally it should raise routing error but it didn't. What's happening behind the covers? Is rails doing magic or rspec doing magic? Could you clarify me?
Myron Marston
unread,
Feb 16, 2014, 10:17:17 AM2/16/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rs...@googlegroups.com
For the most part, rspec's rails' support is a very thin wrapper around rails' built-in testing support and I believe that's the case there. If you are writing a controller spec bear in mind that it bypasses the router. You could see if it has the same behavior if you write a rails functional test -- I suspect it does.