Sha256: d77d14ef41b7de9f733c2fe8908d9fcb02299a75d966d5bb0f8fd3d60e7e7928
Contents?: true
Size: 1.41 KB
Versions: 2
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 Provider::PactSpecRunner.should_receive(:run).with(consumer_contract).and_return(0) Rake::Task[@task_name].execute end context 'when all specs pass' do before do Provider::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 Provider::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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pact-1.0.1 | spec/lib/pact/verification_task_spec.rb |
pact-1.0.0 | spec/lib/pact/verification_task_spec.rb |