Skip to content

Commit

Permalink
refactor(integration tests): use stub instead of mock wording
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturT committed Mar 8, 2024
1 parent 6c7b81c commit d9623b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions spec/integration/runners/queue/rspec_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_file_paths(can_initialize_queue, executed_test_files)
@batch_index += 1

if SHOW_DEBUG_LOG
IntegrationTestLogger.log("Mocked tests from the Queue API: #{tests.inspect}")
IntegrationTestLogger.log("Stubbed tests from the Queue API: #{tests.inspect}")
end

tests
Expand All @@ -41,13 +41,13 @@ def create_build_subset(test_files)
end

return unless SHOW_DEBUG_LOG
IntegrationTestLogger.log("Mocked the #{__method__} method")
IntegrationTestLogger.log("Stubbed the #{__method__} method")
end
end

module RSpecAdapter
def test_file_cases_for(slow_test_files)
IntegrationTestLogger.log("Mocked test file cases for slow test files: #{slow_test_files}")
IntegrationTestLogger.log("Stubbed test file cases for slow test files: #{slow_test_files}")

test_file_paths = JSON.load(ENV.fetch('TEST__TEST_FILE_CASES_FOR_SLOW_TEST_FILES'))
test_file_paths.map do |path|
Expand Down
22 changes: 11 additions & 11 deletions spec/integration/runners/queue/rspec_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def stub_spec_batches(batched_tests)

# @param test_file_paths Array[String]
# Example: ['spec_integration/a_spec.rb[1:1]']
def mock_test_cases_for_slow_test_files(test_file_paths)
def stub_test_cases_for_slow_test_files(test_file_paths)
ENV['TEST__TEST_FILE_CASES_FOR_SLOW_TEST_FILES'] = test_file_paths.to_json
end

Expand Down Expand Up @@ -1640,7 +1640,7 @@ def when_first_matching_example_defined(type:)
before do
ENV['KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES'] = 'true'

# remember to mock Queue API batches to include test examples (example: a_spec.rb[1:1])
# remember to stub Queue API batches to include test examples (example: a_spec.rb[1:1])
# for the following slow test files
ENV['KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN'] = "#{SPEC_DIRECTORY}/a_spec.rb"
end
Expand Down Expand Up @@ -1688,7 +1688,7 @@ def when_first_matching_example_defined(type:)
generate_specs(spec_helper_with_knapsack, rspec_options, [
[spec_a, spec_b, spec_c]
])
mock_test_cases_for_slow_test_files([
stub_test_cases_for_slow_test_files([
"#{spec_a.path}[1:1]",
"#{spec_a.path}[1:2]",
])
Expand Down Expand Up @@ -1736,7 +1736,7 @@ def when_first_matching_example_defined(type:)
before do
ENV['KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES'] = 'true'

# remember to mock Queue API batches to include test examples (example: a_spec.rb[1:1])
# remember to stub Queue API batches to include test examples (example: a_spec.rb[1:1])
# for the following slow test files
ENV['KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN'] = "#{SPEC_DIRECTORY}/a_spec.rb"
end
Expand Down Expand Up @@ -1784,7 +1784,7 @@ def when_first_matching_example_defined(type:)
generate_specs(spec_helper_with_knapsack, rspec_options, [
[spec_a, spec_b, spec_c]
])
mock_test_cases_for_slow_test_files([
stub_test_cases_for_slow_test_files([
"#{spec_a.path}[1:1]",
"#{spec_a.path}[1:2]",
])
Expand Down Expand Up @@ -1814,7 +1814,7 @@ def when_first_matching_example_defined(type:)
before do
ENV['KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES'] = 'true'

# remember to mock Queue API batches to include test examples (example: a_spec.rb[1:1])
# remember to stub Queue API batches to include test examples (example: a_spec.rb[1:1])
# for the following slow test files
ENV['KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN'] = "#{SPEC_DIRECTORY}/a_spec.rb"
end
Expand Down Expand Up @@ -1862,7 +1862,7 @@ def when_first_matching_example_defined(type:)
generate_specs(spec_helper_with_knapsack, rspec_options, [
[spec_a, spec_b, spec_c]
])
mock_test_cases_for_slow_test_files([
stub_test_cases_for_slow_test_files([
"#{spec_a.path}[1:1]",
"#{spec_a.path}[1:2]",
])
Expand Down Expand Up @@ -1913,7 +1913,7 @@ def when_first_matching_example_defined(type:)
before do
ENV['KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES'] = 'true'

# remember to mock Queue API batches to include test examples (example: a_spec.rb[1:1])
# remember to stub Queue API batches to include test examples (example: a_spec.rb[1:1])
# for the following slow test files
ENV['KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN'] = "#{SPEC_DIRECTORY}/a_spec.rb"
end
Expand Down Expand Up @@ -1961,7 +1961,7 @@ def when_first_matching_example_defined(type:)
generate_specs(spec_helper_with_knapsack, rspec_options, [
[spec_a, spec_b, spec_c]
])
mock_test_cases_for_slow_test_files([
stub_test_cases_for_slow_test_files([
"#{spec_a.path}[1:1]",
"#{spec_a.path}[1:2]",
])
Expand Down Expand Up @@ -2010,7 +2010,7 @@ def when_first_matching_example_defined(type:)
before do
ENV['KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES'] = 'true'

# remember to mock Queue API batches to include test examples (example: a_spec.rb[1:1])
# remember to stub Queue API batches to include test examples (example: a_spec.rb[1:1])
# for the following slow test files
ENV['KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN'] = "#{SPEC_DIRECTORY}/a_spec.rb"
end
Expand Down Expand Up @@ -2068,7 +2068,7 @@ def when_first_matching_example_defined(type:)
generate_specs(spec_helper, rspec_options, [
[spec_a, spec_b, spec_c]
])
mock_test_cases_for_slow_test_files([
stub_test_cases_for_slow_test_files([
"#{spec_a.path}[1:1]",
"#{spec_a.path}[1:2]",
])
Expand Down

0 comments on commit d9623b3

Please sign in to comment.