Sha256: 23d9081631acc0ee6723dd8827cbe8b7e7395b5e3d8b0346f219264b3d9959da
Contents?: true
Size: 1.25 KB
Versions: 9
Compression:
Stored size: 1.25 KB
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 context "when reifying a Request" do let(:request){ Pact::Request::Expected.from_hash(method: 'get', path: '/', body: Pact::Term.new(generate: "sunny", matcher: /sun/))} subject { Reification.from_term(request) } it "turns it into a hash before reifying it" do expect(subject[:body]).to eq("sunny") end end end end
Version data entries
9 entries across 9 versions & 1 rubygems