From 2729c45c9ce269556a858b12e9d13780e8b3a331 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Sat, 21 Feb 2026 11:10:27 -0500 Subject: [PATCH 1/6] Upgrade to Ruby 3.x compatibility - Bump required_ruby_version from ~> 2.5 to >= 3.0 - Upgrade parser from ~> 2.5 to >= 3.0, unparser from ~> 0.4 to >= 0.6 - Replace coveralls/pry-byebug with simplecov/pry (Ruby 3 compat) - Remove Travis CI version logic from gemspec - Fix consecutive :str nodes in :dstr for unparser 0.8 round-trip - Fix nil children in :begin nodes from empty class bodies - Filter nil children in process_rspock - Update test expectations for unparser 0.8 output formatting - Point ast_transform to local path for development Co-authored-by: Cursor --- Gemfile | 2 + Gemfile.lock | 111 ++++++++---------- .../ast/test_method_def_transformation.rb | 3 +- .../ast/test_method_dstr_transformation.rb | 11 +- lib/rspock/ast/transformation.rb | 3 +- rspock.gemspec | 23 ++-- .../ast/interaction_transformation_test.rb | 2 +- .../test_method_def_transformation_test.rb | 6 +- .../test_method_dstr_transformation_test.rb | 3 +- test/rspock/ast/transformation_test.rb | 50 ++++---- test/test_loader.rb | 7 -- 11 files changed, 98 insertions(+), 123 deletions(-) diff --git a/Gemfile b/Gemfile index 4a8be62..a90c597 100644 --- a/Gemfile +++ b/Gemfile @@ -2,5 +2,7 @@ source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } +gem "ast_transform", path: "../ast-transform" + # Specify your gem's dependencies in rspock.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index 4dc9c3a..fa69adf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,96 +1,77 @@ +PATH + remote: ../ast-transform + specs: + ast_transform (1.0.0) + parser (>= 3.0) + unparser (>= 0.6) + PATH remote: . specs: rspock (1.0.0) ast_transform (~> 1.0) minitest (~> 5.0) - mocha (~> 1.0) - parser (~> 2.5) - unparser (~> 0.4) + mocha (>= 1.0) + parser (>= 3.0) + unparser (>= 0.6) GEM remote: https://rubygems.org/ specs: - abstract_type (0.0.7) - adamantium (0.2.0) - ice_nine (~> 0.11.0) - memoizable (~> 0.4.0) ansi (1.5.0) - ast (2.4.1) - ast_transform (1.0.0) - parser (~> 2.5) - unparser (~> 0.4) - builder (3.2.4) - byebug (11.1.3) + ast (2.4.3) + builder (3.3.0) coderay (1.1.3) - concord (0.1.5) - adamantium (~> 0.2.0) - equalizer (~> 0.0.9) - coveralls (0.8.23) - json (>= 1.8, < 3) - simplecov (~> 0.16.1) - term-ansicolor (~> 1.3) - thor (>= 0.19.4, < 2.0) - tins (~> 1.6) - diff-lcs (1.4.4) - docile (1.3.2) - equalizer (0.0.11) - ice_nine (0.11.2) - json (2.3.1) - memoizable (0.4.2) - thread_safe (~> 0.3, >= 0.3.1) - method_source (1.0.0) - minitest (5.14.1) - minitest-reporters (1.4.2) + diff-lcs (1.6.2) + docile (1.4.1) + io-console (0.8.2) + method_source (1.1.0) + minitest (5.27.0) + minitest-reporters (1.7.1) ansi builder minitest (>= 5.0) ruby-progressbar - mocha (1.11.2) - parser (2.7.1.4) + mocha (3.0.2) + ruby2_keywords (>= 0.0.5) + parser (3.3.10.2) ast (~> 2.4.1) - procto (0.0.3) - pry (0.13.1) + racc + prism (1.9.0) + pry (0.16.0) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) - byebug (~> 11.0) - pry (~> 0.13.0) - rake (13.0.1) - ruby-progressbar (1.10.1) - simplecov (0.16.1) + reline (>= 0.6.0) + racc (1.8.1) + rake (13.3.1) + reline (0.6.3) + io-console (~> 0.5) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) + simplecov (0.22.0) docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) - sync (0.5.0) - term-ansicolor (1.7.1) - tins (~> 1.0) - thor (1.0.1) - thread_safe (0.3.6) - tins (1.25.0) - sync - unparser (0.4.7) - abstract_type (~> 0.0.7) - adamantium (~> 0.2.0) - concord (~> 0.1.5) - diff-lcs (~> 1.3) - equalizer (~> 0.0.9) - parser (>= 2.6.5) - procto (~> 0.0.2) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.2) + simplecov_json_formatter (0.1.4) + unparser (0.8.1) + diff-lcs (~> 1.6) + parser (>= 3.3.0) + prism (>= 1.5.1) PLATFORMS + arm64-darwin-24 ruby DEPENDENCIES - bundler (~> 2.1) - coveralls (~> 0.8) + ast_transform! + bundler (>= 2.1) minitest (~> 5.14) minitest-reporters (~> 1.4) - pry (~> 0.13) - pry-byebug (~> 3.9) + pry (>= 0.14) rake (~> 13.0) rspock! + simplecov (~> 0.22) BUNDLED WITH - 2.1.4 + 2.5.22 diff --git a/lib/rspock/ast/test_method_def_transformation.rb b/lib/rspock/ast/test_method_def_transformation.rb index f0b7900..f21f864 100644 --- a/lib/rspock/ast/test_method_def_transformation.rb +++ b/lib/rspock/ast/test_method_def_transformation.rb @@ -22,7 +22,8 @@ def run(node) end def on_str(node) - node.updated(:dstr, [node, SPACE_STR_AST, TEST_INDEX_AST, LINE_NUMBER_STR_AST, LINE_NUMBER_AST]) + merged = s(:str, "#{node.children[0]} ") + node.updated(:dstr, [merged, TEST_INDEX_AST, LINE_NUMBER_STR_AST, LINE_NUMBER_AST]) end def on_dstr(node) diff --git a/lib/rspock/ast/test_method_dstr_transformation.rb b/lib/rspock/ast/test_method_dstr_transformation.rb index dc13986..e1b1795 100644 --- a/lib/rspock/ast/test_method_dstr_transformation.rb +++ b/lib/rspock/ast/test_method_dstr_transformation.rb @@ -15,7 +15,16 @@ class TestMethodDstrTransformation < ASTTransform::AbstractTransformation LINE_NUMBER_STR_AST = s(:str, " line ") def on_dstr(node) - children = [*process_all(node), SPACE_STR_AST, TEST_INDEX_AST, LINE_NUMBER_STR_AST, LINE_NUMBER_AST] + children = process_all(node).dup + last = children.last + + if last&.type == :str + children[-1] = s(:str, "#{last.children[0]} ") + else + children << SPACE_STR_AST + end + + children.push(TEST_INDEX_AST, LINE_NUMBER_STR_AST, LINE_NUMBER_AST) node.updated(nil, children) end end diff --git a/lib/rspock/ast/transformation.rb b/lib/rspock/ast/transformation.rb index 085724a..0092bcc 100644 --- a/lib/rspock/ast/transformation.rb +++ b/lib/rspock/ast/transformation.rb @@ -82,7 +82,8 @@ def process_casgn_block(node) end def process_rspock(node) - children = [source_map_rescue_wrapper(s(:begin, *[EXTEND_RSPOCK_DECLARATIVE, *process_all(node)]))] + processed = process_all(node).compact + children = [source_map_rescue_wrapper(s(:begin, *[EXTEND_RSPOCK_DECLARATIVE, *processed]))] node.updated(nil, children) end diff --git a/rspock.gemspec b/rspock.gemspec index fb9ea75..3df0e9c 100644 --- a/rspock.gemspec +++ b/rspock.gemspec @@ -19,29 +19,20 @@ Gem::Specification.new do |spec| spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.required_ruby_version = '~> 2.5' - - if ENV['TRAVIS'] - if ENV['TRAVIS_TAG'].nil? || ENV['TRAVIS_TAG'].empty? - spec.version = "#{spec.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" - elsif ENV['TRAVIS_TAG'] != spec.version.to_s - raise "Tag name (#{ENV['TRAVIS_TAG']}) and Gem version (#{spec.version}) are different" - end - end + spec.required_ruby_version = '>= 3.0' # Development dependencies - spec.add_development_dependency "bundler", "~> 2.1" - spec.add_development_dependency "coveralls", "~> 0.8" + spec.add_development_dependency "bundler", ">= 2.1" spec.add_development_dependency "minitest", "~> 5.14" spec.add_development_dependency "minitest-reporters", "~> 1.4" - spec.add_development_dependency "pry", "~> 0.13" - spec.add_development_dependency "pry-byebug", "~> 3.9" + spec.add_development_dependency "pry", ">= 0.14" spec.add_development_dependency "rake", "~> 13.0" + spec.add_development_dependency "simplecov", "~> 0.22" # Runtime dependencies spec.add_runtime_dependency "ast_transform", "~> 1.0" spec.add_runtime_dependency "minitest", "~> 5.0" - spec.add_runtime_dependency "mocha", "~> 1.0" - spec.add_runtime_dependency "parser", "~> 2.5" - spec.add_runtime_dependency "unparser", "~> 0.4" + spec.add_runtime_dependency "mocha", ">= 1.0" + spec.add_runtime_dependency "parser", ">= 3.0" + spec.add_runtime_dependency "unparser", ">= 0.6" end diff --git a/test/rspock/ast/interaction_transformation_test.rb b/test/rspock/ast/interaction_transformation_test.rb index e9ea984..8373603 100644 --- a/test/rspock/ast/interaction_transformation_test.rb +++ b/test/rspock/ast/interaction_transformation_test.rb @@ -33,7 +33,7 @@ def setup HEREDOC expected = <<~HEREDOC - receiver.expects(:message).with(param1, *param2, p3: param3).times(1) + receiver.expects(:message).with(param1, *param2, { p3: param3 }).times(1) HEREDOC assert_equal strip_end_line(expected), transform(source) diff --git a/test/rspock/ast/test_method_def_transformation_test.rb b/test/rspock/ast/test_method_def_transformation_test.rb index baf5686..c2ff6ee 100644 --- a/test/rspock/ast/test_method_def_transformation_test.rb +++ b/test/rspock/ast/test_method_def_transformation_test.rb @@ -30,8 +30,7 @@ def setup expected = s(:send, nil, :test, s(:dstr, - s(:str, "Test Name"), - s(:str, " "), + s(:str, "Test Name "), s(:begin, s(:lvar, :_test_index_)), s(:str, " line "), s(:begin, s(:lvar, :_line_number_)))) @@ -50,8 +49,7 @@ def setup expected = s(:send, nil, :test, s(:dstr, s(:begin, s(:lvar, :a)), - s(:str, "Test Name"), - s(:str, " "), + s(:str, "Test Name "), s(:begin, s(:lvar, :_test_index_)), s(:str, " line "), s(:begin, s(:lvar, :_line_number_)))) diff --git a/test/rspock/ast/test_method_dstr_transformation_test.rb b/test/rspock/ast/test_method_dstr_transformation_test.rb index 4a0c2e1..750bc35 100644 --- a/test/rspock/ast/test_method_dstr_transformation_test.rb +++ b/test/rspock/ast/test_method_dstr_transformation_test.rb @@ -42,8 +42,7 @@ def setup expected = s(:send, nil, :test, s(:dstr, s(:begin, s(:lvar, :a)), - s(:str, "Test Name"), - s(:str, " "), + s(:str, "Test Name "), s(:begin, s(:lvar, :_test_index_)), s(:str, " line "), s(:begin, s(:lvar, :_line_number_)))) diff --git a/test/rspock/ast/transformation_test.rb b/test/rspock/ast/transformation_test.rb index ed968df..8b2498f 100644 --- a/test/rspock/ast/transformation_test.rb +++ b/test/rspock/ast/transformation_test.rb @@ -52,9 +52,9 @@ def setup HEREDOC expected = <<~HEREDOC - test("Adding 1 and 2 results in 3") do - assert_equal(3, 1 + 2) - end + test("Adding 1 and 2 results in 3") { + (assert_equal(3, 1 + 2)) + } HEREDOC assert_equal strip_end_line(expected), transform(source) @@ -187,14 +187,14 @@ def initialize(node) HEREDOC expected = <<~HEREDOC - Potato = Class.new do - begin - extend(RSpock::Declarative) + Potato = Class.new { + (begin + (extend(RSpock::Declarative)) rescue StandardError => e ::RSpock::BacktraceFilter.new.filter_exception(e) raise - end - end + end) + } HEREDOC assert_equal strip_end_line(expected), transform(source) @@ -209,16 +209,16 @@ class Potato expected = <<~HEREDOC class Potato - begin - extend(RSpock::Declarative) + (begin + (extend(RSpock::Declarative)) rescue StandardError => e ::RSpock::BacktraceFilter.new.filter_exception(e) raise - end + end) end HEREDOC - assert_equal strip_end_line(expected), transform(source) + assert_equal expected, transform(source) end test "raises if block is followed by an illegal block when code is inside a Class" do @@ -275,10 +275,10 @@ def initialize(node) HEREDOC expected = <<~HEREDOC - test(\"Adding 1 and 2 results in 3\") do - actual = (1 + 2) + test(\"Adding 1 and 2 results in 3\") { + actual = 1 + 2 assert_equal(3, actual) - end + } HEREDOC assert_equal strip_end_line(expected), transform(source) @@ -301,12 +301,12 @@ def initialize(node) HEREDOC expected = <<~HEREDOC - [[1, 2, 3, 10], [4, 5, 9, 11]].each.with_index do |(a, b, c, _line_number_), _test_index_| - test(\"\#{\"Adding \"}\#{a}\#{\" and \"}\#{b}\#{\" results in \"}\#{c}\#{" "}\#{_test_index_}\#{" line "}\#{_line_number_}\") do - actual = (a + b) + [[1, 2, 3, 10], [4, 5, 9, 11]].each.with_index { |(a, b, c, _line_number_), _test_index_| + test("Adding \#{a} and \#{b} results in \#{c} \#{_test_index_} line \#{_line_number_}") { + actual = a + b assert_equal(c, actual) - end - end + } + } HEREDOC assert_equal strip_end_line(expected), transform(source) @@ -328,15 +328,15 @@ def initialize(node) HEREDOC expected = <<~HEREDOC - test(\"Adding 1 and 2 results in 3\") do + test(\"Adding 1 and 2 results in 3\") { begin - actual = (1 + 2) + actual = 1 + 2 assert_equal(3, actual) ensure method1 method2 end - end + } HEREDOC assert_equal strip_end_line(expected), transform(source) @@ -359,13 +359,13 @@ def initialize(node) HEREDOC expected = <<~HEREDOC - test(\"interactions\") do + test(\"interactions\") { dep = mock foo = Foo.new(dep) dep.expects(:bar).times(0) dep.expects(:foo).times(1) foo.foo - end + } HEREDOC assert_equal strip_end_line(expected), transform(source) diff --git a/test/test_loader.rb b/test/test_loader.rb index a0c94da..62c943d 100644 --- a/test/test_loader.rb +++ b/test/test_loader.rb @@ -1,13 +1,6 @@ # frozen_string_literal: true require 'simplecov' -require 'coveralls' -SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new( - [ - SimpleCov::Formatter::HTMLFormatter, - Coveralls::SimpleCov::Formatter - ] -) SimpleCov.start do add_filter('/test/') end From 4c82443d46942e5b07b86c9d7fe9c6161c884cca Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Sat, 21 Feb 2026 12:14:29 -0500 Subject: [PATCH 2/6] Ruby 3.x upgrade, CI modernization, and version bump to 2.0.0 - Require Ruby >= 3.0, update parser (>= 3.0) and unparser (>= 0.6) - Bump ast_transform dependency to ~> 2.0 - Replace Travis CI with GitHub Actions (ci.yml + release.yml with Trusted Publishing) - Replace Coveralls with SimpleCov + Codecov - Replace pry-byebug with pry (Ruby 3 compatible) - Add test for dstr transformation when last child is not a str node - Fix homepage URL in gemspec - Update README with new badges and release process documentation Co-authored-by: Cursor --- .github/workflows/ci.yml | 29 ++++++++++++++++ .github/workflows/release.yml | 26 ++++++++++++++ .travis.yml | 28 --------------- Gemfile | 2 +- Gemfile.lock | 6 ++-- README.md | 34 +++++++++++++++++-- lib/rspock/version.rb | 2 +- rspock.gemspec | 4 +-- .../test_method_dstr_transformation_test.rb | 20 +++++++++++ test/test_loader.rb | 5 +++ 10 files changed, 118 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a9d794e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ['3.0', '3.1', '3.2', '3.3'] + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: bundle exec rake test + - name: Upload coverage to Codecov + if: matrix.ruby == '3.3' + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage/coverage.json + fail_ci_if_error: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fb5f359 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + tags: ['v*'] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + - name: Verify version matches tag + run: | + TAG_VERSION="${GITHUB_REF#refs/tags/v}" + GEM_VERSION=$(ruby -e "require './lib/rspock/version'; puts RSpock::VERSION") + if [ "$TAG_VERSION" != "$GEM_VERSION" ]; then + echo "::error::Tag ($TAG_VERSION) does not match gem version ($GEM_VERSION)" + exit 1 + fi + - uses: rubygems/release-gem@v1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a6a8a4f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: ruby - -rvm: - - 2.5 - - 2.6 - - 2.7 - -install: ./bin/setup - -jobs: - include: - - stage: deploy - rvm: 2.7 - install: ./bin/setup - script: - - echo Deploy - - echo $TRAVIS_PULL_REQUEST - - echo $TRAVIS_BRANCH - - echo $TRAVIS_TAG - deploy: - provider: rubygems - gemspec: rspock.gemspec - gem: rspock - on: - all_branches: true - condition: '"$TRAVIS_PULL_REQUEST" = "false" && ( "$TRAVIS_BRANCH" = "master" || "$TRAVIS_BRANCH" = "$TRAVIS_TAG" )' - api_key: - secure: rIfUyBSv8ETaJ06vDiVGnhjNG9aiwa+h5ud/8D7/ieJQzpbvZY7N+5R5buHcEIdWIpj/FrkO8H1QuTrB8VDpa+ckDzAXoQKf7EsXtZYGPEwLymfpVCIzix8/8Wbu2lmsLwexAFDZ3YWUZHga1hOc+FuiI2I0TiFsjnzU+mPxdKnpDH1H2ZAUecW0DcEb3zEVtTV4oSgGMYPG2493gjUFnVAEbq1ODPtLKJ2qQw2R0Es20h1QQ0w06LNCcQ9XfoJY/aWTQJHp9uolmhXh97/NTntNvPTXDhv6aCTldtI/A5PuRl03CRtsHd5qLNt23hSCNBGnkZx1uEirTVSfSrha/XOJ4OopMYYa4DkbzSLC/yfpyfdvqW+ewymbOf9EjVqkQVtKb9rul8Gw5QlVQNhu+zpL0zTsC4BLmna4PrtqjeUVkhsOtXpE+rMDFjrjbFS89+VwHLzGipJDA4N5eRv1NB5s4Lkj5CExOBG2MsKlxN0+KYe5Gm255lP+JI9TUgV+26BitStBpZLv1/brLR5Ui9Z5U+4mH6f/DRLgMl8cOkuv9VABn6NEcFW3gbmVs4TaykcQdiozOIat7Zi+H4PcZ2bZcMvY8qCZgcEJDepg9nF4ArnxYlrnYkKdEM7jleryNS6whVM67k6IfrQnDyesvI5gsH4YNAkMtVl1TYPDa7s= diff --git a/Gemfile b/Gemfile index a90c597..d5cec6d 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } -gem "ast_transform", path: "../ast-transform" +gem "ast_transform", git: "https://github.com/rspockframework/ast-transform.git", branch: "main" # Specify your gem's dependencies in rspock.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index fa69adf..e25da79 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,15 +1,15 @@ PATH remote: ../ast-transform specs: - ast_transform (1.0.0) + ast_transform (2.0.0) parser (>= 3.0) unparser (>= 0.6) PATH remote: . specs: - rspock (1.0.0) - ast_transform (~> 1.0) + rspock (2.0.0) + ast_transform (~> 2.0) minitest (~> 5.0) mocha (>= 1.0) parser (>= 3.0) diff --git a/README.md b/README.md index 776e8f1..592824e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Build Status](https://travis-ci.org/rspockframework/rspock.svg?branch=master)](https://travis-ci.org/rspockframework/rspock) -[![Coverage Status](https://coveralls.io/repos/github/rspockframework/rspock/badge.svg?branch=master)](https://coveralls.io/github/rspockframework/rspock?branch=master) +[![CI](https://github.com/rspockframework/rspock/actions/workflows/ci.yml/badge.svg)](https://github.com/rspockframework/rspock/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/rspockframework/rspock/branch/main/graph/badge.svg)](https://codecov.io/gh/rspockframework/rspock) # RSpock @@ -440,7 +440,35 @@ end After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). +To install this gem onto your local machine, run `bundle exec rake install`. + +## Releasing a New Version + +There are two ways to create a release. Both require that `version.rb` has already been updated and merged to main. + +### Via GitHub UI + +1. Update `VERSION` in `lib/rspock/version.rb`, commit, open a PR, and merge to main +2. Go to the repo on GitHub → **Releases** → **Draft a new release** +3. Enter a new tag (e.g. `v2.0.0`), select `main` as the target branch +4. Add a title and release notes (GitHub can auto-generate these from merged PRs) +5. Click **Publish release** + +### Via CLI + +1. Update `VERSION` in `lib/rspock/version.rb`, commit, open a PR, and merge to main +2. Tag and push: + ``` + git checkout main && git pull + git tag v2.0.0 + git push origin v2.0.0 + ``` + +In both cases, the [release workflow](.github/workflows/release.yml) validates that the tag matches `version.rb`, builds the gem, and publishes it to [rubygems.org](https://rubygems.org) via [Trusted Publishing](https://guides.rubygems.org/trusted-publishing/) (no API key needed). If there's a mismatch, the workflow fails before publishing. + +### One-time setup + +Configure the gem as a trusted publisher on rubygems.org so that the release workflow can publish automatically. See the [Trusted Publishing guide](https://guides.rubygems.org/trusted-publishing/pushing-a-new-gem-with-a-trusted-publisher/) for details. ## Contributing diff --git a/lib/rspock/version.rb b/lib/rspock/version.rb index e46522b..7ef42b4 100644 --- a/lib/rspock/version.rb +++ b/lib/rspock/version.rb @@ -1,3 +1,3 @@ module RSpock - VERSION = "1.0.0" + VERSION = "2.0.0" end diff --git a/rspock.gemspec b/rspock.gemspec index 3df0e9c..67cabaf 100644 --- a/rspock.gemspec +++ b/rspock.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.summary = 'Data-driven testing framework.' spec.description = spec.summary - spec.homepage = 'https://github.com/jpduchesne/rspock' + spec.homepage = 'https://github.com/rspockframework/rspock' spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) @@ -30,7 +30,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "simplecov", "~> 0.22" # Runtime dependencies - spec.add_runtime_dependency "ast_transform", "~> 1.0" + spec.add_runtime_dependency "ast_transform", "~> 2.0" spec.add_runtime_dependency "minitest", "~> 5.0" spec.add_runtime_dependency "mocha", ">= 1.0" spec.add_runtime_dependency "parser", ">= 3.0" diff --git a/test/rspock/ast/test_method_dstr_transformation_test.rb b/test/rspock/ast/test_method_dstr_transformation_test.rb index 750bc35..159d4d9 100644 --- a/test/rspock/ast/test_method_dstr_transformation_test.rb +++ b/test/rspock/ast/test_method_dstr_transformation_test.rb @@ -49,6 +49,26 @@ def setup assert_equal expected, actual end + + test "#run appends space when dstr does not end with a str node" do + ast = s(:send, nil, :test, + s(:dstr, + s(:str, "Test "), + s(:begin, s(:lvar, :a)))) + + actual = @transformation.run(ast) + + expected = s(:send, nil, :test, + s(:dstr, + s(:str, "Test "), + s(:begin, s(:lvar, :a)), + s(:str, " "), + s(:begin, s(:lvar, :_test_index_)), + s(:str, " line "), + s(:begin, s(:lvar, :_line_number_)))) + + assert_equal expected, actual + end end end end diff --git a/test/test_loader.rb b/test/test_loader.rb index 62c943d..84cd3b7 100644 --- a/test/test_loader.rb +++ b/test/test_loader.rb @@ -1,8 +1,13 @@ # frozen_string_literal: true require 'simplecov' +require 'simplecov_json_formatter' SimpleCov.start do add_filter('/test/') + formatter SimpleCov::Formatter::MultiFormatter.new([ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::JSONFormatter, + ]) end $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) From f6549176cc125bead5e9bf2affa8b620198c8088 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Sat, 21 Feb 2026 12:23:21 -0500 Subject: [PATCH 3/6] Bump minimum Ruby to 3.2 Ruby 3.0 is EOL, and unparser 0.8.x + Bundler 2.5.x have compatibility issues with Ruby 3.0/3.1's RubyGems. Co-authored-by: Cursor --- .github/workflows/ci.yml | 2 +- rspock.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9d794e..869fdad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['3.0', '3.1', '3.2', '3.3'] + ruby: ['3.2', '3.3'] steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 diff --git a/rspock.gemspec b/rspock.gemspec index 67cabaf..cd7b101 100644 --- a/rspock.gemspec +++ b/rspock.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.required_ruby_version = '>= 3.0' + spec.required_ruby_version = '>= 3.2' # Development dependencies spec.add_development_dependency "bundler", ">= 2.1" From 5f74dbbb7b993c081e0532567ef6d6622edf66c6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Sat, 21 Feb 2026 12:28:45 -0500 Subject: [PATCH 4/6] Trigger CI rebuild Co-authored-by: Cursor From 3e1a84b480a361729d620369a058bab485ae072f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Sat, 21 Feb 2026 12:30:33 -0500 Subject: [PATCH 5/6] Fix Gemfile to use ast-transform master branch and update lockfile Co-authored-by: Cursor --- Gemfile | 2 +- Gemfile.lock | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index d5cec6d..bf8e5c7 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } -gem "ast_transform", git: "https://github.com/rspockframework/ast-transform.git", branch: "main" +gem "ast_transform", git: "https://github.com/rspockframework/ast-transform.git", branch: "master" # Specify your gem's dependencies in rspock.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index e25da79..750031d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,7 @@ -PATH - remote: ../ast-transform +GIT + remote: https://github.com/rspockframework/ast-transform.git + revision: 2f177ecfd775d840c94f8e369cd8f78aeed1520c + branch: master specs: ast_transform (2.0.0) parser (>= 3.0) From 71c83e6197fb8c220470ab115dc51b27d74595fd Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Sat, 21 Feb 2026 12:47:25 -0500 Subject: [PATCH 6/6] Use ast_transform 2.0.0 from rubygems and fix release workflow - Remove git source from Gemfile, use published ast_transform ~> 2.0 - Fix release workflow to use gem build/push instead of rake release Co-authored-by: Cursor --- .github/workflows/release.yml | 6 +++++- Gemfile | 2 -- Gemfile.lock | 13 +++---------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb5f359..fc87619 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,4 +23,8 @@ jobs: echo "::error::Tag ($TAG_VERSION) does not match gem version ($GEM_VERSION)" exit 1 fi - - uses: rubygems/release-gem@v1 + - uses: rubygems/configure-rubygems-credentials@main + - name: Build and publish gem + run: | + gem build rspock.gemspec + gem push rspock-*.gem diff --git a/Gemfile b/Gemfile index bf8e5c7..4a8be62 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,5 @@ source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } -gem "ast_transform", git: "https://github.com/rspockframework/ast-transform.git", branch: "master" - # Specify your gem's dependencies in rspock.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index 750031d..560fdd9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,3 @@ -GIT - remote: https://github.com/rspockframework/ast-transform.git - revision: 2f177ecfd775d840c94f8e369cd8f78aeed1520c - branch: master - specs: - ast_transform (2.0.0) - parser (>= 3.0) - unparser (>= 0.6) - PATH remote: . specs: @@ -22,6 +13,9 @@ GEM specs: ansi (1.5.0) ast (2.4.3) + ast_transform (2.0.0) + parser (>= 3.0) + unparser (>= 0.6) builder (3.3.0) coderay (1.1.3) diff-lcs (1.6.2) @@ -66,7 +60,6 @@ PLATFORMS ruby DEPENDENCIES - ast_transform! bundler (>= 2.1) minitest (~> 5.14) minitest-reporters (~> 1.4)