Sha256: c7419cb118d22414d577751f24bf3a3ed7e066713ad048f6d5e2f58e160a31a3

Contents?: true

Size: 1.03 KB

Versions: 59

Compression:

Stored size: 1.03 KB

Contents

require 'pact/array_like'

module Pact
  describe ArrayLike do

    describe "#eq" do
      subject { ArrayLike.new({name: 'Fred'}, {min: 3}) }
      context "when the contents and min are the same" do
        let(:other) { ArrayLike.new({name: 'Fred'}, {min: 3}) }
        it "returns true" do
          expect(subject).to eq other
        end

      end
      context "when the contents are different" do
        let(:other) { ArrayLike.new({name: 'John'}, {min: 3}) }
        it "returns false" do
          expect(subject).to_not eq other
        end
      end
      context "when the min is different" do
        let(:other) { ArrayLike.new({name: 'Fred'}, {min: 1}) }
        it "returns false" do
          expect(subject).to_not eq other
        end
      end
    end

    subject { ArrayLike.new({name: Pact::Term.new(generate: 'Fred', matcher: /F/)}, {min: 2}) }

    describe "#generate" do
      it "creates an array with the reified example" do
        expect(subject.generate).to eq [{name: 'Fred'},{name: 'Fred'}]
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

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