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-rails.
RSpec-rails 4.0 fixed it with rspec/rspec-rails#2215 then fixed differently with rspec/rspec-rails#2461
so we skip rspec-rails >4 with rails 6.1 in CI
  • Loading branch information
alexrothenberg committed Feb 24, 2021
1 parent a3ccc6e commit a0a8990
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 87 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: RSpec CI
on:
push:
branches:
- 'main'
- 'gitub-action-ci'
pull_request:
branches:
- '*'
jobs:
test:
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- ruby: 2.7
env:
RAILS_VERSION: '~> 6.1.0'
RAILS_VERSION: '~> 4.0'
env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: bundle install --binstubs
- run: bundle exec rake ci
continue-on-error: ${{ matrix.allow_failure || false }}
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

44 changes: 11 additions & 33 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "http://rubygems.org"
source 'https://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,16 @@ 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
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
1 change: 0 additions & 1 deletion features/templates/generate_example_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
else
gem 'rspec-rails', rspec_version
gem 'rspec', rspec_version
end

gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3'
Expand Down
16 changes: 3 additions & 13 deletions features/templates/my_rails_gem/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://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,19 +13,9 @@ 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
end

if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
gem 'rails', '~> 3.2.0'
# Execjs is causing problems on 1.8.7
gem 'execjs', '~> 2.0.0'
elsif rspec_major_version == '3'
gem 'rails', '>= 4.1'
else
raise "rspec version #{rspec_version} is not supported"
end

gem 'rails', rails_version

# Specify your gem's dependencies in my_gem.gemspec
gemspec
Expand Down
16 changes: 3 additions & 13 deletions features/templates/my_railties_gem/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://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,19 +13,9 @@ 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
end

if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
gem 'railties', '~> 3.2.0'
# Execjs is causing problems on 1.8.7
#gem 'execjs', '~> 2.0.0'
elsif rspec_major_version == '3'
gem 'railties', '>= 4.1'
else
raise "rspec version #{rspec_version} is not supported"
end

gem 'railties', rails_version

# Specify your gem's dependencies in my_gem.gemspec
gemspec
Expand Down

0 comments on commit a0a8990

Please sign in to comment.