Sha256: 7c487a47992132663728c0cace97587214a338ba3d15636091ad492ce5c97e91
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
require 'spec_helper' require 'pact/verification_task' module Pact describe VerificationTask do before :all do @support_file = 'some_file.rb' @pact_uri = 'http://example.org/pact.json' @task_name = 'pact:verify:pact_rake_spec' @consumer = 'some-consumer' VerificationTask.new(:pact_rake_spec) do | pact | pact.uri @pact_uri, support_file: @support_file, consumer: @consumer end end describe '.initialize' do it 'creates the tasks' do Rake::Task.tasks.should include_task @task_name end end describe 'execute' do let(:consumer_contract) { [ uri: @pact_uri, support_file: @support_file, consumer: @consumer] } it 'verifies the pacts using PactSpecRunner' do Producer::PactSpecRunner.should_receive(:run).with(consumer_contract).and_return(0) Rake::Task[@task_name].execute end context 'when all specs pass' do before do Producer::PactSpecRunner.stub(:run).and_return(0) end it 'does not raise an exception' do Rake::Task[@task_name].execute end end context 'when one or more specs fail' do before do Producer::PactSpecRunner.stub(:run).and_return(1) end it 'raises an exception' do expect { Rake::Task[@task_name].execute }.to raise_error RuntimeError end end end end end RSpec::Matchers.define :include_task do |expected| match do |actual| actual.any? { |task| task.name == expected } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pact-0.1.37 | spec/lib/pact/verification_task_spec.rb |
pact-0.1.35 | spec/lib/pact/verification_task_spec.rb |
pact-0.1.28 | spec/lib/pact/verification_task_spec.rb |