Skip to content

Commit

Permalink
Merge pull request #61 from KnapsackPro/update-hooks-examples
Browse files Browse the repository at this point in the history
Add all queue hooks examples for RSpec, Cucumber, Minitest
  • Loading branch information
ArturT authored May 16, 2024
2 parents 0386016 + 933a72e commit 231e78a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
12 changes: 9 additions & 3 deletions features/support/knapsack_pro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
# CUSTOM_CONFIG_GOES_HERE
KnapsackPro::Hooks::Queue.before_queue do |queue_id|
print '-'*10
print 'Before Queue Hook - run before test suite'
print 'Before Queue Hook - run before the test suite'
print '-'*10
end

KnapsackPro::Hooks::Queue.before_subset_queue do |queue_id, subset_queue_id|
print '-'*10
print 'Before Subset Queue Hook - run before the next subset of tests'
print '-'*10
end

KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
print '-'*10
print 'After Subset Queue Hook - run after subset of test suite'
print 'After Subset Queue Hook - run after the previous subset of tests'
print '-'*10
end

KnapsackPro::Hooks::Queue.after_queue do |queue_id|
print '-'*10
print 'After Queue Hook - run after test suite'
print 'After Queue Hook - run after the test suite'
print '-'*10
end

Expand Down
12 changes: 4 additions & 8 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
# CUSTOM_CONFIG_GOES_HERE
KnapsackPro::Hooks::Queue.before_queue do |queue_id|
print '-'*10
print 'Before Queue Hook - run before test suite'
print 'Before Queue Hook - run before the test suite'
print '-'*10
puts

SimpleCov.command_name("rspec_ci_node_#{KnapsackPro::Config::Env.ci_node_index}")
end
Expand All @@ -46,29 +45,26 @@

KnapsackPro::Hooks::Queue.before_subset_queue do |queue_id, subset_queue_id|
print '-'*10
print 'Before Subset Queue Hook - run before the subset of the test suite'
print 'Before Subset Queue Hook - run before the next subset of tests'
print '-'*10
puts
end
KnapsackPro::Hooks::Queue.before_subset_queue do |queue_id, subset_queue_id|
puts '2nd KnapsackPro::Hooks::Queue.before_subset_queue'
end

KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
print '-'*10
print 'After Subset Queue Hook - run after the subset of the test suite'
print 'After Subset Queue Hook - run after the previous subset of tests'
print '-'*10
puts
end
KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
puts '2nd KnapsackPro::Hooks::Queue.after_subset_queue'
end

KnapsackPro::Hooks::Queue.after_queue do |queue_id|
print '-'*10
print 'After Queue Hook - run after test suite'
print 'After Queue Hook - run after the test suite'
print '-'*10
puts
end
KnapsackPro::Hooks::Queue.after_queue do |queue_id|
puts '2nd KnapsackPro::Hooks::Queue.after_queue'
Expand Down
12 changes: 9 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,25 @@
# CUSTOM_CONFIG_GOES_HERE
KnapsackPro::Hooks::Queue.before_queue do |queue_id|
print '-'*10
print 'Before Queue Hook - run before test suite'
print 'Before Queue Hook - run before the test suite'
print '-'*10
end

KnapsackPro::Hooks::Queue.before_subset_queue do |queue_id, subset_queue_id|
print '-'*10
print 'Before Subset Queue Hook - run before the next subset of tests'
print '-'*10
end

KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
print '-'*10
print 'After Subset Queue Hook - run after subset of test suite'
print 'After Subset Queue Hook - run after the previous subset of tests'
print '-'*10
end

KnapsackPro::Hooks::Queue.after_queue do |queue_id|
print '-'*10
print 'After Queue Hook - run after test suite'
print 'After Queue Hook - run after the test suite'
print '-'*10
end

Expand Down

0 comments on commit 231e78a

Please sign in to comment.