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.

support_code_spec.rb 1.7 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # frozen_string_literal: true
  2. require 'spec_helper'
  3. module Cucumber
  4. describe Runtime::SupportCode do
  5. let(:user_interface) { double('user interface') }
  6. subject { Runtime::SupportCode.new(user_interface, configuration) }
  7. let(:configuration) { Configuration.new(options) }
  8. let(:options) { {} }
  9. let(:dsl) do
  10. @rb = subject.ruby
  11. Object.new.extend(RbSupport::RbDsl)
  12. end
  13. describe '#apply_before_hooks' do
  14. let(:test_case) { double }
  15. let(:test_step) { double }
  16. it 'applies before hooks to test cases with steps' do
  17. allow(test_case).to receive(:test_steps).and_return([test_step])
  18. allow(test_case).to receive(:with_steps).and_return(double)
  19. expect(subject.apply_before_hooks(test_case)).not_to equal(test_case)
  20. end
  21. it 'does not apply before hooks to test cases with no steps' do
  22. allow(test_case).to receive(:test_steps).and_return([])
  23. expect(subject.apply_before_hooks(test_case)).to equal(test_case)
  24. end
  25. end
  26. describe '#apply_after_hooks' do
  27. let(:test_case) { double }
  28. let(:test_step) { double }
  29. it 'applies after hooks to test cases with steps' do
  30. allow(test_case).to receive(:test_steps).and_return([test_step])
  31. allow(test_case).to receive(:with_steps).and_return(double)
  32. expect(subject.apply_after_hooks(test_case)).not_to equal(test_case)
  33. end
  34. it 'does not apply after hooks to test cases with no steps' do
  35. allow(test_case).to receive(:test_steps).and_return([])
  36. expect(subject.apply_after_hooks(test_case)).to equal(test_case)
  37. end
  38. end
  39. end
  40. end

No Description

Contributors (1)