I'm using RSpec (through the gem rspec-rails) for testing and developing
my application.
Then, I've tried to "test" a controller and run up against a something
that in last, I'm not understanding: post and get methods.
I've searched them in RoR doc, but their's not documented.

In my route file:
  controller :sessions do
    post 'login',  action: :login_create
    get  'login',  action: :login
    get  'logout', action: :logout
  end

At the beginning, I was thinking that post will simulate an http post
request at the specified url, while get a http get one, so I've writed:
  describe "POST 'login'" do
    it "returns http success" do
      post 'login'
      response.should be_success
      response.should render_template 'sessions/login_create'
    end
  end

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:
      get :login_create
... And this works also! O_o

So, what this kind of methods really do and how are intended to be used?

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to