spec/smsified_spec.rb in smsified-0.1.6 vs spec/smsified_spec.rb in smsified-0.1.7
- old
+ new
@@ -116,19 +116,19 @@
end
it "Should send an SMS" do
response = @one_api.send_sms(:address => @address, :message => 'Hola from RSpec!', :sender_address => @sender_address)
response.data.should eql @message_sent
- FakeWeb.last_request.body.should eql "message=Hola+from+RSpec%21&address=14155551212"
+ FakeWeb.last_request.body.should eql "address=14155551212&message=Hola+from+RSpec%21"
end
it "Should send an SMS to multiple destinations" do
response = @one_api.send_sms(:address => ['14155551212', '13035551212'],
:message => 'Hola from RSpec!',
:sender_address => @sender_address)
response.data.should eql @message_sent
- FakeWeb.last_request.body.should eql "message=Hola+from+RSpec%21&address=14155551212&address=13035551212"
+ FakeWeb.last_request.body.should eql "address=14155551212&address=13035551212&message=Hola+from+RSpec%21"
end
it "Should raise an error if you pass an unknown method name" do
begin
@one_api.foobar
@@ -401,12 +401,13 @@
"https://#{@username}:#{@password}@api.smsified.com/v1/messages/74ae6147f915eabf87b35b9ea30c5916",
:status => ["200", "OK"],
:body => @message.to_json)
FakeWeb.register_uri(:get,
- "https://#{@username}:#{@password}@api.smsified.com/v1/messages?startDate=2011-05-12&endDate=2011-05-12",
+ "https://#{@username}:#{@password}@api.smsified.com/v1/messages?start=2011-05-12&end=2011-05-12",
:status => ["200", "OK"],
+ :content_type=>"application/json",
:body => @message_range.to_json)
FakeWeb.register_uri(:get,
"https://#{@username}:#{@password}@api.smsified.com/v1/smsmessaging/outbound/#{@sender_address}/requests/795bd02c8e343b2dfd673b67dd0ee55a/deliveryInfos",
:status => ["200", "OK"],
@@ -436,10 +437,15 @@
rescue => e
e.to_s.should eql ':password required'
end
end
+ it "should get json by default" do
+ response = @reporting.search_sms 'start=2011-05-12&end=2011-05-12'
+ response.http.content_type.should eql "application/json"
+ end
+
it "Should raise an error if no :sender_address specified" do
begin
@reporting.delivery_status('foobar')
rescue => e
e.to_s.should eql 'an options Hash is required'
@@ -462,10 +468,10 @@
response = @reporting.retrieve_sms '74ae6147f915eabf87b35b9ea30c5916'
response.data.should eql @message
end
it "Should retrieve SMS messages based on a query string" do
- response = @reporting.search_sms 'startDate=2011-05-12&endDate=2011-05-12'
+ response = @reporting.search_sms 'start=2011-05-12&end=2011-05-12'
response.data.should eql @message_range
end
it "Should send an SMS and get the Delivery status" do
delivery_response = @reporting.delivery_status :request_id => '795bd02c8e343b2dfd673b67dd0ee55a', :sender_address => @sender_address