diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6deeb54..4afdcac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,12 @@ jobs: - '3.3' - '3.4' - '4.0' - name: RSpec tests ruby ${{ matrix.ruby }} + rspec: + - '3' + - '4' + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rspec${{ matrix.rspec }}.gemfile + name: RSpec ${{ matrix.rspec }} tests ruby ${{ matrix.ruby }} steps: - name: Check out code uses: actions/checkout@v6.1.0 @@ -36,6 +41,14 @@ jobs: run: bundle exec rspec spec/rspec e2e: runs-on: ubuntu-latest + strategy: + matrix: + rspec: + - '3' + - '4' + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rspec${{ matrix.rspec }}.gemfile + name: e2e RSpec ${{ matrix.rspec }} steps: - name: Check out code uses: actions/checkout@v6.1.0 diff --git a/.rspec b/.rspec index 6ed2e49..b2da205 100644 --- a/.rspec +++ b/.rspec @@ -1,4 +1,3 @@ ---color --require spec_helper --format documentation --format RSpec::Github::Formatter diff --git a/Gemfile.lock b/Gemfile.lock index 9408e7f..e8b1605 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: rspec-github (1.0.0.develop) - rspec-core (~> 3.0) + rspec-core (>= 3.0, < 5) GEM remote: https://rubygems.org/ diff --git a/gemfiles/rspec3.gemfile b/gemfiles/rspec3.gemfile new file mode 100644 index 0000000..6f7fd86 --- /dev/null +++ b/gemfiles/rspec3.gemfile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gemspec path: '../' + +group :development do + gem 'rspec', '~> 3.13' +end diff --git a/gemfiles/rspec3.gemfile.lock b/gemfiles/rspec3.gemfile.lock new file mode 100644 index 0000000..aec4cfe --- /dev/null +++ b/gemfiles/rspec3.gemfile.lock @@ -0,0 +1,33 @@ +PATH + remote: .. + specs: + rspec-github (1.0.0.develop) + rspec-core (>= 3.0, < 5) + +GEM + remote: https://rubygems.org/ + specs: + diff-lcs (1.6.2) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.7) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.9) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.8) + +PLATFORMS + ruby + +DEPENDENCIES + rspec (~> 3.13) + rspec-github! + +BUNDLED WITH + 2.6.0 diff --git a/gemfiles/rspec4.gemfile b/gemfiles/rspec4.gemfile new file mode 100644 index 0000000..a41f9c0 --- /dev/null +++ b/gemfiles/rspec4.gemfile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gemspec path: '../' + +group :development do + gem 'rspec', '~> 4.0.0.beta1' +end diff --git a/gemfiles/rspec4.gemfile.lock b/gemfiles/rspec4.gemfile.lock new file mode 100644 index 0000000..3e98b61 --- /dev/null +++ b/gemfiles/rspec4.gemfile.lock @@ -0,0 +1,33 @@ +PATH + remote: .. + specs: + rspec-github (1.0.0.develop) + rspec-core (>= 3.0, < 5) + +GEM + remote: https://rubygems.org/ + specs: + diff-lcs (2.0.0) + rspec (4.0.0.beta1) + rspec-core (= 4.0.0.beta1) + rspec-expectations (= 4.0.0.beta1) + rspec-mocks (= 4.0.0.beta1) + rspec-core (4.0.0.beta1) + rspec-support (= 4.0.0.beta1) + rspec-expectations (4.0.0.beta1) + diff-lcs (>= 1.6.0, < 3.0) + rspec-support (= 4.0.0.beta1) + rspec-mocks (4.0.0.beta1) + diff-lcs (>= 1.6.0, < 3.0) + rspec-support (= 4.0.0.beta1) + rspec-support (4.0.0.beta1) + +PLATFORMS + ruby + +DEPENDENCIES + rspec (~> 4.0.0.beta1) + rspec-github! + +BUNDLED WITH + 2.6.0 diff --git a/rspec-github.gemspec b/rspec-github.gemspec index 0d11b53..84847b6 100644 --- a/rspec-github.gemspec +++ b/rspec-github.gemspec @@ -21,5 +21,5 @@ Gem::Specification.new do |spec| # Specify which files should be added to the gem when it is released. spec.files = Dir['{lib}/**/*'] - spec.add_dependency 'rspec-core', '~> 3.0' + spec.add_dependency 'rspec-core', '>= 3.0', '< 5' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5267aa8..0007253 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,10 +7,14 @@ # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status' - # Disable RSpec exposing methods globally on `Module` and `main` - config.disable_monkey_patching! + # RSpec 4 no longer exposes its DSL globally and dropped the `should` syntax, + # so these settings only exist (and are only needed) on RSpec 3. + if config.respond_to?(:disable_monkey_patching!) + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! - config.expect_with :rspec do |c| - c.syntax = :expect + config.expect_with :rspec do |c| + c.syntax = :expect + end end end