Sha256: 1450f9c365c8176e9645b6a5c2393b969ac90577c2c5cdb8eedf13dfe22e1abf

Contents?: true

Size: 914 Bytes

Versions: 59

Compression:

Stored size: 914 Bytes

Contents

require 'spec_helper'
require 'pact/matchers/type_difference'

module Pact
  module Matchers
    describe TypeDifference do

      describe "#as_json" do

        let(:expected) { ExpectedType.new("Fred") }
        let(:actual) { ActualType.new(1) }
        subject { TypeDifference.new expected, actual }

        context "when the actual is a KeyNotFound" do
          let(:actual) { KeyNotFound.new }
          let(:expected_hash) { {:EXPECTED_TYPE => "String", :ACTUAL => actual.to_s } }

          it "use the key ACTUAL" do
            expect(subject.as_json).to eq(expected_hash)
          end
        end

        context "when the actual is an ActualType" do
          let(:expected_hash) { {:EXPECTED_TYPE => "String", :ACTUAL_TYPE => "Fixnum" } }

          it "uses the key ACTUAL_TYPE" do
             expect(subject.as_json).to eq(expected_hash)
          end
        end

      end
    end
  end
end

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
pact-support-1.2.99.alpha.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.3.0.alpha.2 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.3.0.alpha.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.2.5 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.2.4 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.2.3 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.2.2 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.2.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.2.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.8 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.7 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.6 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.5 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.4 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.3 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.2 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.1.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.0.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.0.0 spec/lib/pact/matchers/type_difference_spec.rb