chicago 0.3.11 → 0.3.12

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.11
1
+ 0.3.12
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{chicago}
8
- s.version = "0.3.11"
8
+ s.version = "0.3.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin 'Gus' Knowlden"]
@@ -29,15 +29,14 @@ module Chicago
29
29
  # asserts_json_response({"foo" => "bar"})
30
30
  # asserts_json_response('{"foo":"bar"}')
31
31
  # asserts_json_response("text/javascript;charset=utf-8", {"foo" => "bar"})
32
- # asserts_json_response { {"foo" => @some_value} }
33
- # asserts_json_response("text/javascript;charset=utf-8") { {"foo" => @some_value} }
32
+ # asserts_json_response { {"foo" => @some_value}.to_json }
33
+ # asserts_json_response("text/javascript;charset=utf-8") { {"foo" => @some_value}.to_json }
34
34
  def asserts_json_response(*args, &block)
35
- json = block_given? ? instance_eval(&block) : args.pop
36
-
37
- json = json.to_json unless json.instance_of?(String)
38
- asserts("response body has JSON") do
39
- last_response.body
40
- end.equals(json)
35
+ unless block_given?
36
+ json = args.pop
37
+ json = json.to_json unless json.instance_of?(String)
38
+ end
39
+ asserts("response body has JSON") { last_response.body }.equals(&(block || lambda {json}))
41
40
 
42
41
  asserts_content_type(args.empty? ? 'application/json' : args.shift)
43
42
  end
@@ -35,8 +35,9 @@ context "Riot Macros Test:" do
35
35
  end # with special content-type
36
36
 
37
37
  context "with content expectation provided as block" do
38
+ helper(:bar_value) { "bar" }
38
39
  setup { get('/json-with-content-type') }
39
- asserts_json_response("text/javascript;charset=utf-8") { {:foo => "bar"} }
40
- end # with special content-type
40
+ asserts_json_response("text/javascript;charset=utf-8") { {:foo => bar_value}.to_json }
41
+ end # with content expectation provided as block
41
42
  end # json response
42
43
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 11
9
- version: 0.3.11
8
+ - 12
9
+ version: 0.3.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - Justin 'Gus' Knowlden