Sha256: e9d2add55207fdbfa246dfe56d6f5c05bfa74067cb065ae9669cc25520beca24

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 Bytes

Contents

require 'spec_helper'

describe APIMatchers::ResponseBody::HaveNode do
  describe "in json" do
    before do
      APIMatchers.setup { |config| config.have_node_matcher = :json }
    end

    it "should parse the matcher for json" do
      expect({ :product => 'chat' }.to_json).to have_node(:product).with('chat')
    end
  end

  describe "in xml" do
    before do
      APIMatchers.setup { |config| config.have_node_matcher = :xml }
    end

    it "should parse the matcher for xml" do
      expect("<product>chat</product>").to have_node(:product).with('chat')
    end

    after do
      APIMatchers.setup { |config| config.have_node_matcher = :json }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api_matchers-0.5.1 spec/api_matchers/response_body/have_node_spec.rb
api_matchers-0.5.0 spec/api_matchers/response_body/have_node_spec.rb