thumblemonks-chicago 0.3.2.1 → 0.3.2.2

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.
data/chicago.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "chicago"
3
- s.version = "0.3.2.1"
3
+ s.version = "0.3.2.2"
4
4
  s.date = "2009-06-28"
5
5
  s.summary = "Sinatra runtime and testing extensions used commonly by Thumblemonks"
6
6
  s.email = %w[gus@gusg.us gabriel.gironda@gmail.com]
@@ -4,41 +4,37 @@ module Chicago
4
4
  module Protest
5
5
  module Macros
6
6
  def asserts_response_status(expected)
7
- asserts("response status").equals(expected) { last_response.status }
7
+ asserts("response status is #{expected}").equals(expected) { last_response.status }
8
8
  end
9
9
 
10
10
  def asserts_content_type(expected)
11
- asserts("content type").equals(expected) { last_response.headers['Content-type'] }
11
+ asserts("content type is #{expected}").equals(expected) { last_response.headers['Content-type'] }
12
12
  end
13
13
 
14
14
  def asserts_response_body(expected)
15
- # TODO: implement a matches operator
16
- asserts("response body").not do
17
- expected = %r[#{expected}] if expected.kind_of?(String)
18
- expected.match(last_response.body).nil?
15
+ asserts("response body matches #{expected.inspect}").matches(expected) { last_response.body }
16
+ end
17
+
18
+ def asserts_location(expected_path)
19
+ asserts("location matches #{expected_path}").matches(expected_path) do
20
+ last_response.headers["Location"]
19
21
  end
20
22
  end
21
23
 
22
24
  def asserts_json_response(json, &block)
23
25
  asserts_content_type 'application/json'
24
- asserts("response body has JSON") do
26
+ asserts("response body has JSON").equals(last_response.body) do
25
27
  json = json.to_json unless json.instance_of?(String)
26
- last_response.body == json
28
+ json
27
29
  end
28
30
  end
29
31
 
30
32
  # Usage:
31
33
  # assert_redirected_to '/foo/bar'
34
+ # assert_redirected_to %r[foo/bar]
32
35
  def asserts_redirected_to(expected_path)
33
36
  asserts_response_status 302
34
37
  asserts_location expected_path
35
- # TODO: implement a matches operator
36
- # action = expected_path.kind_of?(Regexp) ? 'match' : 'equal'
37
- # send("assert_#{action}", expected_path, last_response.headers["Location"])
38
- end
39
-
40
- def asserts_location(expected_path)
41
- asserts("location header").equals(expected_path) { last_response.headers["Location"] }
42
38
  end
43
39
  end # Macros
44
40
  end # Protest
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thumblemonks-chicago
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2.1
4
+ version: 0.3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Knowlden