rack-minitest 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f819d45d2a7c07292be70f52dcc9c67f7d39762b
4
- data.tar.gz: 1a13aa8b329dbb245aebe25661350d80a200fdd3
3
+ metadata.gz: 6215e515b7bdbb2383d5025631a57cac7d73a4c8
4
+ data.tar.gz: 1e7fbb71c54b1215871c65ee45a3244e6288272f
5
5
  SHA512:
6
- metadata.gz: c056f716d998fc19714ea12daf1c5c98bd9100be52ae64dd06839b2d9c25572154e9db5a7644f1c6ad12dfe75edda986e13ad533f17e265f2e0853986d412d5e
7
- data.tar.gz: 1fb6170cb7539c421e5905e0ef751f73b308febcf0dffa6eea0c16ad50b5354d09c042c2318c0c3ec453d413199d0acdf69086d2e7bcc21d58e4ba8b27fabfb3
6
+ metadata.gz: 1157a7f46098fbd12f08b877a1291b8ce51907ba89d6ea6fdb0fe9fcecb466a7dab50b3caeb44165797b9de9d5fb1980b6f996ddd4fa1a55bb4f69bfd9756ff0
7
+ data.tar.gz: 8aba2ed83deae756c6b0f65a7fb1bdc7dfa99a78941aa7b20323d219b64f70611131a1e47fc9880f7005fd88f77fea185f2f34bb3c17c82895b27096c9c32687
data/README.md CHANGED
@@ -1,17 +1,31 @@
1
1
  # rack-minitest
2
2
 
3
- `rack-minitest` = `rack-test` + `MiniTest`. See what I did there?
3
+ `rack-minitest` = `rack-test` + `Minitest`. See what I did there?
4
4
 
5
- This gem adds some convenience methods to `rack-test` and `MiniTest` that I found myself duplicating over and over for every application I wrote. It adds a few methods for dealing with JSON to `rack-test` and `MiniTest` spec-style matchers for checking response status. The specific methods are:
5
+ This gem adds some convenience methods to `rack-test` and `Minitest` that I found myself duplicating over and over for every application I wrote. It adds a few methods for dealing with JSON to `rack-test`, `Minitest` assertions, and spec-style matchers for checking response status. The specific methods are:
6
6
 
7
- ```
7
+ ```ruby
8
+ # json
8
9
  last_json_response
9
10
 
10
- get_json path, params
11
- post_json path, params
12
- put_json path, params
13
- delete_json path, params
14
-
11
+ get_json path, params, headers
12
+ post_json path, params, headers
13
+ put_json path, params, headers
14
+ delete_json path, params, headers
15
+
16
+ # assertions
17
+ assert_ok
18
+ assert_created
19
+ assert_no_content
20
+ assert_moved_permanently
21
+ assert_bad_request
22
+ assert_unauthorized
23
+ assert_forbidden
24
+ assert_not_found
25
+ assert_unprocessable_entity
26
+ assert_internal_server_error
27
+
28
+ # matchers
15
29
  last_response.must_be_ok
16
30
  last_response.must_be_created
17
31
  last_response.must_be_no_content
@@ -24,7 +38,11 @@ last_response.must_be_unprocessable_entity
24
38
  last_response.must_be_internal_server_error
25
39
  ```
26
40
 
27
- **NB**: This is a quick and dirty gem to hack in some functionality that I was surprised to find didn't already exist. There are tests, and they pass, but they're pretty gross. All improvements are welcome.
41
+ ## Requirements
42
+
43
+ * [json](https://github.com/flori/json)
44
+ * [rack-test](https://github.com/brynary/rack-test)
45
+ * [minitest](https://github.com/seattlerb/minitest) ~> 5.0
28
46
 
29
47
  ## Installation
30
48
 
@@ -38,11 +56,31 @@ And then execute:
38
56
 
39
57
  ## Usage
40
58
 
41
- Just add the appropriate requires _after_ you load `rack-test` and `MiniTest`.
59
+ You can use `rack-minitest` in one of two ways.
42
60
 
43
- ```
61
+ ### Require only the modules you need
62
+
63
+ ```ruby
64
+ require "rack-minitest/json"
44
65
  require "rack-minitest/assertions"
45
- require "rack-minitest/spec"
66
+
67
+ class MyTestClass < Minitest::Test
68
+ include Rack::Test::Methods
69
+ include Rack::Minitest::JSON
70
+ include Rack::Minitest::Assertions
71
+
72
+ # use rack/test, the json methods, and assertions
73
+ end
74
+ ```
75
+
76
+ ### All in one
77
+
78
+ ```ruby
79
+ require "rack-minitest/test"
80
+
81
+ describe SomeTestClass do
82
+ # adds rack-test and all the rack-minitest modules
83
+ end
46
84
  ```
47
85
 
48
86
  ## Contributing
@@ -1,58 +1,50 @@
1
- module MiniTest::Assertions
1
+ module Rack
2
+ module Minitest
3
+ module Assertions
2
4
 
3
- def assert_ok(response)
4
- assert_response_status response, 200
5
- end
5
+ def assert_ok(response)
6
+ assert_response_status response, 200
7
+ end
6
8
 
7
- def assert_created(response)
8
- assert_response_status response, 201
9
- end
9
+ def assert_created(response)
10
+ assert_response_status response, 201
11
+ end
10
12
 
11
- def assert_no_content(response)
12
- assert_response_status response, 204
13
- end
13
+ def assert_no_content(response)
14
+ assert_response_status response, 204
15
+ end
14
16
 
15
- def assert_moved_permanently(response)
16
- assert_response_status response, 301
17
- end
17
+ def assert_moved_permanently(response)
18
+ assert_response_status response, 301
19
+ end
18
20
 
19
- def assert_bad_request(response)
20
- assert_response_status response, 400
21
- end
21
+ def assert_bad_request(response)
22
+ assert_response_status response, 400
23
+ end
22
24
 
23
- def assert_unauthorized(response)
24
- assert_response_status response, 401
25
- end
25
+ def assert_unauthorized(response)
26
+ assert_response_status response, 401
27
+ end
26
28
 
27
- def assert_forbidden(response)
28
- assert_response_status response, 403
29
- end
29
+ def assert_forbidden(response)
30
+ assert_response_status response, 403
31
+ end
30
32
 
31
- def assert_not_found(response)
32
- assert_response_status response, 404
33
- end
33
+ def assert_not_found(response)
34
+ assert_response_status response, 404
35
+ end
34
36
 
35
- def assert_unprocessable_entity(response)
36
- assert_response_status response, 422
37
- end
37
+ def assert_unprocessable_entity(response)
38
+ assert_response_status response, 422
39
+ end
38
40
 
39
- def assert_internal_server_error(response)
40
- assert_response_status response, 500
41
- end
41
+ def assert_internal_server_error(response)
42
+ assert_response_status response, 500
43
+ end
42
44
 
43
- def assert_response_status(response, status)
44
- assert response.status == status, "Expected response to be a #{status}, but was a #{response.status}"
45
+ def assert_response_status(response, status)
46
+ assert response.status == status, "Expected response to be a #{status}, but was a #{response.status}"
47
+ end
48
+ end
45
49
  end
46
-
47
50
  end
48
-
49
- Rack::MockResponse.infect_an_assertion :assert_ok, :must_be_ok, :only_one_argument
50
- Rack::MockResponse.infect_an_assertion :assert_created, :must_be_created, :only_one_argument
51
- Rack::MockResponse.infect_an_assertion :assert_no_content, :must_be_no_content, :only_one_argument
52
- Rack::MockResponse.infect_an_assertion :assert_moved_permanently, :must_be_moved_permanently, :only_one_argument
53
- Rack::MockResponse.infect_an_assertion :assert_bad_request, :must_be_bad_request, :only_one_argument
54
- Rack::MockResponse.infect_an_assertion :assert_unauthorized, :must_be_unauthorized, :only_one_argument
55
- Rack::MockResponse.infect_an_assertion :assert_forbidden, :must_be_forbidden, :only_one_argument
56
- Rack::MockResponse.infect_an_assertion :assert_not_found, :must_be_not_found, :only_one_argument
57
- Rack::MockResponse.infect_an_assertion :assert_unprocessable_entity, :must_be_unprocessable_entity, :only_one_argument
58
- Rack::MockResponse.infect_an_assertion :assert_internal_server_error, :must_be_internal_server_error, :only_one_argument
@@ -0,0 +1,22 @@
1
+ require "rack-minitest/assertions"
2
+
3
+ module Rack
4
+ module Minitest
5
+ module Expectations
6
+ include Rack::Minitest::Assertions
7
+ end
8
+ end
9
+ end
10
+
11
+ class Rack::MockResponse
12
+ infect_an_assertion :assert_ok, :must_be_ok, :only_one_argument
13
+ infect_an_assertion :assert_created, :must_be_created, :only_one_argument
14
+ infect_an_assertion :assert_no_content, :must_be_no_content, :only_one_argument
15
+ infect_an_assertion :assert_moved_permanently, :must_be_moved_permanently, :only_one_argument
16
+ infect_an_assertion :assert_bad_request, :must_be_bad_request, :only_one_argument
17
+ infect_an_assertion :assert_unauthorized, :must_be_unauthorized, :only_one_argument
18
+ infect_an_assertion :assert_forbidden, :must_be_forbidden, :only_one_argument
19
+ infect_an_assertion :assert_not_found, :must_be_not_found, :only_one_argument
20
+ infect_an_assertion :assert_unprocessable_entity, :must_be_unprocessable_entity, :only_one_argument
21
+ infect_an_assertion :assert_internal_server_error, :must_be_internal_server_error, :only_one_argument
22
+ end
@@ -0,0 +1,33 @@
1
+ require "json"
2
+
3
+ module Rack
4
+ module Minitest
5
+ module JSON
6
+ def last_json_response
7
+ ::JSON.parse(last_response.body)
8
+ end
9
+
10
+ def get_json(path, params = {}, headers = {})
11
+ json_request :get, path, params, headers
12
+ end
13
+
14
+ def post_json(path, params = {}, headers = {})
15
+ json_request :post, path, params, headers
16
+ end
17
+
18
+ def put_json(path, params = {}, headers = {})
19
+ json_request :put, path, params, headers
20
+ end
21
+
22
+ def delete_json(path, params = {}, headers = {})
23
+ json_request :delete, path, params, headers
24
+ end
25
+
26
+ private
27
+
28
+ def json_request(verb, path, params = {}, headers = {})
29
+ send verb, path, params.to_json, headers.merge({ "CONTENT_TYPE" => "application/json" })
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,9 @@
1
+ require "rack/test"
2
+ require "rack-minitest/expectations"
3
+ require "rack-minitest/json"
4
+
5
+ class Minitest::Test
6
+ include Rack::Test::Methods
7
+ include Rack::Minitest::Expectations
8
+ include Rack::Minitest::JSON
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Minitest
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Rack::Minitest::VERSION
9
9
  gem.authors = ["Brandon Weiss"]
10
10
  gem.email = ["brandon@anti-pattern.com"]
11
- gem.description = %q{rack-minitest = rack-test + MiniTest}
12
- gem.summary = %q{rack-minitest = rack-test + MiniTest}
11
+ gem.description = %q{rack-minitest = rack-test + Minitest}
12
+ gem.summary = %q{rack-minitest = rack-test + Minitest}
13
13
  gem.homepage = ""
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency "json"
21
21
  gem.add_dependency "rack-test"
22
- gem.add_dependency "minitest"
22
+ gem.add_dependency "minitest", "~> 5.0"
23
23
 
24
24
  gem.add_development_dependency "rake"
25
25
  end
@@ -4,76 +4,78 @@ def stub_app(status_code)
4
4
  lambda { |env| [status_code, {}, [""]] }
5
5
  end
6
6
 
7
- describe MiniTest::Spec do
7
+ describe Rack::Minitest::Assertions do
8
+ include Rack::Test::Methods
9
+ include Rack::Minitest::Assertions
8
10
 
9
- it "should have a spec-style matcher for an ok response" do
11
+ it "should have an assertion for an ok response" do
10
12
  def app; stub_app(200); end
11
13
 
12
14
  get "/"
13
- last_response.must_be_ok
15
+ assert_ok(last_response)
14
16
  end
15
17
 
16
- it "should have a spec-style matcher for a created response" do
18
+ it "should have an assertion for a created response" do
17
19
  def app; stub_app(201); end
18
20
 
19
21
  get "/"
20
- last_response.must_be_created
22
+ assert_created(last_response)
21
23
  end
22
24
 
23
- it "should have a spec-style matcher for a no content response" do
25
+ it "should have an assertion for a no content response" do
24
26
  def app; stub_app(204); end
25
27
 
26
28
  get "/"
27
- last_response.must_be_no_content
29
+ assert_no_content(last_response)
28
30
  end
29
31
 
30
- it "should have a spec-style matcher for a moved permanently response" do
32
+ it "should have an assertion for a moved permanently response" do
31
33
  def app; stub_app(301); end
32
34
 
33
35
  get "/"
34
- last_response.must_be_moved_permanently
36
+ assert_moved_permanently(last_response)
35
37
  end
36
38
 
37
- it "should have a spec-style matcher for a bad request response" do
39
+ it "should have an assertion for a bad request response" do
38
40
  def app; stub_app(400); end
39
41
 
40
42
  get "/"
41
- last_response.must_be_bad_request
43
+ assert_bad_request(last_response)
42
44
  end
43
45
 
44
- it "should have a spec-style matcher for an unauthorized response" do
46
+ it "should have an assertion for an unauthorized response" do
45
47
  def app; stub_app(401); end
46
48
 
47
49
  get "/"
48
- last_response.must_be_unauthorized
50
+ assert_unauthorized(last_response)
49
51
  end
50
52
 
51
- it "should have a spec-style matcher for a forbidden response" do
53
+ it "should have an assertion for a forbidden response" do
52
54
  def app; stub_app(403); end
53
55
 
54
56
  get "/"
55
- last_response.must_be_forbidden
57
+ assert_forbidden(last_response)
56
58
  end
57
59
 
58
- it "should have a spec-style matcher for a not found response" do
60
+ it "should have an assertion for a not found response" do
59
61
  def app; stub_app(404); end
60
62
 
61
63
  get "/"
62
- last_response.must_be_not_found
64
+ assert_not_found(last_response)
63
65
  end
64
66
 
65
- it "should have a spec-style matcher for an unprocessable entity response" do
67
+ it "should have an assertion for an unprocessable entity response" do
66
68
  def app; stub_app(422); end
67
69
 
68
70
  get "/"
69
- last_response.must_be_unprocessable_entity
71
+ assert_unprocessable_entity(last_response)
70
72
  end
71
73
 
72
- it "should have a spec-style matcher for an internal server error response" do
74
+ it "should have an assertion for an internal server error response" do
73
75
  def app; stub_app(500); end
74
76
 
75
77
  get "/"
76
- last_response.must_be_internal_server_error
78
+ assert_internal_server_error(last_response)
77
79
  end
78
80
 
79
81
  end
@@ -0,0 +1,81 @@
1
+ require File.expand_path("../test_helper", __FILE__)
2
+
3
+ def stub_app(status_code)
4
+ lambda { |env| [status_code, {}, [""]] }
5
+ end
6
+
7
+ describe Rack::Minitest::Expectations do
8
+ include Rack::Test::Methods
9
+ include Rack::Minitest::Expectations
10
+
11
+ it "should have a spec-style matcher for an ok response" do
12
+ def app; stub_app(200); end
13
+
14
+ get "/"
15
+ last_response.must_be_ok
16
+ end
17
+
18
+ it "should have a spec-style matcher for a created response" do
19
+ def app; stub_app(201); end
20
+
21
+ get "/"
22
+ last_response.must_be_created
23
+ end
24
+
25
+ it "should have a spec-style matcher for a no content response" do
26
+ def app; stub_app(204); end
27
+
28
+ get "/"
29
+ last_response.must_be_no_content
30
+ end
31
+
32
+ it "should have a spec-style matcher for a moved permanently response" do
33
+ def app; stub_app(301); end
34
+
35
+ get "/"
36
+ last_response.must_be_moved_permanently
37
+ end
38
+
39
+ it "should have a spec-style matcher for a bad request response" do
40
+ def app; stub_app(400); end
41
+
42
+ get "/"
43
+ last_response.must_be_bad_request
44
+ end
45
+
46
+ it "should have a spec-style matcher for an unauthorized response" do
47
+ def app; stub_app(401); end
48
+
49
+ get "/"
50
+ last_response.must_be_unauthorized
51
+ end
52
+
53
+ it "should have a spec-style matcher for a forbidden response" do
54
+ def app; stub_app(403); end
55
+
56
+ get "/"
57
+ last_response.must_be_forbidden
58
+ end
59
+
60
+ it "should have a spec-style matcher for a not found response" do
61
+ def app; stub_app(404); end
62
+
63
+ get "/"
64
+ last_response.must_be_not_found
65
+ end
66
+
67
+ it "should have a spec-style matcher for an unprocessable entity response" do
68
+ def app; stub_app(422); end
69
+
70
+ get "/"
71
+ last_response.must_be_unprocessable_entity
72
+ end
73
+
74
+ it "should have a spec-style matcher for an internal server error response" do
75
+ def app; stub_app(500); end
76
+
77
+ get "/"
78
+ last_response.must_be_internal_server_error
79
+ end
80
+
81
+ end
data/test/json_test.rb ADDED
@@ -0,0 +1,60 @@
1
+ require File.expand_path("../test_helper", __FILE__)
2
+
3
+ describe Rack::Minitest::JSON do
4
+ include Rack::Test::Methods
5
+ include Rack::Minitest::JSON
6
+
7
+ def app
8
+ json = { "foo" => "bar" }.to_json
9
+ lambda { |env| [200, { "Content-Type" => "text/html" }, [json]] }
10
+ end
11
+
12
+ it "should include Rack::Minitest::JSON" do
13
+ assert Minitest::Spec.include? Rack::Minitest::JSON
14
+ end
15
+
16
+ it "should parse JSON responses" do
17
+ get "/"
18
+ last_json_response.must_equal({ "foo" => "bar" })
19
+ end
20
+
21
+ it "should get as JSON" do
22
+ get_json "/"
23
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
24
+ end
25
+
26
+ it "should post as JSON" do
27
+ post_json "/"
28
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
29
+ end
30
+
31
+ it "should put as JSON" do
32
+ put_json "/"
33
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
34
+ end
35
+
36
+ it "should delete as JSON" do
37
+ delete_json "/"
38
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
39
+ end
40
+
41
+ it "should set custom headers on get" do
42
+ get_json "/", {}, { "HTTP_AUTHORIZATION" => "Token token=1111" }
43
+ assert_equal "Token token=1111", last_request.env["HTTP_AUTHORIZATION"]
44
+ end
45
+
46
+ it "should set custom headers on post" do
47
+ post_json "/", {}, { "HTTP_AUTHORIZATION" => "Token token=1111" }
48
+ assert_equal "Token token=1111", last_request.env["HTTP_AUTHORIZATION"]
49
+ end
50
+
51
+ it "should set custom headers on put" do
52
+ put_json "/", {}, { "HTTP_AUTHORIZATION" => "Token token=1111" }
53
+ assert_equal "Token token=1111", last_request.env["HTTP_AUTHORIZATION"]
54
+ end
55
+
56
+ it "should set custom headers on delete" do
57
+ delete_json "/", {}, { "HTTP_AUTHORIZATION" => "Token token=1111" }
58
+ assert_equal "Token token=1111", last_request.env["HTTP_AUTHORIZATION"]
59
+ end
60
+ end
data/test/spec_test.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require File.expand_path("../test_helper", __FILE__)
2
+ require "minitest/test"
2
3
 
3
- describe MiniTest::Spec do
4
+ describe Minitest::Spec do
4
5
 
5
6
  def app
6
7
  json = { "foo" => "bar" }.to_json
@@ -8,7 +9,7 @@ describe MiniTest::Spec do
8
9
  end
9
10
 
10
11
  it "should include Rack::Test::Methods" do
11
- assert MiniTest::Spec.include? Rack::Test::Methods
12
+ assert Minitest::Spec.include? Rack::Test::Methods
12
13
  end
13
14
 
14
15
  it "should parse JSON responses" do
data/test/test_helper.rb CHANGED
@@ -6,5 +6,6 @@ require "rack/test"
6
6
  require "minitest/autorun"
7
7
 
8
8
  require "json"
9
+ require "rack-minitest/json"
9
10
  require "rack-minitest/assertions"
10
- require "rack-minitest/spec"
11
+ require "rack-minitest/expectations"
data/test/unit_test.rb ADDED
@@ -0,0 +1,40 @@
1
+ require File.expand_path("../test_helper", __FILE__)
2
+ require "rack-minitest/test"
3
+
4
+ class TestRackMinitestUnit < Minitest::Test
5
+
6
+ def app
7
+ json = { "foo" => "bar" }.to_json
8
+ lambda { |env| [200, { "Content-Type" => "text/html" }, [json]] }
9
+ end
10
+
11
+ def test_includes_rack_test_methods
12
+ assert Minitest::Test.include? Rack::Test::Methods
13
+ end
14
+
15
+ def test_parses_JSON_responses
16
+ get "/"
17
+ assert_equal({ "foo" => "bar" }, last_json_response)
18
+ end
19
+
20
+ def test_get_as_JSON
21
+ get_json "/"
22
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
23
+ end
24
+
25
+ def test_post_as_JSON
26
+ post_json "/"
27
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
28
+ end
29
+
30
+ def test_put_as_JSON
31
+ put_json "/"
32
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
33
+ end
34
+
35
+ def test_delete_as_JSON
36
+ delete_json "/"
37
+ assert_equal "application/json", last_request.env["CONTENT_TYPE"]
38
+ end
39
+
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Weiss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-23 00:00:00.000000000 Z
11
+ date: 2014-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '5.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '5.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: rack-minitest = rack-test + MiniTest
69
+ description: rack-minitest = rack-test + Minitest
70
70
  email:
71
71
  - brandon@anti-pattern.com
72
72
  executables: []
@@ -80,12 +80,17 @@ files:
80
80
  - Rakefile
81
81
  - lib/rack-minitest.rb
82
82
  - lib/rack-minitest/assertions.rb
83
- - lib/rack-minitest/spec.rb
83
+ - lib/rack-minitest/expectations.rb
84
+ - lib/rack-minitest/json.rb
85
+ - lib/rack-minitest/test.rb
84
86
  - lib/rack-minitest/version.rb
85
87
  - rack-minitest.gemspec
86
88
  - test/assertions_test.rb
89
+ - test/expectations_test.rb
90
+ - test/json_test.rb
87
91
  - test/spec_test.rb
88
92
  - test/test_helper.rb
93
+ - test/unit_test.rb
89
94
  homepage: ''
90
95
  licenses: []
91
96
  metadata: {}
@@ -105,11 +110,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
110
  version: '0'
106
111
  requirements: []
107
112
  rubyforge_project:
108
- rubygems_version: 2.0.0
113
+ rubygems_version: 2.2.0
109
114
  signing_key:
110
115
  specification_version: 4
111
- summary: rack-minitest = rack-test + MiniTest
116
+ summary: rack-minitest = rack-test + Minitest
112
117
  test_files:
113
118
  - test/assertions_test.rb
119
+ - test/expectations_test.rb
120
+ - test/json_test.rb
114
121
  - test/spec_test.rb
115
122
  - test/test_helper.rb
123
+ - test/unit_test.rb
@@ -1,31 +0,0 @@
1
- class MiniTest::Spec
2
-
3
- include Rack::Test::Methods
4
-
5
- def last_json_response
6
- JSON.parse(last_response.body)
7
- end
8
-
9
- def get_json(path, params = {})
10
- json_request :get, path, params
11
- end
12
-
13
- def post_json(path, params = {})
14
- json_request :post, path, params
15
- end
16
-
17
- def put_json(path, params = {})
18
- json_request :put, path, params
19
- end
20
-
21
- def delete_json(path, params = {})
22
- json_request :delete, path, params
23
- end
24
-
25
- private
26
-
27
- def json_request(verb, path, params = {})
28
- send verb, path, params.to_json, "CONTENT_TYPE" => "application/json"
29
- end
30
-
31
- end