Sha256: 8ffe6d455d328388feaa1f731f03405a44944ad5af5a1a8d18a11364d1fa89f1
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true require 'spec_helper' require 'sms77/resources/voice' RSpec.describe Sms77, 'voice' do def assert_response(response) expect(response).to be_a(String) code, id, cost = response.split("\n") expect(Integer(code)).to be_an_instance_of(Integer) expect(id.to_f).to be_an_instance_of(Float) if id != '' expect(cost.to_f).to be_an_instance_of(Float) end def request(text, extra_params = {}) stub = <<~TEXT 301 0.1 TEXT params = { from: Helper::VIRTUAL_INBOUNDS[:eplus], text: text, to: Helper::VIRTUAL_INBOUNDS[:eplus] }.merge(extra_params) helper = Helper.new(Sms77::Resources::Voice) assert_response(helper.request(helper.resource.method(:send), stub, params)) end it 'calls a number with text input' do request('Your glasses are ready for pickup.') end it 'calls a number with xml input' do text = <<~XML <?xml version="1.0" encoding="UTF-8"?> <Response> <Say voice="woman" language="en-EN"> Your glasses are ready for pickup. </Say> <Record maxlength="20" /> </Response> XML request(text, { xml: true }) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sms77-0.5.0 | spec/sms77/voice_spec.rb |