Ruby on Rails
Friday, July 14, 2017
I have the following code, which was automagically created, in ~/controllers/articles_controller_spec.rb
I see the following in STDOUT
Why am I getting a 302 rather than a 200?
Question 2: Shouldn't 302 be a type of success?
-- describe "GET #new" do
it "returns a success response" do
# See Hassan's answer in
# https://groups.google.com/forum/#!topic/rubyonrails-talk/OQIYz9mnBXU
byebug
get :new, params: {}, session: valid_session
byebug
expect(response).to be_success
end
end
I see the following in STDOUT
something@something:~$ date
Thu Jul 13 15:14:33 MDT 2017
something@something:~$ rspec
. . .
[72, 81] in /home/real-estate-data-mining/spec/controllers/articles_controller_spec.rb
72: # get :new # , params: {}, session: valid_session
73: byebug
74: get :new, params: {}, session: valid_session
75: # get :new, params: {}, session: {valid_session}
76: byebug
=> 77: expect(response).to be_success
78: end
79: end
80: end
81:
(byebug) response.status
302
Why am I getting a 302 rather than a 200?
Question 2: Shouldn't 302 be a type of success?
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/da4fde84-1f15-47bb-8ae9-a769d3fd3b9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment