[Rails] Re: get & post methods in controller's test

2012-09-06 Thread Salvatore Pelligra
Ok, thanks to both of you for clearing my mind :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this

[Rails] Re: get & post methods in controller's test

2012-09-06 Thread Frederick Cheung
On Wednesday, September 5, 2012 10:50:15 PM UTC+1, Ruby-Forum.com User wrote: > > > If I'm getting what you say, in a controller spec it's not really > important if I use get, post, delete or put methods - unless the action > itself has some logic affected by the request type, right? :) > > Cor

[Rails] Re: get & post methods in controller's test

2012-09-05 Thread 7stud --
Sorry, my tests were inside an integration('request') test: /spec/requests/dog_pages_spec.rb In my rails tutorial book, it says that inside a controller test, you can't use urls at all, e.g get '/about' get '/' ...you can only do: get 'actionA' get 'actionB' -- Posted via http://www.ruby-fo

[Rails] Re: get & post methods in controller's test

2012-09-05 Thread Salvatore Pelligra
Frederick Cheung wrote in post #1074851: > On Tuesday, September 4, 2012 12:56:05 AM UTC+1, Ruby-Forum.com User > wrote: > Controller specs bypass your routes entirely (as part as action invocation > goes, they're still used if you try to generate a url inside the > action). > If you do > > get :ac

[Rails] Re: get & post methods in controller's test

2012-09-05 Thread Frederick Cheung
On Tuesday, September 4, 2012 12:56:05 AM UTC+1, Ruby-Forum.com User wrote: > > > But this will load the login action and not the login_create! After a > lot of searching and trying, I've wrote: > post :login_create > ... And it works as expected. However, after that I've tried: >

[Rails] Re: get & post methods in controller's test

2012-09-05 Thread Salvatore Pelligra
That's strange °_° In my app it fails: .F. Failures: 1) SessionsController POST to 'login' returns http success Failure/Error: post '/login' ActionController::RoutingError: No route matches {:controller=>"sess

[Rails] Re: get & post methods in controller's test

2012-09-04 Thread 7stud --
> The problem isn't in the route, but in the strange behavior of get and > post, instance methods of ActionController::TestCase::Behavior My rspec tests seem to work as you would expect. I used a controller named Dogs to test the routes: require 'spec_helper' describe "Dogs Pages" do descr

[Rails] Re: get & post methods in controller's test

2012-09-04 Thread Salvatore Pelligra
7stud -- wrote in post #1074532: > Your route syntax is confusing to me. How about: > > > controller :sessions do > match '/login' => :login_create, :via => :post > match '/login' => :login, :via => :get > match '/logout' => :logout > end > > ...which is pieced together

[Rails] Re: get & post methods in controller's test

2012-09-03 Thread 7stud --
How about: controller :sessions do match '/login' => :login_create, :via => :post match '/login' => :login, :via => :get match '/logout' => :logout end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Gr