Sha256: c8ac30ec2559cd065b87bd17d4200572e61abb0f83936eccb7c9eeb0f8d4d433

Contents?: true

Size: 995 Bytes

Versions: 25

Compression:

Stored size: 995 Bytes

Contents

require 'spec_helper'
require 'pact/matchers/type_difference'
require 'support/ruby_version_helpers'

module Pact
  module Matchers
    describe TypeDifference do
      include RubyVersionHelpers

      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 => numeric_type.to_s } }

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

      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
pact-support-1.11.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.10.3 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.10.2 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.10.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.10.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.9.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.8.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.8.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.7.2 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.7.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.7.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.6.6 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.6.5 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.7.0.alpha.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.6.4 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.6.3 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.6.2 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.6.1 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.6.0 spec/lib/pact/matchers/type_difference_spec.rb
pact-support-1.5.2 spec/lib/pact/matchers/type_difference_spec.rb