Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Webrat::Core::Session#redirect? should not mistake a 304 for a redirect.
  • Loading branch information
lmarburger committed Jan 9, 2010
1 parent f9985cd commit 85cd5ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webrat/core/session.rb
Expand Up @@ -159,7 +159,7 @@ def success_code? #:nodoc:
end

def redirect? #:nodoc:
(response_code / 100).to_i == 3
response_code != 304 && (response_code / 100).to_i == 3
end

def internal_redirect?
Expand Down
5 changes: 5 additions & 0 deletions spec/private/core/session_spec.rb
Expand Up @@ -138,6 +138,11 @@ def /(other)
webrat_session.stub!(:response_code => 200)
webrat_session.redirect?.should be_false
end

it "should return false if the last response was a 304 Not Modified" do
webrat_session.stub!(:response_code => 304)
webrat_session.redirect?.should be_false
end
end

describe "#internal_redirect?" do
Expand Down

0 comments on commit 85cd5ee

Please sign in to comment.