Skip to content

hiroeorz/rspec-response-code-matchers

Repository files navigation

rspec-response-code-matcher

DESCRIPTION:

RSpecResponseCodeMatchers is rspec’s custom spec matcher, that checking http response code.

SYNOPSIS:

target is Integer or Object, that defined “status” method.

require "rspec_response_code_matchers"

500.should be_internal_server_error
404.should be_not_found

If you use merb rspec:

in spec/spec_helper.rb:

require "rspec_response_code_matchers"

in spec/requests/sample_helper.rb:

describe "/sample/show" do
  before(:each) do
    @response = request("/sample/show")
  end

  it "should response code 301(redirect)" do
    @response.should be_redirect          # match 3xx
    @response.should be_moved_permanently # match 301
  end
end

Copyright © 2009 hiroeorz. See LICENSE for details.

About

RSpecResponseCodeMatchers is rspec's custom matcher, that check http response code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages