Sha256: 69b5586f5d5d43cdc4caaf4505c0614c57e54209eeab545fd5571e0c018c734d

Contents?: true

Size: 1.25 KB

Versions: 14

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'
require 'cucumber/rb_support/rb_language'

module Cucumber
  describe 'Pending' do
    before(:each) do
      l = RbSupport::RbLanguage.new(Runtime.new)
      l.begin_rb_scenario(double('scenario').as_null_object)
      @world = l.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

14 entries across 14 versions & 1 rubygems

Version Path
cucumber-2.1.0 spec/cucumber/world/pending_spec.rb
cucumber-2.0.2 spec/cucumber/world/pending_spec.rb
cucumber-2.0.1 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.rc.5 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.rc.4 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.rc.3 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.rc.2 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.rc.1 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.beta.5 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.beta.4 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.beta.3 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.beta.2 spec/cucumber/world/pending_spec.rb
cucumber-2.0.0.beta.1 spec/cucumber/world/pending_spec.rb