spec/integration/pricing/v1/messaging/country_spec.rb in twilio-ruby-5.0.0.rc18 vs spec/integration/pricing/v1/messaging/country_spec.rb in twilio-ruby-5.0.0.rc19

- old
+ new

@@ -1,41 +1,137 @@ ## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 -# / / +# / / require 'spec_helper.rb' describe 'Country' do it "can read" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) - + expect { @client.pricing.v1.messaging \ .countries.list() }.to raise_exception(Twilio::REST::TwilioException) - + values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://pricing.twilio.com/v1/Messaging/Countries', ))).to eq(true) end + it "receives read_empty responses" do + @holodeck.mock(Twilio::TwilioResponse.new( + 200, + %q[ + { + "countries": [], + "meta": { + "first_page_url": "https://pricing.twilio.com/v1/Messaging/Countries?Page=0&PageSize=50", + "key": "countries", + "next_page_url": null, + "page": 0, + "page_size": 0, + "previous_page_url": null, + "url": "https://pricing.twilio.com/v1/Messaging/Countries" + } + } + ] + )) + + actual = @client.pricing.v1.messaging \ + .countries.list() + + expect(actual).to_not eq(nil) + end + + it "receives read_full responses" do + @holodeck.mock(Twilio::TwilioResponse.new( + 200, + %q[ + { + "countries": [ + { + "country": "country", + "iso_country": "US", + "url": "http://www.example.com" + } + ], + "meta": { + "first_page_url": "https://pricing.twilio.com/v1/Messaging/Countries?Page=0&PageSize=50", + "key": "countries", + "next_page_url": null, + "page": 0, + "page_size": 1, + "previous_page_url": null, + "url": "https://pricing.twilio.com/v1/Messaging/Countries" + } + } + ] + )) + + actual = @client.pricing.v1.messaging \ + .countries.list() + + expect(actual).to_not eq(nil) + end + it "can fetch" do @holodeck.mock(Twilio::TwilioResponse.new(500, '')) - + expect { @client.pricing.v1.messaging \ .countries("US").fetch() }.to raise_exception(Twilio::REST::TwilioException) - + values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://pricing.twilio.com/v1/Messaging/Countries/US', ))).to eq(true) + end + + it "receives fetch responses" do + @holodeck.mock(Twilio::TwilioResponse.new( + 200, + %q[ + { + "country": "country", + "inbound_sms_prices": [ + { + "base_price": 0.05, + "current_price": 0.05, + "number_type": "mobile" + } + ], + "iso_country": "US", + "outbound_sms_prices": [ + { + "carrier": "att", + "mcc": "foo", + "mnc": "bar", + "prices": [ + { + "base_price": 0.05, + "current_price": 0.05, + "number_type": "mobile" + } + ] + } + ], + "price_unit": "USD", + "url": "http://www.example.com" + } + ] + )) + + actual = @client.pricing.v1.messaging \ + .countries("US").fetch() + + expect(actual).to_not eq(nil) end end \ No newline at end of file