Sha256: 1c163e62203af9e3b809c230fe4038044e6d7e3c5fee7efd9945c8fa5156d196
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require 'spec_helper' require 'pact/provider/provider_state_proxy' module Pact module Provider describe ProviderStateProxy do let(:provider_state_proxy) { ProviderStateProxy.new } describe "get" do let(:name) { "some state" } let(:options) { { :for => 'some consumer'} } let(:provider_state) { double("provider_state")} subject { provider_state_proxy.get name, options } before do ProviderState.stub(:get).and_return(provider_state) end context "when the provider state exists" do it "retrieves the provider state from ProviderState" do ProviderState.should_receive(:get).with(name, options).and_return(provider_state) subject end it "returns the state" do expect(subject).to eq provider_state end end context "when the state does not exist" do let(:provider_state) { nil } let(:expected_missing_provider_states) { {"some consumer" => ["some state"]} } it "raises an error" do expect { subject }.to raise_error /Could not find.*some state.*consumer.*/ end it "records the provider state as missing" do subject rescue nil expect(provider_state_proxy.missing_provider_states).to eq expected_missing_provider_states end context "when the same missing provider state is requested" do it "ensures the list only contains unique entries" do subject rescue nil subject rescue nil expect(provider_state_proxy.missing_provider_states['some consumer'].size).to eq 1 end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pact-1.0.27 | spec/lib/pact/provider/provider_state_proxy_spec.rb |