Skip to content

Commit

Permalink
Fix compatibility with RSpec 3.10
Browse files Browse the repository at this point in the history
It seems that RSpec 3.10 changed the Has matcher which breaks the monkey
patches that SuperDiff makes. Fix those monkey patchers and extend the
Appraisals such that now we test against both RSpec < 3.10 and RSpec >=
3.10.
  • Loading branch information
mcmire committed Dec 23, 2020
1 parent 2642cb8 commit 6f1f896
Show file tree
Hide file tree
Showing 32 changed files with 1,270 additions and 101 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/super_diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ jobs:
- 2.5
- 2.6
- 2.7
gemfile:
- gemfiles/rails_5_0.gemfile
- gemfiles/rails_5_1.gemfile
- gemfiles/rails_5_2.gemfile
- gemfiles/rails_6_0.gemfile
- gemfiles/no_rails.gemfile
rails_appraisal:
- rails_5_0
- rails_5_1
- rails_5_2
- rails_6_0
- no_rails
rspec_appraisal:
- rspec_lt_3_10
- rspec_gte_3_10
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails_appraisal }}_${{ matrix.rspec_appraisal }}.gemfile
JAVA_OPTS: "--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.util.zip=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/javax.crypto=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=java.base/java.io=org.jruby.dist"
steps:
- uses: actions/checkout@v2
Expand All @@ -28,7 +31,7 @@ jobs:
- uses: actions/cache@v2
with:
path: vendor/bundle
key: v1-rubygems-local-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles(format('{0}.lock', matrix.gemfile)) }}
key: v1-rubygems-local-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles(format('gemfiles/{0}_{1}.gemfile.lock', matrix.rails_appraisal, matrix.rspec_appraisal)) }}
- name: Install dependencies
run: bin/ci/install
- name: Run tests
Expand Down
75 changes: 50 additions & 25 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,37 +1,62 @@
common_dependencies = proc do
rails_dependencies = proc do
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
gem "jdbc-sqlite3", platform: :jruby
end

appraise "rails_5_0" do
instance_eval(&common_dependencies)
appraisals = {
rails_5_0: proc {
instance_eval(&rails_dependencies)

gem "activerecord", "~> 5.0.0"
gem "sqlite3", "~> 1.3.6", platform: [:ruby, :mswin, :mingw]
end

appraise "rails_5_1" do
instance_eval(&common_dependencies)

gem "activerecord", "~> 5.1.0"
gem "sqlite3", "~> 1.3.6", platform: [:ruby, :mswin, :mingw]
end

appraise "rails_5_2" do
instance_eval(&common_dependencies)

gem "activerecord", "~> 5.2.0"
gem "sqlite3", "~> 1.3.6", platform: [:ruby, :mswin, :mingw]
end
gem "activerecord", "~> 5.0.0"
gem "sqlite3", "~> 1.3.6", platform: [:ruby, :mswin, :mingw]
},
rails_5_1: proc {
instance_eval(&rails_dependencies)

appraise "no_rails" do
end
gem "activerecord", "~> 5.1.0"
gem "sqlite3", "~> 1.3.6", platform: [:ruby, :mswin, :mingw]
},
rails_5_2: proc {
instance_eval(&rails_dependencies)

if Gem::Requirement.new(">= 2.5.0").satisfied_by?(Gem::Version.new(RUBY_VERSION))
appraise "rails_6_0" do
instance_eval(&common_dependencies)
gem "activerecord", "~> 5.2.0"
gem "sqlite3", "~> 1.3.6", platform: [:ruby, :mswin, :mingw]
},
rails_6_0: proc {
instance_eval(&rails_dependencies)

gem "activerecord", "~> 6.0"
gem "sqlite3", "~> 1.4.0", platform: [:ruby, :mswin, :mingw]
},
no_rails: proc {},
rspec_lt_3_10: proc {
gem "rspec", "< 3.10"
},
rspec_gte_3_10: proc {
gem "rspec", ">= 3.10", "< 4"
},
}

rails_appraisals = [
:rails_5_0,
:rails_5_1,
:rails_5_2,
:no_rails,
]
if Gem::Requirement.new(">= 2.5.0").satisfied_by?(Gem::Version.new(RUBY_VERSION))
rails_appraisals << :rails_6_0
end

rspec_appraisals = [
:rspec_lt_3_10,
:rspec_gte_3_10,
]

rails_appraisals.each do |rails_appraisal|
rspec_appraisals.each do |rspec_appraisal|
appraise "#{rails_appraisal}_#{rspec_appraisal}" do
instance_eval(&appraisals.fetch(rails_appraisal))
instance_eval(&appraisals.fetch(rspec_appraisal))
end
end
end
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ gem "childprocess"
gem "pry-byebug", platform: :mri
gem "pry-nav", platform: :jruby
gem "rake"
gem "rspec"
gem "rubocop"

gemspec
24 changes: 12 additions & 12 deletions gemfiles/no_rails.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GEM
byebug (11.1.3)
childprocess (4.0.0)
coderay (1.1.3)
diff-lcs (1.4.2)
diff-lcs (1.4.4)
method_source (1.0.0)
parallel (1.19.2)
parser (2.7.1.4)
Expand All @@ -35,19 +35,19 @@ GEM
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.0)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rspec-support (~> 3.10.0)
rspec-support (3.10.0)
rubocop (0.86.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
Expand Down
13 changes: 13 additions & 0 deletions gemfiles/no_rails_rspec_gte_3_10.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "childprocess"
gem "pry-byebug", platform: :mri
gem "pry-nav", platform: :jruby
gem "rake"
gem "rubocop"
gem "rspec", ">= 3.10", "< 4"

gemspec path: "../"
81 changes: 81 additions & 0 deletions gemfiles/no_rails_rspec_gte_3_10.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
PATH
remote: ..
specs:
super_diff (0.5.3)
attr_extras (>= 6.2.4)
diff-lcs
patience_diff

GEM
remote: https://rubygems.org/
specs:
appraisal (2.3.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.1)
attr_extras (6.2.4)
byebug (11.1.3)
childprocess (4.0.0)
coderay (1.1.3)
diff-lcs (1.4.4)
method_source (1.0.0)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
patience_diff (1.1.0)
trollop (~> 1.16)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rainbow (3.0.0)
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.0)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.0)
rubocop (0.89.1)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.3.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
ruby-progressbar (1.10.1)
thor (1.0.1)
trollop (1.16.2)
unicode-display_width (1.7.0)

PLATFORMS
ruby

DEPENDENCIES
appraisal
childprocess
pry-byebug
pry-nav
rake
rspec (>= 3.10, < 4)
rubocop
super_diff!

BUNDLED WITH
2.1.4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem "childprocess"
gem "pry-byebug", platform: :mri
gem "pry-nav", platform: :jruby
gem "rake"
gem "rspec"
gem "rubocop"
gem "rspec", "< 3.10"

gemspec path: "../"
81 changes: 81 additions & 0 deletions gemfiles/no_rails_rspec_lt_3_10.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
PATH
remote: ..
specs:
super_diff (0.5.3)
attr_extras (>= 6.2.4)
diff-lcs
patience_diff

GEM
remote: https://rubygems.org/
specs:
appraisal (2.3.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.1)
attr_extras (6.2.4)
byebug (11.1.3)
childprocess (4.0.0)
coderay (1.1.3)
diff-lcs (1.4.4)
method_source (1.0.0)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
patience_diff (1.1.0)
trollop (~> 1.16)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rainbow (3.0.0)
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rubocop (0.89.1)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.3.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
ruby-progressbar (1.10.1)
thor (1.0.1)
trollop (1.16.2)
unicode-display_width (1.7.0)

PLATFORMS
ruby

DEPENDENCIES
appraisal
childprocess
pry-byebug
pry-nav
rake
rspec (< 3.10)
rubocop
super_diff!

BUNDLED WITH
2.1.4
24 changes: 12 additions & 12 deletions gemfiles/rails_5_0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ GEM
childprocess (4.0.0)
coderay (1.1.3)
concurrent-ruby (1.1.6)
diff-lcs (1.4.2)
diff-lcs (1.4.4)
i18n (1.8.3)
concurrent-ruby (~> 1.0)
method_source (1.0.0)
Expand All @@ -51,19 +51,19 @@ GEM
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.0)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rspec-support (~> 3.10.0)
rspec-support (3.10.0)
rubocop (0.86.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
Expand Down
Loading

0 comments on commit 6f1f896

Please sign in to comment.