On Sunday, February 9, 2014 6:52:27 AM UTC-8, siva wrote:
>
>
>
>   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?
>

 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.

HTH,
Myron

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/1ad27a5f-28a6-4529-9cec-d34cbf53a6b5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to