Sha256: 022beb5f23694542f985fcde95fb874e55bdaf2133bb53cc613a6ea7b8374251

Contents?: true

Size: 925 Bytes

Versions: 43

Compression:

Stored size: 925 Bytes

Contents

require 'spec_helper'

module Pact
  describe Reification do

    let(:response_spec) do
      {
        woot: /x/,
        britney: 'britney',
        nested: { foo: /bar/, baz: 'qux' },
        my_term: Term.new(generate: 'wiffle', matcher: /^wif/),
        array: ['first', /second/]
      }
    end

    describe "from term" do

      subject { Reification.from_term(response_spec) }

      it "converts regexes into real data" do
        expect(subject[:woot]).to eql 'x'
      end

      it "converts terms into real data" do
        expect(subject[:my_term]).to eql 'wiffle'
      end

      it "passes strings through" do
        expect(subject[:britney]).to eql 'britney'
      end

      it "handles nested hashes" do
        expect(subject[:nested]).to eql({ foo: 'bar', baz: 'qux' })
      end

      it "handles arrays" do
        expect(subject[:array]).to eql ['first', 'second']
      end

    end

  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
pact-0.1.37 spec/lib/pact/reification_spec.rb
pact-0.1.35 spec/lib/pact/reification_spec.rb
pact-0.1.28 spec/lib/pact/reification_spec.rb