-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Rails 5 support patches #1492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails 5 support patches #1492
Changes from all commits
0e5d559
6d6af2f
4e73e71
6e252ee
625fe44
7a13bf1
e4bee71
8fda9e9
3bf5af1
b795447
275905d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,27 @@ | |
include RSpec::Rails::Matchers | ||
|
||
def create_response(opts = {}) | ||
ActionDispatch::TestResponse.new(opts.fetch(:status)) | ||
ActionDispatch::TestResponse.new(opts.fetch(:status)).tap {|x| | ||
x.request = ActionDispatch::Request.new({}) | ||
} | ||
end | ||
|
||
shared_examples_for "supports different response instances" do | ||
context "given an ActionDispatch::Response" do | ||
it "returns true for a response with the same code" do | ||
response = ::ActionDispatch::Response.new(code) | ||
response = ::ActionDispatch::Response.new(code).tap {|x| | ||
x.request = ActionDispatch::Request.new({}) | ||
} | ||
|
||
expect( matcher.matches?(response) ).to be(true) | ||
end | ||
end | ||
|
||
context "given an ActionDispatch::TestResponse" do | ||
it "returns true for a response with the same code" do | ||
response = ::ActionDispatch::TestResponse.new(code) | ||
response = ::ActionDispatch::TestResponse.new(code).tap {|x| | ||
x.request = ActionDispatch::Request.new({}) | ||
} | ||
|
||
expect( matcher.matches?(response) ).to be(true) | ||
end | ||
|
@@ -382,12 +388,12 @@ def create_response(opts = {}) | |
it_behaves_like "supports different response instances" do | ||
subject(:matcher) { have_redirect_status } | ||
|
||
let(:code) { 333 } | ||
let(:code) { 308 } | ||
end | ||
|
||
describe "matching a response" do | ||
it "returns true for a response with a 3xx status code" do | ||
any_3xx_code = 333 | ||
any_3xx_code = 308 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't these be dynamic depending on version? Or does 308 play ok for rails 4 etc too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 308 is actually a valid code in the spec. 333 is not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah so unrelated change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I made this change is that somewhere along the way, rails 5 no-longer accepts 3xx codes that aren't part of the spec in a bunch of places. 333 is not part of the spec. Given that all old versions of rails support any http response code that is in the spec, this seemed like the easiest change to make for this PR to work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been resolved |
||
response = create_response(:status => any_3xx_code) | ||
|
||
expect( have_redirect_status.matches?(response) ).to be(true) | ||
|
@@ -416,12 +422,12 @@ def create_response(opts = {}) | |
end | ||
|
||
it "has a negated failure message reporting the expected and actual status codes" do | ||
any_3xx_code = 333 | ||
any_3xx_code = 308 | ||
response = create_response(:status => any_3xx_code) | ||
|
||
expect{ have_redirect_status.matches? response }. | ||
to change(have_redirect_status, :failure_message_when_negated). | ||
to(/not to have a redirect status code \(3xx\) but it was 333/) | ||
to(/not to have a redirect status code \(3xx\) but it was 308/) | ||
end | ||
end | ||
|
||
|
@@ -430,5 +436,4 @@ def create_response(opts = {}) | |
expect{ have_http_status(nil) }.to raise_error ArgumentError | ||
end | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ def self.extended(host) | |
nonexistent_model_id integer | ||
) | ||
eosql | ||
|
||
host.reset_column_information | ||
end | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be 2.2.2+ instead of 2.2?