Skip to content

Commit

Permalink
Test with Ruby 3
Browse files Browse the repository at this point in the history
- Add `.ruby-version` file (which is also used by `ruby/setup-ruby`)
- Add `.rubocop.yml` symlink so that `brew style` and `rubocop` (e.g.
  run by VSCode) are consistent
- Don't `bundle install` with an ancient Bundler
- Fix `bundle_utils_spec` without changing behaviour
  • Loading branch information
MikeMcQuaid committed Jan 9, 2024
1 parent aeb6ac0 commit e2562fb
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true

- name: Run RSpec tests
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.4
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,3 @@ DEPENDENCIES
rspec
simplecov
simplecov-cobertura

BUNDLED WITH
1.17.3
8 changes: 2 additions & 6 deletions spec/bundle_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@
end

context "when the system call fails" do
before do
allow_any_instance_of(Process::Status).to receive(:success?).and_return(false)
end

it "emits all stdout output even if verbose is false" do
expect { described_class.system "echo", "foo", verbose: false }.to output("foo\n").to_stdout_from_any_process
expect { described_class.system "/bin/bash", "-c", "echo foo && false", verbose: false }.to output("foo\n").to_stdout_from_any_process

Check failure on line 18 in spec/bundle_utils_spec.rb

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest)

Layout/LineLength: Line is too long. [140/118]

Check failure on line 18 in spec/bundle_utils_spec.rb

View workflow job for this annotation

GitHub Actions / tests (macOS-latest)

Layout/LineLength: Line is too long. [140/118]
end

it "emits all stdout output only once if verbose is true" do
expect { described_class.system "echo", "foo", verbose: true }.to output("foo\n").to_stdout_from_any_process
expect { described_class.system "/bin/bash", "-c", "echo foo && true", verbose: true }.to output("foo\n").to_stdout_from_any_process

Check failure on line 22 in spec/bundle_utils_spec.rb

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest)

Layout/LineLength: Line is too long. [138/118]

Check failure on line 22 in spec/bundle_utils_spec.rb

View workflow job for this annotation

GitHub Actions / tests (macOS-latest)

Layout/LineLength: Line is too long. [138/118]
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 @@ -70,7 +70,7 @@ def linux?
RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = nil

config.around do |example|
Bundler.with_clean_env { example.run }
Bundler.with_original_env { example.run }
end

config.before(:each, :needs_linux) do
Expand Down

0 comments on commit e2562fb

Please sign in to comment.