You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

hooks_examples.rb 1.0 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334
  1. require 'spec_helper'
  2. require 'cucumber/messages/id_generator'
  3. RSpec.shared_examples 'events are fired when applying hooks' do
  4. let(:id_generator) { Cucumber::Messages::IdGenerator::Incrementing.new }
  5. let(:scenario) { double }
  6. let(:event_bus) { double }
  7. let(:hooks) { [hook] }
  8. let(:hook) { double }
  9. let(:test_case) { double }
  10. before do
  11. allow(test_case).to receive(:with_steps)
  12. allow(test_case).to receive(:test_steps).and_return([])
  13. allow(hook).to receive(:location)
  14. allow(event_bus).to receive(:hook_test_step_created)
  15. end
  16. it 'fires a :hook_test_step_created event for each created step' do
  17. subject.apply_to(test_case)
  18. expect(event_bus).to have_received(:hook_test_step_created)
  19. end
  20. context 'when multiple hooks are applied' do
  21. let(:hooks) { [hook, hook, hook] }
  22. it 'fires a :hook_test_step_created event for each step' do
  23. subject.apply_to(test_case)
  24. expect(event_bus).to have_received(:hook_test_step_created).exactly(3).times
  25. end
  26. end
  27. end

No Description

Contributors (1)