test/test_response.rb in textmagic-0.6.0 vs test/test_response.rb in textmagic-0.7.0
- old
+ new
@@ -20,11 +20,12 @@
end
describe "Response to send command with single phone number" do
before do
- @message_id, @phone = random_string, random_phone
+ @message_id = random_string
+ @phone = random_phone
@text = random_string
@parts_count = 1 + rand(3)
@hash = { "message_id" => { @message_id => @phone }, "sent_text" => @text, "parts_count" => @parts_count }
@response = TextMagic::API::Response.send(@hash, true)
end
@@ -43,12 +44,14 @@
end
describe "Response to send command with multiple phone numbers" do
before do
- @message_id1, @phone1 = random_string, random_phone
- @message_id2, @phone2 = random_string, random_phone
+ @message_id1 = random_string
+ @phone1 = random_phone
+ @message_id2 = random_string
+ @phone2 = random_phone
@text = random_string
@parts_count = 1 + rand(3)
@hash = { "message_id" => { @message_id1 => @phone1, @message_id2 => @phone2 }, "sent_text" => @text, "parts_count" => @parts_count }
@response = TextMagic::API::Response.send(@hash, false)
end
@@ -89,12 +92,12 @@
"text" => @text,
"status" => @status,
"created_time" => @created_time.to_s,
"reply_number" => @reply_number,
"completed_time" => @completed_time.to_s,
- "credits_cost" => @credits_cost
- }
+ "credits_cost" => @credits_cost,
+ },
}
@response = TextMagic::API::Response.message_status(@hash, true)
end
it "should equal to the message status" do
@@ -140,12 +143,12 @@
"text" => @text,
"status" => @status,
"created_time" => @created_time,
"reply_number" => @reply_number,
"completed_time" => @completed_time,
- "credits_cost" => @credits_cost
- }
+ "credits_cost" => @credits_cost,
+ },
}
@response = TextMagic::API::Response.message_status(@hash, false)
end
it "should be a hash" do
@@ -187,16 +190,18 @@
describe "Response to receive command" do
before do
@timestamp = (Time.now - 30).to_i
- @text, @phone, @message_id = random_string, random_phone, random_string
+ @text = random_string
+ @phone = random_phone
+ @message_id = random_string
@message = {
"timestamp" => @timestamp,
"from" => @phone,
"text" => @text,
- "message_id" => @message_id
+ "message_id" => @message_id,
}
@unread = rand(1e4)
@hash = { "unread" => @unread, "messages" => [@message] }
@response = TextMagic::API::Response.receive(@hash)
end
@@ -237,12 +242,12 @@
@price = rand
@country = random_string
@hash = {
@phone => {
"price" => @price,
- "country" => @country
- }
+ "country" => @country,
+ },
}
@response = TextMagic::API::Response.check_number(@hash, true)
end
it "should be an OpenStruct instance" do
@@ -265,11 +270,11 @@
@price = rand
@country = random_string
@hash = {
@phone => {
"price" => @price,
- "country" => @country
- }
+ "country" => @country,
+ },
}
@response = TextMagic::API::Response.check_number(@hash, false)
end
it "should be a hash" do