spec/constantcontact/services/account_service_spec.rb in constantcontact-2.2.1 vs spec/constantcontact/services/account_service_spec.rb in constantcontact-3.0.0
- old
+ new
@@ -7,21 +7,22 @@
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)
+ @client = ConstantContact::Api.new('explicit_api_key', "access_token")
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 = ConstantContact::Services::AccountService.new(@client).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
@@ -34,10 +35,10 @@
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 = ConstantContact::Services::AccountService.new(@client).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
\ No newline at end of file