Skip to content

Commit

Permalink
Working to get the old CI on travis green
Browse files Browse the repository at this point in the history
It seems like rails 6.1 broke rspec <4.0
until it was fixed with rspec/rspec-rails#2215 then fixed differently with rspec/rspec-rails#2461
so we skip rspec 3x with rails 6.1 in CI
  • Loading branch information
alexrothenberg committed Feb 24, 2021
1 parent 585ca1d commit a46bf28
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 43 deletions.
15 changes: 9 additions & 6 deletions .travis.yml
Expand Up @@ -2,15 +2,18 @@ language: ruby
sudo: false

rvm:
- 2.6
- 2.7
- 2.5
- 3.0
- ruby-head
- jruby-9.2.14
- jruby-9.1.9

env:
- RSPEC_VERSION=master
- RSPEC_VERSION='~> 3.10'
- RSPEC_VERSION=master RAILS_VERSION='~>6.1.0'
- RSPEC_VERSION='~> 4.0' RAILS_VERSION='~>6.1.0'
- RSPEC_VERSION='~> 4.0' RAILS_VERSION='~>6.0.0'
- RSPEC_VERSION='~> 4.0' RAILS_VERSION='~>5.2.0'
- RSPEC_VERSION='~> 3.9' RAILS_VERSION='~>6.0.0'
- RSPEC_VERSION='~> 3.9' RAILS_VERSION='~>5.2.0'

bundler_args: "--retry=3 --jobs=3"

Expand All @@ -19,4 +22,4 @@ script: "bundle exec rake ci --trace"
matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-9.2.14.0
- rvm: jruby-9.1.9.0
43 changes: 11 additions & 32 deletions Gemfile
@@ -1,7 +1,7 @@
source "http://rubygems.org"

rspec_version = ENV['RSPEC_VERSION']
rspec_major_version = (rspec_version && rspec_version != 'master') ? rspec_version.scan(/\d+/).first : '3'
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'

if rspec_version == 'master'
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
Expand All @@ -13,38 +13,17 @@ if rspec_version == 'master'
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
else
gem 'rspec-rails', rspec_version
gem 'rspec', rspec_version
gem 'rspec', rspec_version
end

if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
# rspec 2.x does not support Rails 4.1+ nor does Ruby 1.8.7
gem 'rails', '~> 3.2'
gem 'uglifier', '~> 1.2.4'
gem 'rake', '~> 0.9.2.2'
gem 'coffee-rails', '~> 3.2'
gem 'sass-rails', '~> 3.2'
gem 'jquery-rails', '~> 2.0'
gem 'haml-rails', '~> 0.4'
gem 'execjs', '~> 2.0.0'
elsif rspec_major_version == '3'
if RUBY_VERSION < '2.2.2'
gem 'rails', '< 5.0' # rails 5 is ruby >= 2.2.2
else
gem 'rails', '>= 4.0'
end
gem 'uglifier', '>= 1.3'
gem 'rake', '>= 0.10'
gem 'coffee-rails', '>= 4.0'
gem 'sass-rails', '>= 4.0'
gem 'jquery-rails', '>= 3.0'
gem 'haml-rails', '>= 0.5'
else
raise "rspec version #{rspec_version} is not supported"
end

gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3'
gem "rack", '<= 1.6.4' if RUBY_VERSION < '2.2.2'
gem 'rails', rails_version
gem 'uglifier'
gem 'rake'
gem 'coffee-rails'
gem 'sass-rails'
gem 'jquery-rails'
gem 'haml-rails'

# Specify your gem's dependencies in rspec-rails-generator-specs.gemspec
# Specify your gem's dependencies in ammeter.gemspec
gemspec

3 changes: 1 addition & 2 deletions Rakefile
Expand Up @@ -42,13 +42,12 @@ end
namespace :generate do
desc "generate a fresh app with rspec installed"
task :app => :ensure_bundler_11 do |t|
sh "bundle exec rails new ./tmp/example_app -m 'features/templates/generate_example_app.rb' --skip-test-unit"
sh "bundle exec rails new ./tmp/example_app -m 'features/templates/generate_example_app.rb' --skip-test-unit --skip-bootsnap --skip-spring --skip-webpack-install"
sh "cp 'features/templates/rspec.rake' ./tmp/example_app/lib/tasks"
Dir.chdir("./tmp/example_app/") do
Bundler.unbundled_system 'bundle install'
Bundler.unbundled_system 'rake db:migrate'
Bundler.unbundled_system 'rails g rspec:install'
Bundler.unbundled_system 'spring stop'
end
end

Expand Down
2 changes: 0 additions & 2 deletions ammeter.gemspec
Expand Up @@ -21,8 +21,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'activesupport', '>= 3.0'
s.add_runtime_dependency 'rspec-rails', '>= 2.2'

s.add_runtime_dependency 'bootsnap'

s.add_development_dependency 'rspec', '>= 2.2'
s.add_development_dependency 'rails', '>= 3.1'
s.add_development_dependency 'uglifier', '>= 1.2.4'
Expand Down
2 changes: 1 addition & 1 deletion features/support/env.rb
Expand Up @@ -42,7 +42,7 @@ def copy_to_aruba_from(gem_or_app_name)
if rspec_major_version == '2'
# rspec 2.x does not create rails_helper.rb so we create a symlink to avoid cluttering tests
write_symlink("tmp/#{gem_or_app_name}/spec/spec_helper.rb", gem_or_app_name, 'rails_helper.rb')
elsif rspec_major_version == '3'
elsif rspec_major_version >= '3'
write_symlink("tmp/#{gem_or_app_name}/spec/rails_helper.rb", gem_or_app_name)
end
end
Expand Down

0 comments on commit a46bf28

Please sign in to comment.