test/subscriber_test.rb in createsend-5.0.0 vs test/subscriber_test.rb in createsend-5.1.0
- old
+ new
@@ -7,11 +7,11 @@
@subscriber = CreateSend::Subscriber.new @auth, @list_id, "subscriber@example.com"
end
should "get a subscriber by list id and email address" do
email = "subscriber@example.com"
- stub_get(@auth, "subscribers/#{@list_id}.json?email=#{CGI.escape(email)}&includetrackingpreference=false", "subscriber_details.json")
+ stub_get(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}&includetrackingpreference=false", "subscriber_details.json")
subscriber = CreateSend::Subscriber.get @auth, @list_id, email
subscriber.EmailAddress.should == email
subscriber.Name.should == "Subscriber One"
subscriber.Date.should == "2010-10-25 10:28:00"
subscriber.State.should == "Active"
@@ -21,11 +21,11 @@
subscriber.ReadsEmailWith.should == "Gmail"
end
should "get a subscriber with track preference information" do
email = "subscriber@example.com"
- stub_get(@auth, "subscribers/#{@list_id}.json?email=#{CGI.escape(email)}&includetrackingpreference=true", "subscriber_details_with_track_pref.json")
+ stub_get(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}&includetrackingpreference=true", "subscriber_details_with_track_pref.json")
subscriber = CreateSend::Subscriber.get @auth, @list_id, email, true
subscriber.EmailAddress.should == email
subscriber.Name.should == "Subscriber One"
subscriber.ConsentToTrack == "Yes"
end
@@ -53,20 +53,20 @@
end
should "update a subscriber with custom fields" do
email = "subscriber@example.com"
new_email = "new_email_address@example.com"
- stub_put(@auth, "subscribers/#{@list_id}.json?email=#{CGI.escape(email)}", nil)
+ stub_put(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}", nil)
custom_fields = [ { :Key => 'website', :Value => 'http://example.com/' } ]
@subscriber.update new_email, "Subscriber", custom_fields, true, "Yes"
@subscriber.email_address.should == new_email
end
should "update a subscriber with custom fields including the clear option" do
email = "subscriber@example.com"
new_email = "new_email_address@example.com"
- stub_put(@auth, "subscribers/#{@list_id}.json?email=#{CGI.escape(email)}", nil)
+ stub_put(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}", nil)
custom_fields = [ { :Key => 'website', :Value => '', :Clear => true } ]
@subscriber.update new_email, "Subscriber", custom_fields, true, "No"
@subscriber.email_address.should == new_email
end
@@ -150,11 +150,11 @@
stub_post(@auth, "subscribers/#{@subscriber.list_id}/unsubscribe.json", nil)
@subscriber.unsubscribe
end
should "get a subscriber's history" do
- stub_get(@auth, "subscribers/#{@subscriber.list_id}/history.json?email=#{CGI.escape(@subscriber.email_address)}", "subscriber_history.json")
+ stub_get(@auth, "subscribers/#{@subscriber.list_id}/history.json?email=#{ERB::Util.url_encode(@subscriber.email_address)}", "subscriber_history.json")
history = @subscriber.history
history.size.should == 1
history.first.Name.should == "Campaign One"
history.first.Type.should == "Campaign"
history.first.ID.should == "fc0ce7105baeaf97f47c99be31d02a91"
@@ -164,10 +164,10 @@
history.first.Actions.first.IPAddress.should == "192.168.126.87"
history.first.Actions.first.Detail.should == ""
end
should "delete a subscriber" do
- stub_delete(@auth, "subscribers/#{@subscriber.list_id}.json?email=#{CGI.escape(@subscriber.email_address)}", nil)
+ stub_delete(@auth, "subscribers/#{@subscriber.list_id}.json?email=#{ERB::Util.url_encode(@subscriber.email_address)}", nil)
@subscriber.delete
end
end
end
\ No newline at end of file