Skip to content

Commit

Permalink
Review updates
Browse files Browse the repository at this point in the history
Co-Authored-By: Artur Trzop <arturtrzop@gmail.com>
  • Loading branch information
Pacyfik and ArturT committed Mar 11, 2024
1 parent 8da0732 commit 80e389d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### 7.0.1

* fix(RSpec): conditionally adds `--require rails_helper` to cli arguments of `KnapsackPro::Runners::Queue::RSpecRunner`. Version 7.0.0 introduced some fundamental changes, namely fetching, loading and running batches of specs **after** executing suite hooks, so that such hooks are only ran once, not before every batch. This results in a situation where if `rails_helper` is only required in spec files, which is the RSpec default, instead of e.g. in `.rspec`, then some `before(:suite)` hooks, e.g. defined by gems, are registered after suite hooks had already been executed by the test suite. To compare, RSpec loads all the spec files **before** executing `before(:suite)` hooks.
* fix(RSpec): conditionally adds `--require rails_helper` to cli arguments of `KnapsackPro::Runners::Queue::RSpecRunner`. Version 7.0.0 introduced some fundamental changes, namely fetching, loading and running batches of specs **after** executing suite hooks, so that such hooks are only ran once, not before every batch. As a result, if `rails_helper` is only required in spec files, which is the RSpec default, instead of e.g. in `.rspec`, then some `before(:suite)` hooks, e.g. defined by gems, are registered after suite hooks had already been executed by the test suite. By comparison, RSpec loads all the spec files **before** executing `before(:suite)` hooks.

PR with the above changes: https://github.com/KnapsackPro/knapsack_pro-ruby/pull/243

Expand Down
5 changes: 3 additions & 2 deletions spec/integration/runners/queue/rspec_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def log_command_result(stdout, stderr, status)

actual = subject

expect(actual.stdout.scan(/--require rails_helper/).size).to eq 0
expect(actual.stdout).to_not include('--require rails_helper')

expect(actual.exit_code).to eq 0
end
Expand Down Expand Up @@ -431,7 +431,7 @@ def log_command_result(stdout, stderr, status)

actual = subject

expect(actual.stdout.scan(/--require rails_helper/).size).to eq 3
expect(actual.stdout).to include('--require rails_helper')
expect(actual.stdout.scan(/RSpec_before_suite_hook_from_rails_helper/).size).to eq 1
expect(actual.stdout.scan(/RSpec_after_suite_hook_from_rails_helper/).size).to eq 1

Expand Down Expand Up @@ -465,6 +465,7 @@ def log_command_result(stdout, stderr, status)
SPEC

spec_c = Spec.new('c_spec.rb', <<~SPEC)
require 'rails_helper'
describe 'C_describe' do
it 'C1 test example' do
expect(1).to eq 1
Expand Down

0 comments on commit 80e389d

Please sign in to comment.