Sha256: 4990a1e13679ffdb3a86c2cba5d2f85d5ca07561c3fdcefdfa755ea7803933aa

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true
require 'spec_helper'
require 'cucumber/glue/registry_and_more'
require 'cucumber/configuration'

module Cucumber
  describe 'Pending' do
    before(:each) do
      registry = Glue::RegistryAndMore.new(Runtime.new, Configuration.new)
      registry.begin_scenario(double('scenario').as_null_object)
      @world = registry.current_world
    end

    it 'raises a Pending if no block is supplied' do
      expect(-> {
        @world.pending 'TODO'
      }).to raise_error(Cucumber::Pending, /TODO/)
    end

    it 'raises a Pending if a supplied block fails as expected' do
      expect(-> {
        @world.pending 'TODO' do
        raise 'oops'
        end
      }).to raise_error(Cucumber::Pending, /TODO/)
    end

    it 'raises a Pending if a supplied block fails as expected with a double' do
      expect do
        @world.pending 'TODO' do
          m = double('thing')
          expect(m).to receive(:foo)
          RSpec::Mocks.verify
        end
      end.to raise_error(Cucumber::Pending, /TODO/)
      # The teardown is needed so that the message expectation does not bubble up.
      RSpec::Mocks.teardown
    end

    it 'raises a Pending if a supplied block starts working' do
      expect(-> {
        @world.pending 'TODO' do
          # success!
        end
      }).to raise_error(Cucumber::Pending, /TODO/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-3.0.1 spec/cucumber/world/pending_spec.rb
cucumber-3.0.0 spec/cucumber/world/pending_spec.rb