Sha256: ed43cd2ff9e5868c6314492dc0c1b6bc501ca90d47f2de9bc67e9c76846ae2be
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require 'spec_helper' describe APIMatchers::HTTPStatusCode::BeBadRequest do describe "should be_not_found" do it "should passes if the actual is equal to 404" do expect(404).to be_not_found end it "should fails if the actual is not equal to 404" do expect { expect(401).to be_not_found }.to fail_with(%Q{expected that '401' to be Not Found with the status '404'.}) end end describe "should_not be_not_found" do it "should passes if the actual is not equal to 404" do expect(401).not_to be_not_found end it "should fail if the actual is equal to 404" do expect { expect(404).not_to be_not_found }.to fail_with(%Q{expected that '404' to NOT be Not Found with the status '404'.}) end end describe "with change configuration" do before do APIMatchers.setup { |config| config.http_status_method = :http_status } end after do APIMatchers.setup { |config| config.http_status_method = nil } end it "should pass if the actual.http_status is equal to 404" do response = OpenStruct.new(:http_status => 404) expect(response).to be_not_found end it "should fail if the actual.http_status is not equal to 400" do response = OpenStruct.new(:http_status => 500) expect { expect(response).to be_not_found }.to fail_with(%Q{expected that '500' to be Not Found with the status '404'.}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
api_matchers-0.5.1 | spec/api_matchers/http_status_code/be_not_found_spec.rb |
api_matchers-0.5.0 | spec/api_matchers/http_status_code/be_not_found_spec.rb |