Skip to content

Commit 259dc3b

Browse files
authored
Merge pull request #1959 from rspec/rails-5-2-compat
Rails 5.2 compatability
2 parents 770a78f + f028790 commit 259dc3b

File tree

7 files changed

+19
-2
lines changed

7 files changed

+19
-2
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ matrix:
8383
env: RAILS_VERSION=5-0-stable
8484
- rvm: 2.5.1
8585
env: RAILS_VERSION=5.1.0
86+
- rvm: 2.4.2
87+
env: RAILS_VERSION=5.2.0.rc1
8688
exclude:
8789
# 3.0.x is not supported on MRI 2.0+
8890
- rvm: 2.0.0

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ end
4747

4848
# Capybara versions that support RSpec 3 only support RUBY_VERSION >= 1.9.3
4949
if RUBY_VERSION >= '1.9.3'
50-
if /5(\.|-)1/ === RAILS_VERSION || "master" == RAILS_VERSION
50+
if /5(\.|-)[1-9]\d*/ === RAILS_VERSION || "master" == RAILS_VERSION
5151
gem 'capybara', '~> 2.13', :require => false
5252
else
5353
gem 'capybara', '~> 2.2.0', :require => false
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if Rails.application.config.respond_to?(:active_record)
2+
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
3+
end

example_app_generator/generate_app.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'travis_retry_bundle_install.sh'
1212
)
1313
function_script_file = File.join(rspec_rails_repo_path, 'script/functions.sh')
14+
sqlite_initializer = File.join(rspec_rails_repo_path, "example_app_generator/config/initializers/sqlite3_fix.rb")
1415

1516
in_root do
1617
prepend_to_file "Rakefile", "require 'active_support/all'"
@@ -27,6 +28,10 @@
2728
append_to_file('Gemfile', "gem 'rails-controller-testing', :git => 'https://github.com/rails/rails-controller-testing'\n")
2829
end
2930

31+
if Rails::VERSION::STRING >= '5.2.0'
32+
copy_file sqlite_initializer, 'config/initializers/sqlite3_fix.rb'
33+
end
34+
3035
# Nokogiri version is pinned in rspec-rails' Gemfile since it tend to cause installation problems
3136
# on Travis CI, so we pin nokogiri in this example app also.
3237
append_to_file 'Gemfile', "gem 'nokogiri', '#{Nokogiri::VERSION}'\n"

example_app_generator/log/development.log

Whitespace-only changes.

example_app_generator/spec/support/default_preview_path

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ def require_file_stub(name)
55
end
66

77
ENV['RAILS_ENV'] ||= 'development'
8+
# Pick the frameworks you want:
9+
begin
10+
require "active_storage"
11+
require "active_storage/engine"
12+
rescue LoadError
13+
end
814

915
require_file_stub 'config/environment' do
1016
# Load the Rails application.

lib/rspec/rails/example/system_example_group.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def app
5151
require 'capybara'
5252
require 'action_dispatch/system_test_case'
5353
# rubocop:disable Lint/HandleExceptions
54-
rescue LoadError
54+
rescue LoadError => e
55+
p e
5556
# rubocop:enable Lint/HandleExceptions
5657
abort """
5758
System test integration requires Rails >= 5.1 and has a hard

0 commit comments

Comments
 (0)