spec/constantcontact/services/event_spot_spec.rb in constantcontact-3.0.0 vs spec/constantcontact/services/event_spot_spec.rb in constantcontact-4.0.0
- old
+ new
@@ -15,11 +15,11 @@
describe "#get_events" do
it "returns a set 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 = ConstantContact::Services::EventSpotService.new(@client).get_events()
events.should be_kind_of(ConstantContact::Components::ResultSet)
events.results.collect{|e| e.should be_kind_of(ConstantContact::Components::Event) }
end
@@ -28,11 +28,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 = ConstantContact::Services::EventSpotService.new(@client).get_event(1)
event.should be_kind_of(ConstantContact::Components::Event)
end
@@ -41,11 +41,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 = ConstantContact::Services::EventSpotService.new(@client).add_event(event)
added.should respond_to(:id)
@@ -58,11 +58,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 = ConstantContact::Services::EventSpotService.new(@client).publish_event(event)
updated.should be_kind_of(ConstantContact::Components::Event)
@@ -76,11 +76,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 = ConstantContact::Services::EventSpotService.new(@client).cancel_event(event)
updated.should be_kind_of(ConstantContact::Components::Event)
@@ -93,11 +93,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 = ConstantContact::Services::EventSpotService.new(@client).get_fees(event)
#fees.should be_kind_of(ConstantContact::Components::ResultSet)
#fees.results.collect{|f| f.should be_kind_of(ConstantContact::Components::Fee) }
@@ -111,11 +111,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 = ConstantContact::Services::EventSpotService.new(@client).get_fee(event, fee)
@@ -127,11 +127,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 = ConstantContact::Services::EventSpotService.new(@client).add_fee(event, fee)
@@ -146,11 +146,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 = ConstantContact::Services::EventSpotService.new(@client).update_fee(event, fee)
@@ -164,26 +164,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))
- ConstantContact::Services::EventSpotService.new(@client).delete_fee(event, fee).should be_true
+ expect(ConstantContact::Services::EventSpotService.new(@client).delete_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 = ConstantContact::Services::EventSpotService.new(@client).get_registrants(event)
registrants.should be_kind_of(ConstantContact::Components::ResultSet)
@@ -195,11 +195,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 = ConstantContact::Services::EventSpotService.new(@client).get_registrant(event, registrant)
@@ -211,11 +211,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 = ConstantContact::Services::EventSpotService.new(@client).get_event_items(1)
results.should be_kind_of(Array)
results.first.should be_kind_of(ConstantContact::Components::EventItem)
@@ -226,11 +226,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 = ConstantContact::Services::EventSpotService.new(@client).get_event_item(1, 1)
result.should be_kind_of(ConstantContact::Components::EventItem)
result.name.should eq('Running Belt')
@@ -240,11 +240,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 = ConstantContact::Services::EventSpotService.new(@client).add_event_item(1, event_item)
result.should be_kind_of(ConstantContact::Components::EventItem)
@@ -254,24 +254,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 = ConstantContact::Services::EventSpotService.new(@client).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 = ConstantContact::Services::EventSpotService.new(@client).update_event_item(1, event_item)
result.should be_kind_of(ConstantContact::Components::EventItem)
@@ -282,11 +282,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 = ConstantContact::Services::EventSpotService.new(@client).get_event_item_attributes(1, 1)
results.should be_kind_of(Array)
results.first.should be_kind_of(ConstantContact::Components::EventItemAttribute)
@@ -297,11 +297,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 = ConstantContact::Services::EventSpotService.new(@client).get_event_item_attribute(1, 1, 1)
result.should be_kind_of(ConstantContact::Components::EventItemAttribute)
result.name.should eq('Hi-Vis Green')
@@ -311,11 +311,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 = ConstantContact::Services::EventSpotService.new(@client).add_event_item_attribute(1, 1, event_item_attribute)
result.should be_kind_of(ConstantContact::Components::EventItemAttribute)
@@ -325,24 +325,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 = ConstantContact::Services::EventSpotService.new(@client).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 = ConstantContact::Services::EventSpotService.new(@client).update_event_item_attribute(1, 1, event_item_attribute)
result.should be_kind_of(ConstantContact::Components::EventItemAttribute)
@@ -353,11 +353,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 = ConstantContact::Services::EventSpotService.new(@client).get_promocodes(1)
results.should be_kind_of(Array)
results.first.should be_kind_of(ConstantContact::Components::Promocode)
@@ -368,11 +368,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 = ConstantContact::Services::EventSpotService.new(@client).get_promocode(1, 1)
result.should be_kind_of(ConstantContact::Components::Promocode)
result.code_name.should eq('TOTAL_FEE')
@@ -382,11 +382,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 = ConstantContact::Services::EventSpotService.new(@client).add_promocode(1, promocode)
result.should be_kind_of(ConstantContact::Components::Promocode)
@@ -396,23 +396,23 @@
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 = ConstantContact::Services::EventSpotService.new(@client).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 = ConstantContact::Services::EventSpotService.new(@client).update_promocode(1, promocode)
result.should be_kind_of(ConstantContact::Components::Promocode)
\ No newline at end of file