Skip to content

Commit 0b6d946

Browse files
author
Sam Phippen
committed
Rails 5.2 compatability
1 parent 14357eb commit 0b6d946

File tree

8 files changed

+23
-2
lines changed

8 files changed

+23
-2
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ matrix:
7878
env: RAILS_VERSION=5-0-stable
7979
- rvm: 2.4.2
8080
env: RAILS_VERSION=5.1.0
81+
- rvm: 2.4.2
82+
env: RAILS_VERSION=5.2.0.rc1
8183
exclude:
8284
# 3.0.x is not supported on MRI 2.0+
8385
- rvm: 2.0.0

Gemfile

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

4545
# Capybara versions that support RSpec 3 only support RUBY_VERSION >= 1.9.3
4646
if RUBY_VERSION >= '1.9.3'
47-
if /5(\.|-)1/ === RAILS_VERSION || "master" == RAILS_VERSION
47+
if /5(\.|-)[1-9]\d*/ === RAILS_VERSION || "master" == RAILS_VERSION
4848
gem 'capybara', '~> 2.13', :require => false
4949
else
5050
gem 'capybara', '~> 2.2.0', :require => false

Gemfile-rails-dependencies

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ else
4343
if version >= '5-1-stable' && RUBY_VERSION >= "1.9.3"
4444
gem "puma"
4545
end
46+
if (version >= '5-2-stable' || version >= "5.2.0") && RUBY_VERSION >= "1.9.3"
47+
gem "activestorage"
48+
end
4649
end
4750

4851
gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3'
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: 6 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,11 @@
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+
append_to_file("Gemfile", "gem 'activestorage'\n")
33+
copy_file sqlite_initializer, 'config/initializers/sqlite3_fix.rb'
34+
end
35+
3036
# Nokogiri version is pinned in rspec-rails' Gemfile since it tend to cause installation problems
3137
# on Travis CI, so we pin nokogiri in this example app also.
3238
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)