Skip to content

Commit

Permalink
Support Ruby 3.3
Browse files Browse the repository at this point in the history
Update CI test coverage matrix to: 2.7 - 3.3
  - Add 3.2 and 3.3 to testing matrix
  - Remove rubies prior to 2.7
  - Remove truffleruby due to occasional failures
    (Open to adding back if a user requests it)
  - Update CI to run rubucop on ruby 3.3

Changes
  - Handle the changes to NoMethodError messages in 3.3

Additional maintenance
  - Load rubocop-rake in rubocop.yml to eliminate warning
  - Fix rubocop warning about whitespace in docile.gemspec
  - Fix rubocop warning about remove_const in spec_helper.rb
  - Fix rubocop warning about unnecessary super params in chaining_fallback_context_proxy.rb
  • Loading branch information
ms-ati committed Jul 25, 2024
1 parent 6525f8a commit 0d8c7cf
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: [jruby, truffleruby, 2.5, 2.6, 2.7, '3.0', 3.1, head]
ruby: [jruby, 2.7, '3.0', 3.1, 3.2, 3.3, head]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3.3.0
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Set bundler environment variables
run: |
echo "BUNDLE_WITHOUT=checks" >> $GITHUB_ENV
if: matrix.ruby != 3.1
if: matrix.ruby != 3.3

- uses: ruby/setup-ruby@v1
with:
Expand All @@ -39,4 +39,4 @@ jobs:
file: ./coverage/coverage.xml

- run: bundle exec rubocop
if: matrix.ruby == 3.1
if: matrix.ruby == 3.3
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
inherit_gem:
panolint: panolint-rubocop.yml

require:
- rubocop-rake
10 changes: 5 additions & 5 deletions docile.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Gem::Specification.new do |s|
s.email = "marc@usainnov.com"
s.homepage = "https://ms-ati.github.io/docile/"
s.summary = "Docile keeps your Ruby DSLs tame and well-behaved."
s.description = "Docile treats the methods of a given ruby object as a DSL " \
"(domain specific language) within a given block. \n\n" \
"Killer feature: you can also reference methods, instance " \
s.description = "Docile treats the methods of a given ruby object as a DSL "\
"(domain specific language) within a given block. \n\n"\
"Killer feature: you can also reference methods, instance "\
"variables, and local variables from the original (non-DSL) "\
"context within the block. \n\n" \
"Docile releases follow Semantic Versioning as defined at " \
"context within the block. \n\n"\
"Docile releases follow Semantic Versioning as defined at "\
"semver.org."
s.license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion lib/docile/chaining_fallback_context_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ChainingFallbackContextProxy < FallbackContextProxy
# Proxy methods as in {FallbackContextProxy#method_missing}, replacing
# `receiver` with the returned value.
def method_missing(method, *args, &block)
@__receiver__ = super(method, *args, &block)
@__receiver__ = super
end

ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)
Expand Down
4 changes: 2 additions & 2 deletions spec/docile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def save_factorial(num)

it "raises NoMethodError" do
expect { subject.call(5) }.
to raise_error(NoMethodError, /method `at' /)
to raise_error(NoMethodError, /method (`|')at' /)
end

it "removes fallback instrumentation from the DSL object after block" do
Expand All @@ -249,7 +249,7 @@ def push_element
expect { push_element }.
to raise_error(
NoMethodError,
/undefined method `push' (for|on) nil/
/undefined method (`|')push' (for|on) nil/
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# Due to circular dependency (SimpleCov depends on Docile), remove docile and
# then require the docile gem again below.
Object.send(:remove_const, :Docile)
Object.send(:remove_const, :Docile) # rubocop:disable RSpec/RemoveConst
$LOADED_FEATURES.reject! { |f| f.include?("/lib/docile") }

# Require Docile again, now with coverage enabled
Expand Down

0 comments on commit 0d8c7cf

Please sign in to comment.