I have this response when I run in the console: ruby-1.9.2-p290 :022 > c.login> I, [2012-02-15T23:12:09.681772 #12908] INFO -- : post https://www.soup.io/login > D, [2012-02-15T23:12:09.681854 #12908] DEBUG -- request: Content-Type: "application/x-www-form-urlencoded" > I, [2012-02-15T23:12:10.157908 #12908] INFO -- Status: 302 > D, [2012-02-15T23:12:10.158054 #12908] DEBUG -- response: server: "nginx/0.7.67" > date: "Wed, 15 Feb 2012 22:12:11 GMT" > content-type: "text/html; charset=utf-8" > connection: "close" > ... > content-length: "94" > status: "302" > ... > location: "http://soup-client.soup.io/?sessid=995f610405f8afe029b9038da6c22132" > content-length: "0" > status: "302" > ... > set-cookie: "soup_session_id=995f610405f8afe029b9038da6c22132; path=/; expires=Sun, 15 Feb 2032 22:12:13 GMT; HttpOnly" > status: "200" > content-length: "16024" > >I would like to test this response but how do I get the status from this response? I already tried *c.login["status"].should == 200* but it''s not working:> ruby-1.9.2-p290 :025 > c.login["status"] > > ... > > status: "200" > vary: "Accept-Encoding" > content-length: "15700" > NoMethodError: undefined method `[]'' for nil:NilClass > from (irb):25 > from /home/rege/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'' > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/BLKhCQ3zSGwJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I write stackoverflow question for this too: http://stackoverflow.com/q/9302594/1103892 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ilzUQ9M3GCIJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
in RSpec something like this? describe "GET ''login''" do it "should be successful" do get ''login'' response.should be_success end end On Feb 15, 6:24 pm, regedarek <dariusz.fins...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have this response when I run in the console: > > ruby-1.9.2-p290 :022 > c.login > > > > > > > > > > > I, [2012-02-15T23:12:09.681772 #12908] INFO -- : posthttps://www.soup.io/login > > D, [2012-02-15T23:12:09.681854 #12908] DEBUG -- request: Content-Type: "application/x-www-form-urlencoded" > > I, [2012-02-15T23:12:10.157908 #12908] INFO -- Status: 302 > > D, [2012-02-15T23:12:10.158054 #12908] DEBUG -- response: server: "nginx/0.7.67" > > date: "Wed, 15 Feb 2012 22:12:11 GMT" > > content-type: "text/html; charset=utf-8" > > connection: "close" > > ... > > content-length: "94" > > status: "302" > > ... > > location: "http://soup-client.soup.io/?sessid=995f610405f8afe029b9038da6c22132" > > content-length: "0" > > status: "302" > > ... > > set-cookie: "soup_session_id=995f610405f8afe029b9038da6c22132; path=/; expires=Sun, 15 Feb 2032 22:12:13 GMT; HttpOnly" > > status: "200" > > content-length: "16024" > > I would like to test this response but how do I get the status from this > response? > > I already tried *c.login["status"].should == 200* but it''s not working: > > > > > > > > > ruby-1.9.2-p290 :025 > c.login["status"] > > > ... > > > status: "200" > > vary: "Accept-Encoding" > > content-length: "15700" > > NoMethodError: undefined method `[]'' for nil:NilClass > > from (irb):25 > > from /home/rege/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>''-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I already tried this but it recive: 1) Soup Client should ad new link to soup.io Failure/Error: get ''login'' NoMethodError: undefined method `get'' for #<RSpec::Core::ExampleGroup::Nested_1:0x98d0a3c> # ./spec/soup_spec.rb:10:in `block (2 levels) in <top (required)>'' -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/HNhgAi6X3qIJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.