Sha256: 225f3710e4c5dd6420ac43f080fb63ff67e7b540137f9c01cf00365cf33ac925

Contents?: true

Size: 873 Bytes

Versions: 2

Compression:

Stored size: 873 Bytes

Contents

# frozen_string_literal: true
require 'cucumber/hooks'
module Cucumber::Hooks
  shared_examples_for 'a source node' do
    it 'responds to text' do
      expect( subject.text ).to be_a(String)
    end

    it 'responds to location' do
      expect( subject.location ).to eq(location)
    end

    it 'responds to match_locations?' do
      expect( subject.match_locations? [location] ).to be_truthy
      expect( subject.match_locations? [] ).to be_falsey
    end
  end

  require 'cucumber/core/ast/location'
  describe BeforeHook do
    subject { BeforeHook.new(location) }
    let(:location) { Cucumber::Core::Ast::Location.new('hooks.rb', 1) }
    it_behaves_like 'a source node'
  end

  describe AfterHook do
    subject { AfterHook.new(location) }
    let(:location) { Cucumber::Core::Ast::Location.new('hooks.rb', 1) }
    it_behaves_like 'a source node'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-3.0.1 spec/cucumber/hooks_spec.rb
cucumber-3.0.0 spec/cucumber/hooks_spec.rb