Sha256: 0057164fdaa8a6b8cdb0afe26401f6e6109b1d30f14ceb337a9f49f8670f7dc1

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

module SmsNotify
  describe "Api" do
    before(:each) do
      @api = Api.new('key')
    end

    it "should return a default endpoint url" do
      Api.endpoint_host.should be_a String
    end

    it "should have a license key method after initialized" do
      @api.license_key.should == 'key'
    end

    it "should respond to send_message" do
      @api.respond_to?('send_message').should be true
    end

    describe "Api Command" do
      before(:each) do
        @command = Api::Command.new('cmdname', 'key')
      end
    
      it "should return an encoded url for the requested command and parameters" do
        url = @command.build_url(:fu => 'bar', :sna => 'fu')
        url.should == URI.parse('https://ws.cdyne.com/SmsWs/SMS.asmx/cmdname?LicenseKey=key&fu=bar&sna=fu')
      end

      it "should return an encoded url with invalid url characters escaped" do
        url = @command.build_url(:fu => 'b a r', :sna => 'f&u')
        url.should == URI.parse('https://ws.cdyne.com/SmsWs/SMS.asmx/cmdname?LicenseKey=key&fu=b+a+r&sna=f%26u')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cdyne-sms-notify-0.8.4 spec/api_spec.rb
cdyne-sms-notify-0.8.3 spec/api_spec.rb
cdyne-sms-notify-0.8.1 spec/api_spec.rb
cdyne-sms-notify-0.8.0 spec/api_spec.rb
cdyne-sms-notify-0.7.1 spec/api_spec.rb
cdyne-sms-notify-0.7.0 spec/api_spec.rb