From 511b2b89cc71ae788130155cfd4ce801e3e15f9e Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 19 Aug 2024 13:04:05 +0100 Subject: [PATCH 1/3] snip --- .github/workflows/ci.yml | 59 ---------------------------------------- 1 file changed, 59 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8fd5baa..a6ae946f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,33 +42,13 @@ jobs: matrix: ruby: - '3.3' - - '3.2' - - '3.1' - - '3.0' - - 2.7 - - 2.6 - - 2.5 - - 2.4 - - 2.3 - - 2.2 env: - DIFF_LCS_VERSION: "> 1.4.3" include: - - ruby: ruby-head - env: - RUBY_HEAD: true - ruby: jruby-9.2.13.0 env: JRUBY_OPTS: "--dev" - - ruby: 2.7 - name_extra: "with diff-lcs 1.3" - env: - DIFF_LCS_VERSION: "~> 1.3.0" - - ruby: 2.7 - name_extra: "with diff-lcs 1.4.3" - env: - DIFF_LCS_VERSION: "1.4.3" fail-fast: false continue-on-error: ${{ matrix.allow_failure || endsWith(matrix.ruby, 'head') }} env: ${{ matrix.env }} @@ -101,22 +81,6 @@ jobs: fail-fast: false matrix: container: - - version: "2.1.9" - tag: ghcr.io/rspec/docker-ci:2.1.9 - post: git config --global --add safe.directory `pwd` - - version: "2.0" - tag: ghcr.io/rspec/docker-ci:2.0.0 - - version: "1.9.3" - tag: ghcr.io/rspec/docker-ci:1.9.3 - - version: "1.9.2" - tag: ghcr.io/rspec/docker-ci:1.9.2 - options: "--add-host rubygems.org:151.101.129.227 --add-host api.rubygems.org:151.101.129.227" - - version: "1.8.7" - tag: ghcr.io/rspec/docker-ci:1.8.7 - options: "--add-host rubygems.org:151.101.129.227 --add-host api.rubygems.org:151.101.129.227" - - version: "REE" - tag: ghcr.io/rspec/docker-ci:ree - options: "--add-host rubygems.org:151.101.129.227 --add-host api.rubygems.org:151.101.129.227" - version: "JRuby 1.7" tag: ghcr.io/rspec/docker-ci:jruby-1.7 - version: "JRuby 1.7 1.8 mode" @@ -139,26 +103,3 @@ jobs: - run: ${{ matrix.container.post }} - run: bundle exec bin/rspec - run: bundle exec script/cucumber.sh - - windows: - name: Ruby ${{ matrix.ruby }} (Windows) - runs-on: windows-latest - strategy: - matrix: - ruby: - - 2.7 - - 2.6 - - 2.5 - - 2.4 - - 2.3 - - 2.2 - fail-fast: false - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - bundler: '2.2.22' - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - run: choco install ansicon - - run: bundle exec rspec --backtrace From 08d2bcd8330a1fd8ed61b7c887ae837f8a3ab51a Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Fri, 6 Sep 2024 12:24:43 +0100 Subject: [PATCH 2/3] more snip --- .github/workflows/ci.yml | 3 +-- script/run_build | 20 +------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6ae946f..a5e74c34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,5 +101,4 @@ jobs: - run: ${{ matrix.container.pre }} - run: script/legacy_setup.sh - run: ${{ matrix.container.post }} - - run: bundle exec bin/rspec - - run: bundle exec script/cucumber.sh + - run: bundle exec bin/rspec spec/rspec/support/spec/stderr_splitter_spec.rb:103 diff --git a/script/run_build b/script/run_build index b883945f..859c9c94 100755 --- a/script/run_build +++ b/script/run_build @@ -12,22 +12,4 @@ fi fold "binstub check" check_binstubs -fold "specs" run_specs_and_record_done - -if additional_specs_available; then - fold "additional specs" run_additional_specs -fi - -fold "cukes" run_cukes - -if documentation_enforced; then - fold "doc check" check_documentation_coverage -fi - -if supports_cross_build_checks; then - fold "one-by-one specs" run_specs_one_by_one - export NO_COVERAGE=true - run_all_spec_suites -else - echo "Skipping the rest of the build on non-MRI rubies" -fi +bundle exec rspec spec/rspec/support/spec/stderr_splitter_spec.rb:103 From cedf81e832e8390894455e1d85f205a2fd46510b Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 19 Aug 2024 13:04:43 +0100 Subject: [PATCH 3/3] WIP fix for Jruby spec --- .../support/spec/stderr_splitter_spec.rb | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/spec/rspec/support/spec/stderr_splitter_spec.rb b/spec/rspec/support/spec/stderr_splitter_spec.rb index e470f3ff..f05603f0 100644 --- a/spec/rspec/support/spec/stderr_splitter_spec.rb +++ b/spec/rspec/support/spec/stderr_splitter_spec.rb @@ -101,26 +101,34 @@ # This spec replicates what matchers do when capturing stderr, e.g `to_stderr_from_any_process` it 'is able to restore the stream from a cloned StdErrSplitter' do - if RSpec::Support::Ruby.jruby? - skip """ - This spec is currently unsupported on JRuby on CI due to tempfiles not being - a file, this situtation was discussed here https://github.com/rspec/rspec-support/pull/598#issuecomment-2200779633 - """ - end - cloned = splitter.clone - expect(splitter.to_io).not_to be_a(File) + expect(splitter.to_io).to be_stderr tempfile = Tempfile.new("foo") begin splitter.reopen(tempfile) - expect(splitter.to_io).to be_a(File) + expect(splitter.to_io).to_not be_stderr ensure splitter.reopen(cloned) tempfile.close tempfile.unlink end # This is the important part of the test that would fail without proper cloning hygeine - expect(splitter.to_io).not_to be_a(File) + expect(splitter.to_io).to be_stderr + end + + # Detecting STDERR in a way that doesn't use a reference + if STDERR.respond_to?(:path) + def be_stderr + have_attributes({:path => ''}) + end + elsif STDERR.inspect =~ /STDERR/ + def be_stderr + have_attributes({:inspect => "#>"}) + end + else + def be_stderr + raise skip "JRuby < 9.0.0.0 doesn't have a predictable identifier for stdout" + end end end