@@ -21,7 +21,7 @@ def app
21
21
should "return ok" do
22
22
assert last_response . ok?
23
23
end
24
- should "have some kind of welcome " do
24
+ should "include an example " do
25
25
assert last_response . body =~ /curl/
26
26
end
27
27
end
@@ -33,9 +33,24 @@ def app
33
33
should "return ok" do
34
34
assert last_response . ok?
35
35
end
36
- should "return json conent-type" do
36
+ should "return json content-type" do
37
+ assert_equal 'application/json;charset=ascii-8bit' , last_response . headers [ 'Content-Type' ]
38
+ end
39
+ end
40
+
41
+ context "on GET to /:ip?variable=myVariableName" do
42
+ setup {
43
+ get '/67.161.92.71?variable=myVariableName'
44
+ }
45
+ should "return ok" do
46
+ assert last_response . ok?
47
+ end
48
+ should "return json content-type" do
37
49
assert_equal 'application/json;charset=ascii-8bit' , last_response . headers [ 'Content-Type' ]
38
50
end
51
+ should "include a variable" do
52
+ assert last_response . body =~ /var myVariableName/
53
+ end
39
54
end
40
55
41
56
context "on GET to /:ip?callback=myCallbackFunction" do
@@ -48,11 +63,29 @@ def app
48
63
should "return json content-type" do
49
64
assert_equal 'application/json;charset=ascii-8bit' , last_response . headers [ 'Content-Type' ]
50
65
end
51
- should "have a function as result " do
66
+ should "include a function" do
52
67
assert last_response . body =~ /myCallbackFunction\( \{ .*\} \) /
53
68
end
54
69
end
55
70
71
+ context "on GET to /:ip?callback=myCallbackFunction&variable=myVariableName" do
72
+ setup {
73
+ get '/67.161.92.71?callback=myCallbackFunction&variable=myVariableName'
74
+ }
75
+ should "return ok" do
76
+ assert last_response . ok?
77
+ end
78
+ should "return json content-type" do
79
+ assert_equal 'application/json;charset=ascii-8bit' , last_response . headers [ 'Content-Type' ]
80
+ end
81
+ should "include a variable" do
82
+ assert last_response . body =~ /var myVariableName/
83
+ end
84
+ should "include a function" do
85
+ assert last_response . body =~ /myCallbackFunction\( myVariableName\) ;/
86
+ end
87
+ end
88
+
56
89
context "converting struct" do
57
90
setup {
58
91
Struct . new (
0 commit comments