Skip to content

Commit b795447

Browse files
author
Sam Phippen
committed
Fixup various fakes for Rails 5 testing.
1 parent 3bf5af1 commit b795447

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

spec/rspec/rails/example/mailer_example_group_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module RSpec::Rails
55
module ::Rails; end
66
before do
77
allow(Rails).to receive_message_chain(:application, :routes, :url_helpers).and_return(Rails)
8+
allow(Rails.application).to receive(:config).and_return(double("Rails.application.config").as_null_object)
89
allow(Rails).to receive_message_chain(:configuration, :action_mailer, :default_url_options).and_return({})
910
end
1011

spec/rspec/rails/matchers/have_http_status_spec.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,27 @@
44
include RSpec::Rails::Matchers
55

66
def create_response(opts = {})
7-
ActionDispatch::TestResponse.new(opts.fetch(:status))
7+
ActionDispatch::TestResponse.new(opts.fetch(:status)).tap {|x|
8+
x.request = ActionDispatch::Request.new({})
9+
}
810
end
911

1012
shared_examples_for "supports different response instances" do
1113
context "given an ActionDispatch::Response" do
1214
it "returns true for a response with the same code" do
13-
response = ::ActionDispatch::Response.new(code)
15+
response = ::ActionDispatch::Response.new(code).tap {|x|
16+
x.request = ActionDispatch::Request.new({})
17+
}
1418

1519
expect( matcher.matches?(response) ).to be(true)
1620
end
1721
end
1822

1923
context "given an ActionDispatch::TestResponse" do
2024
it "returns true for a response with the same code" do
21-
response = ::ActionDispatch::TestResponse.new(code)
25+
response = ::ActionDispatch::TestResponse.new(code).tap {|x|
26+
x.request = ActionDispatch::Request.new({})
27+
}
2228

2329
expect( matcher.matches?(response) ).to be(true)
2430
end

spec/support/ar_classes.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def self.extended(host)
1313
nonexistent_model_id integer
1414
)
1515
eosql
16+
17+
host.reset_column_information
1618
end
1719
end
1820

0 commit comments

Comments
 (0)