Skip to content

Commit

Permalink
Webrat::Core::Session#redirect? should not mistake a 304 for a redirect.
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarburger authored and djanowski committed Apr 12, 2010
1 parent 0bbf163 commit fd944cc
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 @@ -155,7 +155,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 @@ -133,6 +133,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 fd944cc

Please sign in to comment.