Skip to content

Commit

Permalink
Fixup various fakes for Rails 5 testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Phippen committed Dec 19, 2015
1 parent 3bf5af1 commit b795447
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions spec/rspec/rails/example/mailer_example_group_spec.rb
Expand Up @@ -5,6 +5,7 @@ module RSpec::Rails
module ::Rails; end
before do
allow(Rails).to receive_message_chain(:application, :routes, :url_helpers).and_return(Rails)
allow(Rails.application).to receive(:config).and_return(double("Rails.application.config").as_null_object)
allow(Rails).to receive_message_chain(:configuration, :action_mailer, :default_url_options).and_return({})
end

Expand Down
12 changes: 9 additions & 3 deletions spec/rspec/rails/matchers/have_http_status_spec.rb
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions spec/support/ar_classes.rb
Expand Up @@ -13,6 +13,8 @@ def self.extended(host)
nonexistent_model_id integer
)
eosql

host.reset_column_information
end
end

Expand Down

0 comments on commit b795447

Please sign in to comment.