Skip to content

Commit

Permalink
Change minimum required Ruby to v3.1.2
Browse files Browse the repository at this point in the history
This is consider the correct minimum Ruby, because it is the Ruby
version which is available in the current Debian release,
Debian 12 (bookworm).

* https://www.debian.org/releases/
* https://packages.debian.org/bookworm/ruby/

Drop support for Ruby 2.6, 2.7, and 3.0.

* clean up Rubocop reports
* remove the bundler dependency, becuase it is built in now
* add required Rubygems MFA to the gemspec
  • Loading branch information
acant committed Jan 9, 2025
1 parent d84c92a commit a691924
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
ruby: [2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, head, jruby, jruby-head]
ruby: [3.1, 3.2, 3.3, 3.4, head, jruby, jruby-head]
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || endsWith(matrix.ruby, 'jruby') }}
runs-on: ${{ matrix.os }}
steps:
Expand Down
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
require: rubocop-rspec

AllCops:
NewCops: enable

Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec

Metrics/MethodLength:
Max: 20

Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.10
3.1.2
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
- upgrade Rake to v12 to resolve [CVE-2020-8130](https://github.com/advisories/GHSA-jppv-gw3r-w3q8)
- minimum required Ruby version to 3.1.2, dropping support for 2.x and 3.0

## 0.2.0 - 2018-07-12
### Changed
Expand Down
6 changes: 3 additions & 3 deletions lib/rspec/side_effects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Rspec
# @example
module SideEffects
def its_side_effects_are(*options, &block)
its_caller = caller.reject { |file_line| file_line =~ /its_side_effects/ }
its_caller = caller.grep_v(/its_side_effects/)
if options.last.is_a?(Hash)
options.last.merge(called: its_caller)
else
Expand All @@ -18,12 +18,12 @@ def its_side_effects_are(*options, &block)

describe('side effects', *options) do
if block
# rubocop:disable Lint/HandleExceptions, Lint/RescueException
# rubocop:disable Lint/RescueException, Lint/SuppressedException
before do
subject
rescue Exception
end
# rubocop:enable Lint/HandleExceptions, Lint/RescueException
# rubocop:enable Lint/RescueException, Lint/SuppressedException
example(nil, :aggregate_failures, *options, &block)
else
example(nil, {}) { subject }
Expand Down
16 changes: 7 additions & 9 deletions rspec-side_effects.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,24 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.6.0'
spec.required_ruby_version = '>= 3.1.2'

spec.add_runtime_dependency 'rspec-core', '>= 2.99.0'
spec.metadata['rubygems_mfa_required'] = 'true'

spec.add_development_dependency 'bundler', '~> 2.1'
spec.add_development_dependency 'rake', '~> 12.3'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_dependency 'rspec-core', '>= 2.99.0'

spec.add_development_dependency 'rake', '~> 12.3'
spec.add_development_dependency 'rspec', '~> 3.0'

# Dependencies whose APIs we do not really depend upon, and can be upgraded
# without limiting.
spec.add_development_dependency 'bundler-audit'
spec.add_development_dependency 'license_finder'
# HACK: Limit ourselves to Rubocop versions which still support Ruby2.2. This
# can be removed once we drop support for Ruby2.2.
spec.add_development_dependency 'rubocop', '~> 0.68.0'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop-rspec'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'simplecov-lcov'
Expand Down
18 changes: 9 additions & 9 deletions spec/rspec/side_effects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_standard_error
# @raise [Exception]
def test_exception
@exception = :exception
raise(Exception)
raise(Exception) # rubocop:disable Lint/RaiseException
end
end

Expand All @@ -51,9 +51,9 @@ def expect_instance_variable(variable_name)
subject { test_class.test1 }

its_side_effects_are do
expect_instance_variable(:var1).to eq(:var1)
expect_instance_variable(:var2).to eq(nil)
expect_instance_variable(:var3).to eq(nil)
expect_instance_variable(:var1).to be(:var1)
expect_instance_variable(:var2).to be_nil
expect_instance_variable(:var3).to be_nil
end
end

Expand All @@ -78,9 +78,9 @@ def expect_instance_variable(variable_name)
subject { test_class.test2 }

before do
# rubocop:disable RSpec/ExpectInHook, RSpec/MessageSpies
# rubocop:disable RSpec/ExpectInHook, RSpec/MessageSpies, RSpec/SubjectStub
expect(test_class).to receive(:inner_test)
# rubocop:enable RSpec/ExpectInHook, RSpec/MessageSpies
# rubocop:enable RSpec/ExpectInHook, RSpec/MessageSpies, RSpec/SubjectStub
end

it_has_side_effects
Expand All @@ -90,9 +90,9 @@ def expect_instance_variable(variable_name)
subject { test_class.test1 }

specify_side_effects do
expect_instance_variable(:var1).to eq(:var1)
expect_instance_variable(:var2).to eq(nil)
expect_instance_variable(:var3).to eq(nil)
expect_instance_variable(:var1).to be(:var1)
expect_instance_variable(:var2).to be_nil
expect_instance_variable(:var3).to be_nil
end
end
end

0 comments on commit a691924

Please sign in to comment.