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 +1 -1
- data/chicago.gemspec +1 -1
- data/lib/chicago/riot/macros.rb +7 -8
- data/test/riot_macros_test.rb +3 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.12
|
data/chicago.gemspec
CHANGED
data/lib/chicago/riot/macros.rb
CHANGED
@@ -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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
data/test/riot_macros_test.rb
CHANGED
@@ -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 =>
|
40
|
-
end # with
|
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
|