Sha256: a148cfc19d706d8732668457a8a44bd3bbaecdc4fbccc4702120ef0a28fd328f

Contents?: true

Size: 953 Bytes

Versions: 2

Compression:

Stored size: 953 Bytes

Contents

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

describe Minitest::Spec do

  def app
    json = { "foo" => "bar" }.to_json
    lambda { |env| [200, { "Content-Type" => "text/html" }, [json]] }
  end

  it "should include Rack::Test::Methods" do
    assert Minitest::Spec.include? Rack::Test::Methods
  end

  it "should parse JSON responses" do
    get "/"
    last_json_response.must_equal({ "foo" => "bar" })
  end

  it "should get as JSON" do
    get_json "/"
    assert_equal "application/json", last_request.env["CONTENT_TYPE"]
  end

  it "should post as JSON" do
    post_json "/"
    assert_equal "application/json", last_request.env["CONTENT_TYPE"]
  end

  it "should put as JSON" do
    put_json "/"
    assert_equal "application/json", last_request.env["CONTENT_TYPE"]
  end

  it "should delete as JSON" do
    delete_json "/"
    assert_equal "application/json", last_request.env["CONTENT_TYPE"]
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-minitest-0.0.10 test/spec_test.rb
rack-minitest-0.0.9 test/spec_test.rb