Sha256: fc771965e79a599e5ddbd86ac4b7577907007a8803597ded554397587d1741de

Contents?: true

Size: 791 Bytes

Versions: 3

Compression:

Stored size: 791 Bytes

Contents

require 'spec_helper'
require 'pact/shared/form_differ'
require 'pact/matchers/difference'
require 'pact/matchers/unix_diff_formatter'

module Pact
  describe FormDiffer do

    describe ".call" do

      let(:expected) { "param1=foo&param2=bar&param2=foobar" }
      let(:actual)   { "param1=wiffle&param2=foobar&param2=bar" }

      let(:difference) do
        {
          "param1" => [Pact::Matchers::Difference.new("foo", "wiffle")],
          "param2" => [Pact::Matchers::Difference.new("bar", "foobar"), Pact::Matchers::Difference.new("foobar", "bar")]
        }
      end

      subject { FormDiffer.call(expected, actual) }

      context "when there is a diff" do
        it "returns the diff" do
          expect(subject).to eq difference
        end
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pact-support-0.1.1 spec/lib/pact/shared/form_differ_spec.rb
pact-support-0.1.0 spec/lib/pact/shared/form_differ_spec.rb
pact-support-0.0.4 spec/lib/pact/shared/form_differ_spec.rb