Sha256: df9089c6151f07b0375eecb5010651c4d80e7c92fc9e63f859706476727c865c

Contents?: true

Size: 1.82 KB

Versions: 1

Compression:

Stored size: 1.82 KB

Contents

require File.expand_path("../test_helper", __FILE__)

def stub_app(status_code)
  lambda { |env| [status_code, {}, [""]] }
end

describe Rack::Minitest::Expectations do
  include Rack::Test::Methods
  include Rack::Minitest::Expectations

  it "should have a spec-style matcher for an ok response" do
    def app; stub_app(200); end

    get "/"
    last_response.must_be_ok
  end

  it "should have a spec-style matcher for a created response" do
    def app; stub_app(201); end

    get "/"
    last_response.must_be_created
  end

  it "should have a spec-style matcher for a no content response" do
    def app; stub_app(204); end

    get "/"
    last_response.must_be_no_content
  end

  it "should have a spec-style matcher for a moved permanently response" do
    def app; stub_app(301); end

    get "/"
    last_response.must_be_moved_permanently
  end

  it "should have a spec-style matcher for a bad request response" do
    def app; stub_app(400); end

    get "/"
    last_response.must_be_bad_request
  end

  it "should have a spec-style matcher for an unauthorized response" do
    def app; stub_app(401); end

    get "/"
    last_response.must_be_unauthorized
  end

  it "should have a spec-style matcher for a forbidden response" do
    def app; stub_app(403); end

    get "/"
    last_response.must_be_forbidden
  end

  it "should have a spec-style matcher for a not found response" do
    def app; stub_app(404); end

    get "/"
    last_response.must_be_not_found
  end

 it "should have a spec-style matcher for an unprocessable entity response" do
    def app; stub_app(422); end

    get "/"
    last_response.must_be_unprocessable_entity
  end

 it "should have a spec-style matcher for an internal server error response" do
    def app; stub_app(500); end

    get "/"
    last_response.must_be_internal_server_error
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-minitest-0.0.9 test/expectations_test.rb