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.

pending_spec.rb 1.3 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # frozen_string_literal: true
  2. require 'spec_helper'
  3. require 'cucumber/glue/registry_and_more'
  4. require 'cucumber/configuration'
  5. module Cucumber
  6. describe 'Pending' do
  7. before(:each) do
  8. registry = Glue::RegistryAndMore.new(Runtime.new, Configuration.new)
  9. registry.begin_scenario(double('scenario').as_null_object)
  10. @world = registry.current_world
  11. end
  12. it 'raises a Pending if no block is supplied' do
  13. expect { @world.pending 'TODO' }.to raise_error(Cucumber::Pending, /TODO/)
  14. end
  15. it 'raises a Pending if a supplied block fails as expected' do
  16. expect do
  17. @world.pending 'TODO' do
  18. raise 'oops'
  19. end
  20. end.to raise_error(Cucumber::Pending, /TODO/)
  21. end
  22. it 'raises a Pending if a supplied block fails as expected with a double' do
  23. expect do
  24. @world.pending 'TODO' do
  25. m = double('thing')
  26. expect(m).to receive(:foo)
  27. RSpec::Mocks.verify
  28. end
  29. end.to raise_error(Cucumber::Pending, /TODO/)
  30. # The teardown is needed so that the message expectation does not bubble up.
  31. RSpec::Mocks.teardown
  32. end
  33. it 'raises a Pending if a supplied block starts working' do
  34. expect { @world.pending 'TODO' }.to raise_error(Cucumber::Pending, /TODO/)
  35. end
  36. end
  37. end

No Description

Contributors (1)