spec/constantcontact/api_spec.rb in constantcontact-3.0.0 vs spec/constantcontact/api_spec.rb in constantcontact-4.0.0

- old
+ new

@@ -68,11 +68,11 @@ 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) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_account_info() result.should be_kind_of(ConstantContact::Components::AccountInfo) result.website.should eq('http://www.example.com') @@ -82,11 +82,11 @@ describe "#get_verified_email_addresses" do it "gets verified addresses for the 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) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) email_addresses = @api.get_verified_email_addresses() email_addresses.should be_kind_of(Array) @@ -98,11 +98,11 @@ describe "#get_contacts" do it "returns an array of contacts" do json_response = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) contacts = @api.get_contacts({:limit => 60}) contacts.should be_kind_of(ConstantContact::Components::ResultSet) contacts.results.first.should be_kind_of(ConstantContact::Components::Contact) @@ -113,11 +113,11 @@ describe "#get_contact" do it "returns a contact" do json_response = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) contact = @api.get_contact(1) contact.should be_kind_of(ConstantContact::Components::Contact) end @@ -126,11 +126,11 @@ describe "#get_contact_by_email" do it "returns a contact" do json_response = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) contacts = @api.get_contact_by_email('rmartone@systems.com') contacts.results.first.should be_kind_of(ConstantContact::Components::Contact) end @@ -139,11 +139,11 @@ describe "#add_contact" do it "adds a contact" do json_response = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_contact = ConstantContact::Components::Contact.create(JSON.parse(json_response)) contact = @api.add_contact(new_contact) contact.should be_kind_of(ConstantContact::Components::Contact) @@ -154,51 +154,51 @@ describe "#delete_contact" do it "deletes a contact" do contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_contact(contact_id) - result.should be_true + expect(result).to eq true end end describe "#delete_contact_from_lists" do it "deletes a contact" do contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_contact_from_lists(contact_id) - result.should be_true + expect(result).to eq true end end describe "#delete_contact_from_list" do it "deletes a contact" do contact_id = 196 list_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_contact_from_list(contact_id, list_id) - result.should be_true + expect(result).to eq true end end describe "#update_contact" do it "updates a contact" do json = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) contact = ConstantContact::Components::Contact.create(JSON.parse(json)) result = @api.update_contact(contact) result.should be_kind_of(ConstantContact::Components::Contact) @@ -209,11 +209,11 @@ describe "#get_lists" do it "returns an array of lists" do json_response = load_file('lists_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) lists = @api.get_lists() lists.should be_kind_of(Array) lists.first.should be_kind_of(ConstantContact::Components::ContactList) @@ -224,11 +224,11 @@ describe "#get_list" do it "returns a list" do json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) list = @api.get_list(1) list.should be_kind_of(ConstantContact::Components::ContactList) list.name.should eq('Monthly Specials') @@ -238,11 +238,11 @@ describe "#add_list" do it "adds a list" do json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_list = ConstantContact::Components::ContactList.create(JSON.parse(json)) list = @api.add_list(new_list) list.should be_kind_of(ConstantContact::Components::ContactList) @@ -253,11 +253,11 @@ describe "#update_list" do it "updates a list" do json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) list = ConstantContact::Components::ContactList.create(JSON.parse(json)) result = @api.update_list(list) result.should be_kind_of(ConstantContact::Components::ContactList) @@ -269,11 +269,11 @@ it "returns an array of contacts" do json_list = load_file('list_response.json') json_contacts = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_contacts, net_http_resp, {}, @request) + response = RestClient::Response.create(json_contacts, net_http_resp, @request) RestClient.stub(:get).and_return(response) list = ConstantContact::Components::ContactList.create(JSON.parse(json_list)) contacts = @api.get_contacts_from_list(list, "?limit=4&next=true") contacts.should be_kind_of(ConstantContact::Components::ResultSet) @@ -290,11 +290,11 @@ describe "#get_events" do it "returns an array of events" do json = load_file('events.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) events = @api.get_events() events.should be_kind_of(ConstantContact::Components::ResultSet) events.results.collect{|e| e.should be_kind_of(ConstantContact::Components::Event) } @@ -304,11 +304,11 @@ describe "#get_event" do it "returns an event" do json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = @api.get_event(1) event.should be_kind_of(ConstantContact::Components::Event) end @@ -317,11 +317,11 @@ describe "#add_event" do it "adds an event" do json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) added = @api.add_event(event) @@ -335,11 +335,11 @@ json = load_file('event.json') hash = JSON.parse json hash["status"] = "ACTIVE" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:patch).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) updated = @api.publish_event(event) updated.should be_kind_of(ConstantContact::Components::Event) @@ -353,11 +353,11 @@ json = load_file('event.json') hash = JSON.parse json hash["status"] = "CANCELLED" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:patch).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) updated = @api.cancel_event(event) updated.should be_kind_of(ConstantContact::Components::Event) @@ -370,11 +370,11 @@ it "returns an array of fees for an event" do event_json = load_file('event.json') fees_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(fees_json, net_http_resp, {}, @request) + response = RestClient::Response.create(fees_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fees = @api.get_event_fees(event) #fees.should be_kind_of(ConstantContact::Components::ResultSet) #fees.results.collect{|f| f.should be_kind_of(ConstantContact::Components::Fee) } @@ -388,11 +388,11 @@ it "return an event fee" do event_json = load_file('event.json') fee_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(fee_json, net_http_resp, {}, @request) + response = RestClient::Response.create(fee_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) retrieved = @api.get_event_fee(event, fee) @@ -404,11 +404,11 @@ it "adds an event fee" do event_json = load_file('event.json') fee_json = load_file('fee.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(fee_json, net_http_resp, {}, @request) + response = RestClient::Response.create(fee_json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) added = @api.add_event_fee(event, fee) @@ -423,11 +423,11 @@ fee_json = load_file('fee.json') hash = JSON.parse fee_json hash['fee'] += 1 net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) updated = @api.update_event_fee(event, fee) @@ -441,26 +441,26 @@ it "deletes an event fee" do event_json = load_file('event.json') fee_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) - @api.delete_event_fee(event, fee).should be_true + expect(@api.delete_event_fee(event, fee)).to eq true end end describe "#get_registrants" do it "returns an array of event registrants" do event_json = load_file('event.json') registrants_json = load_file('registrants.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(registrants_json, net_http_resp, {}, @request) + response = RestClient::Response.create(registrants_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) registrants = @api.get_event_registrants(event) registrants.should be_kind_of(ConstantContact::Components::ResultSet) @@ -472,11 +472,11 @@ it "returns an event registrant" do event_json = load_file('event.json') registrant_json = load_file('registrant.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(registrant_json, net_http_resp, {}, @request) + response = RestClient::Response.create(registrant_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) registrant = ConstantContact::Components::Registrant.create(JSON.parse(registrant_json)) retrieved = @api.get_event_registrant(event, registrant) @@ -488,11 +488,11 @@ describe "#get_event_items" do it "returns an array of event items" do json_response = load_file('event_items_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = @api.get_event_items(1) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::EventItem) @@ -503,11 +503,11 @@ describe "#get_event_item" do it "returns an event item" do json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_event_item(1, 1) result.should be_kind_of(ConstantContact::Components::EventItem) result.name.should eq('Running Belt') @@ -517,11 +517,11 @@ describe "#add_event_item" do it "adds an event item" do json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) result = @api.add_event_item(1, event_item) result.should be_kind_of(ConstantContact::Components::EventItem) @@ -531,24 +531,24 @@ describe "#delete_event_item" do it "deletes an event item" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_event_item(1, 1) - result.should be_true + expect(result).to eq true end end describe "#update_event_item" do it "updates an event item" do json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) result = @api.update_event_item(1, event_item) result.should be_kind_of(ConstantContact::Components::EventItem) @@ -559,11 +559,11 @@ describe "#get_event_item_attributes" do it "returns an array of event item attributes" do json_response = load_file('event_item_attributes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = @api.get_event_item_attributes(1, 1) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::EventItemAttribute) @@ -574,11 +574,11 @@ describe "#get_event_item_attribute" do it "returns an event item attribute" do json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_event_item_attribute(1, 1, 1) result.should be_kind_of(ConstantContact::Components::EventItemAttribute) result.name.should eq('Hi-Vis Green') @@ -588,11 +588,11 @@ describe "#add_event_item_attribute" do it "adds an event item attribute" do json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json)) result = @api.add_event_item_attribute(1, 1, event_item_attribute) result.should be_kind_of(ConstantContact::Components::EventItemAttribute) @@ -602,24 +602,24 @@ describe "#delete_event_item_attribute" do it "deletes an event item attribute" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_event_item_attribute(1, 1, 1) - result.should be_true + expect(result).to eq true end end describe "#update_event_item_attribute" do it "updates an event item attribute" do json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json)) result = @api.update_event_item_attribute(1, 1, event_item_attribute) result.should be_kind_of(ConstantContact::Components::EventItemAttribute) @@ -630,11 +630,11 @@ describe "#get_promocodes" do it "returns an array of promocodes" do json_response = load_file('promocodes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = @api.get_promocodes(1) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::Promocode) @@ -645,11 +645,11 @@ describe "#get_promocode" do it "returns a promocode" do json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_promocode(1, 1) result.should be_kind_of(ConstantContact::Components::Promocode) result.code_name.should eq('TOTAL_FEE') @@ -659,11 +659,11 @@ describe "#add_promocode" do it "adds a promocode" do json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) result = @api.add_promocode(1, promocode) result.should be_kind_of(ConstantContact::Components::Promocode) @@ -673,24 +673,24 @@ describe "#delete_promocode" do it "deletes a promocode" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_promocode(1, 1) - result.should be_true + expect(result).to eq true end end describe "#update_promocode" do it "updates an event item" do json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) result = @api.update_promocode(1, promocode) result.should be_kind_of(ConstantContact::Components::Promocode) @@ -701,11 +701,11 @@ describe "#get_email_campaigns" do it "gets a set of campaigns" do json_response = load_file('email_campaigns_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaigns = @api.get_email_campaigns({:limit => 2}) campaigns.should be_kind_of(ConstantContact::Components::ResultSet) campaigns.results.first.should be_kind_of(ConstantContact::Components::Campaign) @@ -716,11 +716,11 @@ describe "#get_email_campaign" do it "gets an individual campaign" do json_response = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaign = @api.get_email_campaign(1) campaign.should be_kind_of(ConstantContact::Components::Campaign) campaign.name.should eq('Campaign Name') @@ -730,11 +730,11 @@ describe "#get_email_campaign_preview" do it "gets the preview of an existing campaign" do json_response = load_file('email_campaign_preview_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaign_preview = @api.get_email_campaign_preview(1) campaign_preview.should be_kind_of(ConstantContact::Components::CampaignPreview) campaign_preview.subject.should eq('Subject Test') @@ -744,11 +744,11 @@ describe "#add_email_campaign" do it "creates a new campaign" do json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) campaign = @api.add_email_campaign(new_campaign) campaign.should be_kind_of(ConstantContact::Components::Campaign) @@ -759,25 +759,25 @@ describe "#delete_email_campaign" do it "deletes an individual campaign" do json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) result = @api.delete_email_campaign(campaign) - result.should be_true + expect(result).to eq true end end describe "#update_email_campaign" do it "updates a specific campaign" do json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) result = @api.update_email_campaign(campaign) result.should be_kind_of(ConstantContact::Components::Campaign) @@ -789,11 +789,11 @@ it "schedules a campaign to be sent" do campaign_id = 1 json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) schedule = @api.add_email_campaign_schedule(campaign_id, new_schedule) schedule.should be_kind_of(ConstantContact::Components::Schedule) @@ -805,11 +805,11 @@ it "gets an array of schedules associated with a given campaign" do campaign_id = 1 json = load_file('schedules_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) schedules = @api.get_email_campaign_schedules(campaign_id) schedules.first.should be_kind_of(ConstantContact::Components::Schedule) schedules.first.scheduled_date.should eq('2012-12-16T11:07:43.626Z') @@ -822,11 +822,11 @@ schedule_id = 1 json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) schedule = @api.get_email_campaign_schedule(campaign_id, schedule_id) schedule.should be_kind_of(ConstantContact::Components::Schedule) schedule.scheduled_date.should eq('2013-05-10T11:07:43.626Z') @@ -837,25 +837,25 @@ it "deletes a specific schedule associated with a given campaign" do campaign_id = 1 schedule_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_email_campaign_schedule(campaign_id, schedule_id) - result.should be_true + expect(result).to eq true end end describe "#update_email_campaign_schedule" do it "updates a specific schedule associated with a given campaign" do campaign_id = 1 json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) result = @api.update_email_campaign_schedule(campaign_id, schedule) result.should be_kind_of(ConstantContact::Components::Schedule) @@ -868,11 +868,11 @@ campaign_id = 1 json_request = load_file('test_send_request.json') json_response = load_file('test_send_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) test_send = ConstantContact::Components::TestSend.create(JSON.parse(json_request)) result = @api.send_email_campaign_test(campaign_id, test_send) result.should be_kind_of(ConstantContact::Components::TestSend) @@ -885,11 +885,11 @@ campaign_id = 1 params = {:limit => 5} json = load_file('campaign_tracking_bounces_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_bounces(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::BounceActivity) @@ -902,11 +902,11 @@ campaign_id = 1 params = {:limit => 5} json = load_file('campaign_tracking_clicks_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_clicks(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ClickActivity) @@ -919,11 +919,11 @@ campaign_id = 1 params = {:limit => 5} json = load_file('campaign_tracking_forwards_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_forwards(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ForwardActivity) @@ -936,11 +936,11 @@ campaign_id = 1 params = {:limit => 5} json = load_file('campaign_tracking_opens_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_opens(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::OpenActivity) @@ -953,11 +953,11 @@ campaign_id = 1 params = {:limit => 5} json = load_file('campaign_tracking_sends_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_sends(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::SendActivity) @@ -970,11 +970,11 @@ campaign_id = 1 params = {:limit => 5} json = load_file('campaign_tracking_unsubscribes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_unsubscribes(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::UnsubscribeActivity) @@ -986,11 +986,11 @@ it "gets a reporting summary for a campaign" do campaign_id = 1 json = load_file('campaign_tracking_summary_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) summary = @api.get_email_campaign_summary_report(campaign_id) summary.should be_kind_of(ConstantContact::Components::TrackingSummary) summary.sends.should eq(15) @@ -1002,11 +1002,11 @@ contact_id = 1 params = {:limit => 5} json = load_file('contact_tracking_bounces_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_bounces(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::BounceActivity) @@ -1019,11 +1019,11 @@ contact_id = 1 params = {:limit => 5} json = load_file('contact_tracking_clicks_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_clicks(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ClickActivity) @@ -1036,11 +1036,11 @@ contact_id = 1 params = {:limit => 5} json = load_file('contact_tracking_forwards_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_forwards(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ForwardActivity) @@ -1053,11 +1053,11 @@ contact_id = 1 params = {:limit => 5} json = load_file('contact_tracking_opens_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_opens(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::OpenActivity) @@ -1070,11 +1070,11 @@ contact_id = 1 params = {:limit => 5} json = load_file('contact_tracking_sends_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_sends(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::SendActivity) @@ -1087,11 +1087,11 @@ contact_id = 1 params = {:limit => 5} json = load_file('contact_tracking_unsubscribes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_unsubscribes(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::UnsubscribeActivity) @@ -1103,11 +1103,11 @@ it "gets a reporting summary for a Contact" do contact_id = 1 json = load_file('contact_tracking_summary_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) summary = @api.get_contact_summary_report(contact_id) summary.should be_kind_of(ConstantContact::Components::TrackingSummary) summary.sends.should eq(15) @@ -1117,11 +1117,11 @@ describe "#get_activities" do it "gets an array of activities" do json_response = load_file('activities_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) activities = @api.get_activities() activities.first.should be_kind_of(ConstantContact::Components::Activity) activities.first.type.should eq('REMOVE_CONTACTS_FROM_LISTS') @@ -1131,11 +1131,11 @@ describe "#update_email_campaign" do it "updates a specific campaign" do json_response = load_file('activity_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) activity = @api.get_activity('a07e1ilbm7shdg6ikeo') activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS') @@ -1146,11 +1146,11 @@ it "adds an AddContacts activity to add contacts in bulk" do json_request = load_file('add_contacts_request.json') json_response = load_file('add_contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) contacts = [] # first contact @@ -1237,11 +1237,11 @@ content = load_file('add_contacts_request.csv') json = load_file('add_contacts_response.json') lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = @api.add_create_contacts_activity_from_file('contacts.txt', content, lists) activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('ADD_CONTACTS') @@ -1256,11 +1256,11 @@ lists = [] lists << ConstantContact::Components::ContactList.create(JSON.parse(json_list)) net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_clear_lists, net_http_resp, {}, @request) + response = RestClient::Response.create(json_clear_lists, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = @api.add_clear_lists_activity(lists) activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('CLEAR_CONTACTS_FROM_LISTS') @@ -1271,11 +1271,11 @@ it "adds a Remove Contacts From Lists Activity" do json = load_file('remove_contacts_response.json') lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) email_addresses = ["djellesma@constantcontact.com"] activity = @api.add_remove_contacts_from_lists_activity( email_addresses, lists) @@ -1289,11 +1289,11 @@ content = load_file('remove_contacts_request.txt') json = load_file('remove_contacts_response.json') lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = @api.add_remove_contacts_from_lists_activity_from_file('contacts.txt', content, lists) activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS') @@ -1304,11 +1304,11 @@ it "creates an Export Contacts Activity" do json_request = load_file('export_contacts_request.json') json_response = load_file('export_contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) export_contacts = ConstantContact::Components::ExportContacts.new(JSON.parse(json_request)) activity = @api.add_export_contacts_activity(export_contacts) activity.should be_kind_of(ConstantContact::Components::Activity) @@ -1319,11 +1319,11 @@ describe "#get_library_info" do it "retrieves a MyLibrary usage information" do json_response = load_file('library_info_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) info = @api.get_library_info() info.should be_kind_of(ConstantContact::Components::LibrarySummary) info.usage_summary['folder_count'].should eq(6) @@ -1333,11 +1333,11 @@ describe "#get_library_folders" do it "retrieves a list of MyLibrary folders" do json_response = load_file('library_folders_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) folders = @api.get_library_folders({:limit => 2}) folders.should be_kind_of(ConstantContact::Components::ResultSet) folders.results.first.should be_kind_of(ConstantContact::Components::LibraryFolder) @@ -1348,11 +1348,11 @@ describe "#add_library_folder" do it "creates a new MyLibrary folder" do json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) folder = @api.add_library_folder(new_folder) folder.should be_kind_of(ConstantContact::Components::LibraryFolder) @@ -1363,11 +1363,11 @@ describe "#get_library_folder" do it "retrieves a specific MyLibrary folder using the folder_id path parameter" do json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) folder = @api.get_library_folder(6) folder.should be_kind_of(ConstantContact::Components::LibraryFolder) folder.name.should eq('wildflowers') @@ -1377,11 +1377,11 @@ describe "#update_library_folder" do it "retrieves a specific MyLibrary folder using the folder_id path parameter" do json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) response = @api.update_library_folder(folder) response.should be_kind_of(ConstantContact::Components::LibraryFolder) @@ -1392,24 +1392,24 @@ describe "#delete_library_folder" do it "deletes a MyLibrary folder" do folder_id = 6 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_library_folder(folder_id) - result.should be_true + expect(result).to eq true end end describe "#get_library_trash" do it "retrieve all files in the Trash folder" do json = load_file('library_trash_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_trash({:sort_by => 'SIZE_DESC'}) files.should be_kind_of(ConstantContact::Components::ResultSet) files.results.first.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1419,24 +1419,24 @@ describe "#delete_library_trash" do it "permanently deletes all files in the Trash folder" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_library_trash() - result.should be_true + expect(result).to eq true end end describe "#get_library_files" do it "retrieves a collection of MyLibrary files in the Constant Contact account" do json_response = load_file('library_files_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_files({:type => 'ALL'}) files.should be_kind_of(ConstantContact::Components::ResultSet) files.results.first.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1448,11 +1448,11 @@ it "retrieves a collection of MyLibrary files in the Constant Contact account" do folder_id = -1 json_response = load_file('library_files_by_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_files_by_folder(folder_id, {:limit => 10}) files.should be_kind_of(ConstantContact::Components::ResultSet) files.results.first.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1463,11 +1463,11 @@ describe "#get_library_file" do it "retrieve a MyLibrary file using the file_id path parameter" do json = load_file('library_file_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) file = @api.get_library_file(6) file.should be_kind_of(ConstantContact::Components::LibraryFile) file.name.should eq('IMG_0261.JPG') @@ -1483,11 +1483,11 @@ file_type = 'JPG' contents = load_file('logo.jpg') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') net_http_resp.add_field('Location', '"https://api.d1.constantcontact.com/v2/library/files/123456789') - response = RestClient::Response.create("", net_http_resp, {}, @request) + response = RestClient::Response.create("", net_http_resp, @request) RestClient.stub(:post).and_return(response) response = @api.add_library_file(file_name, folder_id, description, source, file_type, contents) response.should be_kind_of(String) response.should eq('123456789') @@ -1497,11 +1497,11 @@ describe "#update_library_file" do it "updates information for a specific MyLibrary file" do json = load_file('library_file_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) file = ConstantContact::Components::LibraryFile.create(JSON.parse(json)) response = @api.update_library_file(file) response.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1512,25 +1512,25 @@ describe "#delete_library_file" do it "deletes one or more MyLibrary files specified by the fileId path parameter" do file_id = '6, 7' net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_library_file(file_id) - result.should be_true + expect(result).to eq true end end describe "#get_library_files_upload_status" do it "retrieves the upload status for one or more MyLibrary files using the file_id path parameter" do file_id = '6, 7' json = load_file('library_files_upload_status_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) statuses = @api.get_library_files_upload_status(file_id) statuses.should be_kind_of(Array) statuses.first.should be_kind_of(ConstantContact::Components::UploadStatus) @@ -1543,10 +1543,10 @@ folder_id = 1 file_id = '8, 9' json = load_file('library_files_move_results_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) results = @api.move_library_files(folder_id, file_id) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::MoveResults) \ No newline at end of file