Skip to content

Setup to run Rails 5 builds, and fix a few issues. #1485

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

Merged
merged 4 commits into from
Nov 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ env:
- RAILS_VERSION='~> 3.0.20'

matrix:
include:
# Rails 5.x only supports 2.2
- rvm: 2.2.2
env: RAILS_VERSION=master
exclude:
# 3.0.x is not supported on MRI 2.0+
- rvm: 2.0.0
Expand Down Expand Up @@ -88,6 +92,9 @@ matrix:
# MRI 2.2 is not supported on a few versions
- rvm: 2.2
env: RAILS_VERSION='~> 3.1.12'
allow_failures:
- rvm: 2.2.2
env: RAILS_VERSION=master
fast_finish: true

branches:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile-rails-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ when /master/
gem 'coffee-rails', :git => "git://github.com/rails/coffee-rails.git"
gem 'rack', :git => 'git://github.com/rack/rack.git'
gem 'i18n', :git => 'git://github.com/svenfuchs/i18n.git', :branch => 'master'
gem 'sprockets', :git => 'git://github.com/rails/sprockets.git', :branch => 'master'
gem 'sprockets-rails', :git => 'git://github.com/rails/sprockets-rails.git', :branch => 'master'
when /stable$/
gem "rails", :git => "git://github.com/rails/rails.git", :branch => version
when nil, false, ""
Expand Down
6 changes: 5 additions & 1 deletion lib/rspec/rails/fixture_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module FixtureSupport
# /TODO

self.fixture_path = RSpec.configuration.fixture_path
self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
if ::Rails::VERSION::STRING > '5'
self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures
else
self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
end
self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
end
Expand Down
3 changes: 2 additions & 1 deletion lib/rspec/rails/matchers/have_http_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ def as_test_response(obj)
# Acts As Capybara Session
# Hack to support `Capybara::Session` without having to load
# Capybara or catch `NameError`s for the undefined constants
::ActionDispatch::TestResponse.new.tap do |resp|
obj = ActionDispatch::Response.new.tap do |resp|
resp.status = obj.status_code
resp.headers = obj.response_headers
resp.body = obj.body
end
::ActionDispatch::TestResponse.from_response(obj)
else
raise TypeError, "Invalid response type: #{obj}"
end
Expand Down
6 changes: 3 additions & 3 deletions rspec-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Gem::Specification.new do |s|
s.cert_chain = [File.expand_path('~/.gem/rspec-gem-public_cert.pem')]
end

s.add_runtime_dependency(%q<activesupport>, [">= 3.0", "< 4.3"])
s.add_runtime_dependency(%q<actionpack>, [">= 3.0", "< 4.3"])
s.add_runtime_dependency(%q<railties>, [">= 3.0", "< 4.3"])
s.add_runtime_dependency %q<activesupport>, ">= 3.0"
s.add_runtime_dependency %q<actionpack>, ">= 3.0"
s.add_runtime_dependency %q<railties>, ">= 3.0"
%w[core expectations mocks support].each do |name|
if RSpec::Rails::Version::STRING =~ /[a-zA-Z]+/ # prerelease builds
s.add_runtime_dependency "rspec-#{name}", "= #{RSpec::Rails::Version::STRING}"
Expand Down
10 changes: 8 additions & 2 deletions spec/rspec/rails/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,11 @@ def in_inferring_type_from_location_environment

it "metadata `:type => :request` sets up request example groups" do
a_rails_app = double("Rails application")
the_rails_module = double("Rails module", :application => a_rails_app)
the_rails_module = Module.new
allow(the_rails_module).to receive(:application) { a_rails_app }
version = ::Rails::VERSION
stub_const "Rails", the_rails_module
stub_const 'Rails::VERSION', version

group = RSpec.describe("Some Request API", :type => :request)

Expand Down Expand Up @@ -227,8 +230,11 @@ def in_inferring_type_from_location_environment

it "metadata `:type => :feature` sets up feature example groups" do
a_rails_app = double("Rails application")
the_rails_module = double("Rails module", :application => a_rails_app)
the_rails_module = Module.new
allow(the_rails_module).to receive(:application) { a_rails_app }
version = ::Rails::VERSION
stub_const "Rails", the_rails_module
stub_const 'Rails::VERSION', version

group = RSpec.describe("Some feature description", :type => :feature)
example = group.new
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/rails/matchers/have_http_status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
include RSpec::Rails::Matchers

def create_response(opts = {})
ActionController::TestResponse.new(opts.fetch(:status))
ActionDispatch::TestResponse.new(opts.fetch(:status))
end

shared_examples_for "supports different response instances" do
Expand Down
6 changes: 3 additions & 3 deletions spec/rspec/rails/matchers/have_rendered_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%w[have_rendered render_template].each do |template_expectation|
describe template_expectation do
include RSpec::Rails::Matchers::RenderTemplate
let(:response) { ActionController::TestResponse.new }
let(:response) { ActionDispatch::TestResponse.new }

context "given a hash" do
it "delegates to assert_template" do
Expand Down Expand Up @@ -90,7 +90,7 @@ def assert_template(*); raise "oops"; end
end

context "when fails with a redirect" do
let(:response) { ActionController::TestResponse.new(302) }
let(:response) { ActionDispatch::TestResponse.new(303) }

def assert_template(*)
message = "expecting <'template_name'> but rendering with <[]>"
Expand All @@ -102,7 +102,7 @@ def normalize_argument_to_redirection(response_redirect_location)
end

it "gives informative error message" do
response = ActionController::TestResponse.new(302)
response = ActionDispatch::TestResponse.new(302)
response.location = "http://test.host/widgets/1"
expect do
expect(response).to send(template_expectation, "template_name")
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/rails/matchers/redirect_to_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe "redirect_to" do
include RSpec::Rails::Matchers::RedirectTo

let(:response) { ActionController::TestResponse.new }
let(:response) { ActionDispatch::TestResponse.new }

context "with should" do
context "when assert_redirected_to passes" do
Expand Down