Sha256: 7282bad5cb9be4ec9b2b213310682b17c82a5f38d85dcbaae7054596f30fb975

Contents?: true

Size: 1.78 KB

Versions: 6

Compression:

Stored size: 1.78 KB

Contents

#
# account_service_spec.rb
# ConstantContact
#
# Copyright (c) 2013 Constant Contact. All rights reserved.

require 'spec_helper'

describe ConstantContact::Services::AccountService do
  before(:each) do
    @request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
  end

  describe "#get_account_info" do
    it "gets a summary of account information" do
      json_response = load_file('account_info_response.json')
      net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')

      response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
      RestClient.stub(:get).and_return(response)

      result = ConstantContact::Services::AccountService.get_account_info()
      result.should be_kind_of(ConstantContact::Components::AccountInfo)
      result.website.should eq('http://www.example.com')
      result.organization_addresses.first.should be_kind_of(ConstantContact::Components::AccountAddress)
      result.organization_addresses.first.city.should eq('Anytown')
    end
  end

  describe "#get_verified_email_addresses" do
    it "gets all verified email addresses associated with an account" do
      json_response = load_file('verified_email_addresses_response.json')
      net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')

      response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
      RestClient.stub(:get).and_return(response)

      params = {}
      email_addresses = ConstantContact::Services::AccountService.get_verified_email_addresses(params)

      email_addresses.should be_kind_of(Array)
      email_addresses.first.should be_kind_of(ConstantContact::Components::VerifiedEmailAddress)
      email_addresses.first.email_address.should eq('abc@def.com')
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
constantcontact-2.2.1 spec/constantcontact/services/account_service_spec.rb
constantcontact-ruby-2.2.1 spec/constantcontact/services/account_service_spec.rb
constantcontact-ruby-2.2.0 spec/constantcontact/services/account_service_spec.rb
constantcontact-2.2.0 spec/constantcontact/services/account_service_spec.rb
constantcontact-2.1.0 spec/constantcontact/services/account_service_spec.rb
constantcontact-2.0.1 spec/constantcontact/services/account_service_spec.rb