Sha256: d147dcf1818f1f7bdb1cb4a0dd56ffdc193238d0ae75401f9709f5b68a9adaa4

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

require 'spec_helper'

describe APIMatchers::Headers::BeJSON do
  describe "actual.should be_json" do
    it "should pass when the actual is json response" do
      "application/json; charset=utf-8".should be_json
    end

    it "should not pass when the actual is not a json response" do
      expect { "application/xml; charset=utf-8".should be_json }.to fail_with(%Q{expected a JSON response with 'application/json; charset=utf-8'. Got: 'application/xml; charset=utf-8'.})
    end
  end

  describe "actual.should_not be_json" do
    it "should pass when the actual is not a json response" do
      "application/xml; charset=utf-8".should_not be_json
    end

    it "should not pass when the actual is a json response" do
      expect { "application/json; charset=utf-8".should_not be_json }.to fail_with(%Q{expected to not be a JSON response. Got: 'application/json; charset=utf-8'.})
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api_matchers-0.0.1 spec/api_matchers/headers/be_json_spec.rb