textmagic 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/History.txt +4 -0
- data/README.md +131 -0
- data/Rakefile +1 -3
- data/bin/tm +5 -5
- data/lib/textmagic/executor.rb +1 -2
- data/lib/textmagic/version.rb +1 -1
- data/test/test_api.rb +100 -76
- data/test/test_charset.rb +25 -25
- data/test/test_error.rb +9 -9
- data/test/test_executor.rb +20 -23
- data/test/test_helper.rb +10 -14
- data/test/test_response.rb +100 -100
- data/test/test_validation.rb +50 -50
- data/textmagic.gemspec +1 -5
- metadata +17 -60
- data/README.rdoc +0 -153
data/test/test_charset.rb
CHANGED
@@ -2,45 +2,45 @@
|
|
2
2
|
|
3
3
|
require "test_helper"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
should
|
10
|
-
TextMagic::API.is_gsm(("a".."z").to_a.join)
|
11
|
-
TextMagic::API.is_gsm(("A".."Z").to_a.join)
|
12
|
-
TextMagic::API.is_gsm(("0".."9").to_a.join)
|
13
|
-
TextMagic::API.is_gsm("@£$¥€")
|
14
|
-
TextMagic::API.is_gsm("\n\r\e\f\\\"")
|
15
|
-
TextMagic::API.is_gsm("èéùìòÇØøÅåÉÆæß")
|
16
|
-
TextMagic::API.is_gsm("ΔΦΓΛΩΠΨΣΘΞ")
|
17
|
-
TextMagic::API.is_gsm("^{}[~]| !#¤%&'()")
|
18
|
-
TextMagic::API.is_gsm("*+,-./_:;<=>?¡¿§")
|
19
|
-
TextMagic::API.is_gsm("ÖÑÜöñüàäÄ")
|
5
|
+
describe "Charset" do
|
6
|
+
|
7
|
+
describe "is_gsm method" do
|
8
|
+
|
9
|
+
it "should return true if all characters are in GSM 03.38 charset" do
|
10
|
+
assert_equal true, TextMagic::API.is_gsm(("a".."z").to_a.join)
|
11
|
+
assert_equal true, TextMagic::API.is_gsm(("A".."Z").to_a.join)
|
12
|
+
assert_equal true, TextMagic::API.is_gsm(("0".."9").to_a.join)
|
13
|
+
assert_equal true, TextMagic::API.is_gsm("@£$¥€")
|
14
|
+
assert_equal true, TextMagic::API.is_gsm("\n\r\e\f\\\"")
|
15
|
+
assert_equal true, TextMagic::API.is_gsm("èéùìòÇØøÅåÉÆæß")
|
16
|
+
assert_equal true, TextMagic::API.is_gsm("ΔΦΓΛΩΠΨΣΘΞ")
|
17
|
+
assert_equal true, TextMagic::API.is_gsm("^{}[~]| !#¤%&'()")
|
18
|
+
assert_equal true, TextMagic::API.is_gsm("*+,-./_:;<=>?¡¿§")
|
19
|
+
assert_equal true, TextMagic::API.is_gsm("ÖÑÜöñüàäÄ")
|
20
20
|
end
|
21
21
|
|
22
|
-
should
|
23
|
-
TextMagic::API.is_gsm("Arabic: مرحبا فيلما")
|
24
|
-
TextMagic::API.is_gsm("Chinese: 您好")
|
25
|
-
TextMagic::API.is_gsm("Cyrilic: Вильма Привет")
|
26
|
-
TextMagic::API.is_gsm("Thai: สวัสดี")
|
22
|
+
it "should return false if some characters are outside of GSM 03.38 charset" do
|
23
|
+
assert_equal false, TextMagic::API.is_gsm("Arabic: مرحبا فيلما")
|
24
|
+
assert_equal false, TextMagic::API.is_gsm("Chinese: 您好")
|
25
|
+
assert_equal false, TextMagic::API.is_gsm("Cyrilic: Вильма Привет")
|
26
|
+
assert_equal false, TextMagic::API.is_gsm("Thai: สวัสดี")
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
describe "real_length method" do
|
31
31
|
|
32
|
-
should
|
32
|
+
it "should count escaped characters as two and all others as one for non-unicode text" do
|
33
33
|
escaped = "{}\\~[]|€"
|
34
34
|
unescaped = random_string
|
35
35
|
text = "#{escaped}#{unescaped}".scan(/./).sort_by { rand }.join
|
36
|
-
|
36
|
+
assert_equal unescaped.size + escaped.size * 2, TextMagic::API.real_length(text, false)
|
37
37
|
end
|
38
38
|
|
39
|
-
should
|
39
|
+
it "should count all characters as one for unicode text" do
|
40
40
|
escaped = "{}\\~[]|€"
|
41
41
|
unescaped = random_string
|
42
42
|
text = "#{escaped}#{unescaped}".scan(/./).sort_by { rand }.join
|
43
|
-
TextMagic::API.real_length(text, true)
|
43
|
+
assert_equal unescaped.size + escaped.size, TextMagic::API.real_length(text, true)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
data/test/test_error.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
-
|
3
|
+
describe "Error" do
|
4
4
|
|
5
|
-
|
5
|
+
describe "Initialization" do
|
6
6
|
|
7
|
-
|
7
|
+
before do
|
8
8
|
@code = rand(1e3)
|
9
9
|
@message = random_string
|
10
10
|
end
|
11
11
|
|
12
|
-
should
|
12
|
+
it "should accept a hash with error_code and error_message" do
|
13
13
|
e = TextMagic::API::Error.new("error_code" => @code, "error_message" => @message)
|
14
|
-
e.code
|
15
|
-
e.message
|
14
|
+
assert_equal @code, e.code
|
15
|
+
assert_equal @message, e.message
|
16
16
|
end
|
17
17
|
|
18
|
-
should
|
18
|
+
it "should accept error_code and error_message" do
|
19
19
|
e = TextMagic::API::Error.new(@code, @message)
|
20
|
-
e.code
|
21
|
-
e.message
|
20
|
+
assert_equal @code, e.code
|
21
|
+
assert_equal @message, e.message
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/test/test_executor.rb
CHANGED
@@ -1,71 +1,68 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
-
|
3
|
+
describe "Executor" do
|
4
4
|
|
5
|
-
|
5
|
+
describe "execute method" do
|
6
6
|
|
7
|
-
|
7
|
+
before do
|
8
8
|
FakeWeb.allow_net_connect = false
|
9
9
|
|
10
10
|
@username, @password = random_string, random_string
|
11
11
|
@command, @options = random_string, random_hash
|
12
|
-
@uri = "
|
12
|
+
@uri = "https://www.textmagic.com/app/api"
|
13
13
|
end
|
14
14
|
|
15
|
-
should
|
16
|
-
TextMagic::API::
|
17
|
-
lambda {
|
15
|
+
it "should not send HTTP request without command" do
|
16
|
+
assert_raises TextMagic::API::Error do
|
18
17
|
TextMagic::API::Executor.execute(nil, @username, @password, @options)
|
19
|
-
|
18
|
+
end
|
20
19
|
end
|
21
20
|
|
22
|
-
should
|
21
|
+
it "should not send HTTP request without username" do
|
23
22
|
TextMagic::API::Executor.expects(:post).never
|
24
|
-
|
25
|
-
TextMagic::API::Executor.execute(@command, nil, @password, @options)
|
26
|
-
}.should raise_error(TextMagic::API::Error)
|
23
|
+
assert_raises(TextMagic::API::Error) { TextMagic::API::Executor.execute(@command, nil, @password, @options) }
|
27
24
|
end
|
28
25
|
|
29
|
-
should
|
26
|
+
it "should not send HTTP request without password" do
|
30
27
|
TextMagic::API::Executor.expects(:post).never
|
31
|
-
|
28
|
+
assert_raises TextMagic::API::Error do
|
32
29
|
TextMagic::API::Executor.execute(@command, @username, nil, @options)
|
33
|
-
|
30
|
+
end
|
34
31
|
end
|
35
32
|
|
36
|
-
should
|
33
|
+
it "should send a POST request to proper uri" do
|
37
34
|
response = "{}"
|
38
35
|
FakeWeb.register_uri(:post, @uri, :body => response)
|
39
36
|
TextMagic::API::Executor.execute(@command, @username, @password, @options)
|
40
37
|
end
|
41
38
|
|
42
|
-
should
|
39
|
+
it "should not send parameters with nil keys" do
|
43
40
|
options_with_empty_values = @options.merge(nil => random_string)
|
44
41
|
@options.merge!(:username => @username, :password => @password, :cmd => @command)
|
45
42
|
TextMagic::API::Executor.expects(:post).with("/api", :body => @options, :format => :json)
|
46
43
|
TextMagic::API::Executor.execute(@command, @username, @password, options_with_empty_values)
|
47
44
|
end
|
48
45
|
|
49
|
-
should
|
46
|
+
it "should not send parameters with nil values" do
|
50
47
|
options_with_empty_values = @options.merge(random_string => nil)
|
51
48
|
@options.merge!(:username => @username, :password => @password, :cmd => @command)
|
52
49
|
TextMagic::API::Executor.expects(:post).with("/api", :body => @options, :format => :json)
|
53
50
|
TextMagic::API::Executor.execute(@command, @username, @password, options_with_empty_values)
|
54
51
|
end
|
55
52
|
|
56
|
-
should
|
53
|
+
it "should raise an error if the response contains error_code" do
|
57
54
|
response = "{\"error_code\":#{1 + rand(10)}}"
|
58
55
|
FakeWeb.register_uri(:post, @uri, :body => response)
|
59
|
-
|
56
|
+
assert_raises TextMagic::API::Error do
|
60
57
|
TextMagic::API::Executor.execute(@command, @username, @password, @options)
|
61
|
-
|
58
|
+
end
|
62
59
|
end
|
63
60
|
|
64
|
-
should
|
61
|
+
it "should return a hash with values from the response" do
|
65
62
|
hash = { "this" => "is", "just" => "a", "random" => "hash" }
|
66
63
|
FakeWeb.register_uri(:post, @uri, :body => '{"this":"is","just":"a","random":"hash"}')
|
67
64
|
response = TextMagic::API::Executor.execute(@command, @username, @password, @options)
|
68
|
-
response.
|
65
|
+
assert_equal hash, response.to_hash
|
69
66
|
end
|
70
67
|
end
|
71
68
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,17 +1,5 @@
|
|
1
|
-
require "
|
2
|
-
require
|
3
|
-
require "shoulda"
|
4
|
-
require "mocha"
|
5
|
-
require "matchy"
|
6
|
-
require "fakeweb"
|
7
|
-
|
8
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
9
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
10
|
-
|
11
|
-
require "textmagic"
|
12
|
-
|
13
|
-
class Test::Unit::TestCase
|
14
|
-
end
|
1
|
+
require "bundler"
|
2
|
+
Bundler.require
|
15
3
|
|
16
4
|
def random_string(legth = 5 + rand(10))
|
17
5
|
Array.new(legth) { rand(36).to_s(36) }.join
|
@@ -26,3 +14,11 @@ def random_hash
|
|
26
14
|
3.times { hash[random_string] = random_string }
|
27
15
|
hash
|
28
16
|
end
|
17
|
+
|
18
|
+
class Minitest::Test
|
19
|
+
|
20
|
+
def self.it(name, &block)
|
21
|
+
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
|
22
|
+
define_method(test_name, &block)
|
23
|
+
end
|
24
|
+
end
|
data/test/test_response.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
-
|
3
|
+
describe "Response" do
|
4
4
|
|
5
|
-
|
5
|
+
describe "Response to account command" do
|
6
6
|
|
7
|
-
|
7
|
+
before do
|
8
8
|
@balance = 0.1 * rand(1e4)
|
9
9
|
@hash = { "balance" => @balance.to_s }
|
10
10
|
@response = TextMagic::API::Response.account(@hash)
|
11
11
|
end
|
12
12
|
|
13
|
-
should
|
14
|
-
@response
|
13
|
+
it "should be an OpenStruct instance" do
|
14
|
+
assert_kind_of OpenStruct, @response
|
15
15
|
end
|
16
16
|
|
17
|
-
should
|
18
|
-
@response.balance
|
17
|
+
it "should have balance" do
|
18
|
+
assert_in_delta @response.balance, @balance, 1e-10
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
describe "Response to send command with single phone number" do
|
23
23
|
|
24
|
-
|
24
|
+
before do
|
25
25
|
@message_id, @phone = random_string, random_phone
|
26
26
|
@text = random_string
|
27
27
|
@parts_count = 1 + rand(3)
|
@@ -29,22 +29,22 @@ class ResponseTest < Test::Unit::TestCase
|
|
29
29
|
@response = TextMagic::API::Response.send(@hash, true)
|
30
30
|
end
|
31
31
|
|
32
|
-
should
|
33
|
-
@
|
32
|
+
it "should equal to the message_id" do
|
33
|
+
assert_equal @message_id, @response
|
34
34
|
end
|
35
35
|
|
36
|
-
should
|
37
|
-
@response.sent_text
|
36
|
+
it "should have sent_text" do
|
37
|
+
assert_equal @text, @response.sent_text
|
38
38
|
end
|
39
39
|
|
40
|
-
should
|
41
|
-
@
|
40
|
+
it "should have parts_count" do
|
41
|
+
assert_equal @parts_count, @response.parts_count
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
describe "Response to send command with multiple phone numbers" do
|
46
46
|
|
47
|
-
|
47
|
+
before do
|
48
48
|
@message_id1, @phone1 = random_string, random_phone
|
49
49
|
@message_id2, @phone2 = random_string, random_phone
|
50
50
|
@text = random_string
|
@@ -53,31 +53,31 @@ class ResponseTest < Test::Unit::TestCase
|
|
53
53
|
@response = TextMagic::API::Response.send(@hash, false)
|
54
54
|
end
|
55
55
|
|
56
|
-
should
|
57
|
-
@response
|
56
|
+
it "should be a hash" do
|
57
|
+
assert_kind_of Hash, @response
|
58
58
|
end
|
59
59
|
|
60
|
-
should
|
61
|
-
|
60
|
+
it "should have phone numbers as keys" do
|
61
|
+
assert_equal [@phone1, @phone2].sort, @response.keys.sort
|
62
62
|
end
|
63
63
|
|
64
|
-
should
|
65
|
-
@response[@phone1]
|
66
|
-
@response[@phone2]
|
64
|
+
it "should have message ids as values" do
|
65
|
+
assert_equal @message_id1, @response[@phone1]
|
66
|
+
assert_equal @message_id2, @response[@phone2]
|
67
67
|
end
|
68
68
|
|
69
|
-
should
|
70
|
-
@response.sent_text
|
69
|
+
it "should have sent_text" do
|
70
|
+
assert_equal @text, @response.sent_text
|
71
71
|
end
|
72
72
|
|
73
|
-
should
|
74
|
-
@
|
73
|
+
it "should have parts_count" do
|
74
|
+
assert_equal @parts_count, @response.parts_count
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
|
78
|
+
describe "Response to message_status command with single id" do
|
79
79
|
|
80
|
-
|
80
|
+
before do
|
81
81
|
@text = random_string
|
82
82
|
@status = random_string
|
83
83
|
@reply_number = random_phone
|
@@ -97,38 +97,38 @@ class ResponseTest < Test::Unit::TestCase
|
|
97
97
|
@response = TextMagic::API::Response.message_status(@hash, true)
|
98
98
|
end
|
99
99
|
|
100
|
-
should
|
101
|
-
@
|
100
|
+
it "should equal to the message status" do
|
101
|
+
assert_equal @status, @response
|
102
102
|
end
|
103
103
|
|
104
|
-
should
|
105
|
-
@
|
104
|
+
it "should have text" do
|
105
|
+
assert_equal @text, @response.text
|
106
106
|
end
|
107
107
|
|
108
|
-
should
|
109
|
-
|
108
|
+
it "should have created_time" do
|
109
|
+
assert_equal Time.at(@created_time), @response.created_time
|
110
110
|
end
|
111
111
|
|
112
|
-
should
|
113
|
-
|
112
|
+
it "should have completed_time" do
|
113
|
+
assert_equal Time.at(@completed_time), @response.completed_time
|
114
114
|
end
|
115
115
|
|
116
|
-
should
|
117
|
-
@
|
116
|
+
it "should have reply_number" do
|
117
|
+
assert_equal @reply_number, @response.reply_number
|
118
118
|
end
|
119
119
|
|
120
|
-
should
|
121
|
-
@response.credits_cost
|
120
|
+
it "should have credits_cost" do
|
121
|
+
assert_in_delta @response.credits_cost, @credits_cost, 1e-10
|
122
122
|
end
|
123
123
|
|
124
|
-
should
|
125
|
-
@
|
124
|
+
it "should have status" do
|
125
|
+
assert_equal @status, @response.status
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
|
129
|
+
describe "Response to message_status command with multiple ids" do
|
130
130
|
|
131
|
-
|
131
|
+
before do
|
132
132
|
@text = random_string
|
133
133
|
@status = random_string
|
134
134
|
@reply_number = random_phone
|
@@ -148,46 +148,46 @@ class ResponseTest < Test::Unit::TestCase
|
|
148
148
|
@response = TextMagic::API::Response.message_status(@hash, false)
|
149
149
|
end
|
150
150
|
|
151
|
-
should
|
152
|
-
@response
|
151
|
+
it "should be a hash" do
|
152
|
+
assert_kind_of Hash, @response
|
153
153
|
end
|
154
154
|
|
155
|
-
should
|
156
|
-
|
155
|
+
it "should have message_ids as keys" do
|
156
|
+
assert_equal ["141421"], @response.keys
|
157
157
|
end
|
158
158
|
|
159
|
-
should
|
160
|
-
@response.values.first
|
159
|
+
it "should contain statuses" do
|
160
|
+
assert_equal @status, @response.values.first
|
161
161
|
end
|
162
162
|
|
163
|
-
should
|
164
|
-
@response.values.first.text
|
163
|
+
it "should have text for all statuses" do
|
164
|
+
assert_equal @text, @response.values.first.text
|
165
165
|
end
|
166
166
|
|
167
|
-
should
|
168
|
-
@response.values.first.created_time
|
167
|
+
it "should have created_time for all statuses" do
|
168
|
+
assert_equal Time.at(@created_time), @response.values.first.created_time
|
169
169
|
end
|
170
170
|
|
171
|
-
should
|
172
|
-
@response.values.first.completed_time
|
171
|
+
it "should have completed_time for all statuses" do
|
172
|
+
assert_equal Time.at(@completed_time), @response.values.first.completed_time
|
173
173
|
end
|
174
174
|
|
175
|
-
should
|
176
|
-
@response.values.first.reply_number
|
175
|
+
it "should have reply_number for all statuses" do
|
176
|
+
assert_equal @reply_number, @response.values.first.reply_number
|
177
177
|
end
|
178
178
|
|
179
|
-
should
|
180
|
-
@response.values.first.status
|
179
|
+
it "should have status for all statuses" do
|
180
|
+
assert_equal @status, @response.values.first.status
|
181
181
|
end
|
182
182
|
|
183
|
-
should
|
184
|
-
@response.values.first.credits_cost
|
183
|
+
it "should have credits_cost for all statuses" do
|
184
|
+
assert_in_delta @response.values.first.credits_cost, @credits_cost, 1e-10
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
-
|
188
|
+
describe "Response to receive command" do
|
189
189
|
|
190
|
-
|
190
|
+
before do
|
191
191
|
@timestamp = (Time.now - 30).to_i
|
192
192
|
@text, @phone, @message_id = random_string, random_phone, random_string
|
193
193
|
@message = {
|
@@ -201,38 +201,38 @@ class ResponseTest < Test::Unit::TestCase
|
|
201
201
|
@response = TextMagic::API::Response.receive(@hash)
|
202
202
|
end
|
203
203
|
|
204
|
-
should
|
205
|
-
@
|
204
|
+
it "should have unread" do
|
205
|
+
assert_equal @unread, @response.unread
|
206
206
|
end
|
207
207
|
|
208
|
-
should
|
209
|
-
@response
|
208
|
+
it "should be an array" do
|
209
|
+
assert_kind_of Array, @response
|
210
210
|
end
|
211
211
|
|
212
|
-
should
|
213
|
-
|
212
|
+
it "should contain strings with phones numbers and texts" do
|
213
|
+
assert_equal "#{@phone}: #{@text}", @response.first
|
214
214
|
end
|
215
215
|
|
216
|
-
should
|
217
|
-
|
216
|
+
it "should have timestamp for all messages" do
|
217
|
+
assert_equal Time.at(@timestamp), @response.first.timestamp
|
218
218
|
end
|
219
219
|
|
220
|
-
should
|
221
|
-
@response.first.from
|
220
|
+
it "should have from for all messages" do
|
221
|
+
assert_equal @phone, @response.first.from
|
222
222
|
end
|
223
223
|
|
224
|
-
should
|
225
|
-
@response.first.text
|
224
|
+
it "should have text for all messages" do
|
225
|
+
assert_equal @text, @response.first.text
|
226
226
|
end
|
227
227
|
|
228
|
-
should
|
229
|
-
@response.first.message_id
|
228
|
+
it "should have message_id for all messages" do
|
229
|
+
assert_equal @message_id, @response.first.message_id
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
|
233
|
+
describe "Response to check_number command with single phone" do
|
234
234
|
|
235
|
-
|
235
|
+
before do
|
236
236
|
@phone = random_phone
|
237
237
|
@price = rand
|
238
238
|
@country = random_string
|
@@ -245,22 +245,22 @@ class ResponseTest < Test::Unit::TestCase
|
|
245
245
|
@response = TextMagic::API::Response.check_number(@hash, true)
|
246
246
|
end
|
247
247
|
|
248
|
-
should
|
249
|
-
@response
|
248
|
+
it "should be an OpenStruct instance" do
|
249
|
+
assert_kind_of OpenStruct, @response
|
250
250
|
end
|
251
251
|
|
252
|
-
should
|
253
|
-
@response.price
|
252
|
+
it "should have price" do
|
253
|
+
assert_in_delta @response.price, @price, 1e-10
|
254
254
|
end
|
255
255
|
|
256
|
-
should
|
257
|
-
@
|
256
|
+
it "should have country" do
|
257
|
+
assert_equal @country, @response.country
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
261
|
-
|
261
|
+
describe "Response to check_number command with multiple phones" do
|
262
262
|
|
263
|
-
|
263
|
+
before do
|
264
264
|
@phone = random_phone
|
265
265
|
@price = rand
|
266
266
|
@country = random_string
|
@@ -273,24 +273,24 @@ class ResponseTest < Test::Unit::TestCase
|
|
273
273
|
@response = TextMagic::API::Response.check_number(@hash, false)
|
274
274
|
end
|
275
275
|
|
276
|
-
should
|
277
|
-
@response
|
276
|
+
it "should be a hash" do
|
277
|
+
assert_kind_of Hash, @response
|
278
278
|
end
|
279
279
|
|
280
|
-
should
|
281
|
-
|
280
|
+
it "should have phones as keys" do
|
281
|
+
assert_equal [@phone], @response.keys
|
282
282
|
end
|
283
283
|
|
284
|
-
should
|
285
|
-
@response.values.first
|
284
|
+
it "should contain OpenStruct instances" do
|
285
|
+
assert_kind_of OpenStruct, @response.values.first
|
286
286
|
end
|
287
287
|
|
288
|
-
should
|
289
|
-
@response.values.first.price
|
288
|
+
it "should have price for all phones" do
|
289
|
+
assert_in_delta @response.values.first.price, @price, 1e-10
|
290
290
|
end
|
291
291
|
|
292
|
-
should
|
293
|
-
@response.values.first.country
|
292
|
+
it "should have country for all phones" do
|
293
|
+
assert_equal @response.values.first.country, @country
|
294
294
|
end
|
295
295
|
end
|
296
296
|
end
|