test/client_test.rb in createsend-0.0.1 vs test/client_test.rb in createsend-0.0.2
- old
+ new
@@ -15,10 +15,11 @@
end
should "get details of a client" do
stub_get(@api_key, "clients/#{@client.client_id}.json", "client_details.json")
cl = @client.details
+ cl.ApiKey.should == "639d8cc27198202f5fe6037a8b17a29a59984b86d3289bc9"
cl.BasicDetails.ClientID.should == "4a397ccaaa55eb4e6aa1221e1e2d7122"
cl.BasicDetails.ContactName.should == "Client One (contact)"
cl.AccessDetails.Username.should == "clientone"
cl.AccessDetails.AccessLevel.should == 23
end
@@ -26,11 +27,11 @@
should "get all campaigns" do
stub_get(@api_key, "clients/#{@client.client_id}/campaigns.json", "campaigns.json")
campaigns = @client.campaigns
campaigns.size.should == 2
campaigns.first.CampaignID.should == 'fc0ce7105baeaf97f47c99be31d02a91'
- campaigns.first.WebVersionURL.should == 'http://hello.createsend.com//t/ViewEmail/r/765E86829575EE2C/C67FD2F38AC4859C/'
+ campaigns.first.WebVersionURL.should == 'http://hello.createsend.com/t/ViewEmail/r/765E86829575EE2C/C67FD2F38AC4859C/'
campaigns.first.Subject.should == 'Campaign One'
campaigns.first.Name.should == 'Campaign One'
campaigns.first.SentDate.should == '2010-10-12 12:58:00'
campaigns.first.TotalRecipients.should == 2245
end
@@ -41,34 +42,43 @@
drafts.size.should == 2
drafts.first.CampaignID.should == '7c7424792065d92627139208c8c01db1'
drafts.first.Name.should == 'Draft One'
drafts.first.Subject.should == 'Draft One'
drafts.first.DateCreated.should == '2010-08-19 16:08:00'
+ drafts.first.PreviewURL.should == 'http://hello.createsend.com/t/ViewEmail/r/E97A7BB2E6983DA1/C67FD2F38AC4859C/'
end
should "get all lists" do
stub_get(@api_key, "clients/#{@client.client_id}/lists.json", "lists.json")
lists = @client.lists
lists.size.should == 2
lists.first.ListID.should == 'a58ee1d3039b8bec838e6d1482a8a965'
lists.first.Name.should == 'List One'
end
- should "get all segments" do
+ should "get all segments for a client" do
stub_get(@api_key, "clients/#{@client.client_id}/segments.json", "segments.json")
segments = @client.segments
segments.size.should == 2
segments.first.ListID.should == 'a58ee1d3039b8bec838e6d1482a8a965'
- segments.first.Name.should == 'Segment One'
+ segments.first.SegmentID.should == '46aa5e01fd43381863d4e42cf277d3a9'
+ segments.first.Title.should == 'Segment One'
end
should "get suppression list" do
- stub_get(@api_key, "clients/#{@client.client_id}/suppressionlist.json", "suppressionlist.json")
- sl = @client.suppressionlist
- sl.size.should == 2
- sl.first.EmailAddress.should == "subs+098u0qu0qwd@example.com"
- sl.first.Date.should == "2009-11-25 13:23:20"
- sl.first.State.should == "Suppressed"
+ stub_get(@api_key, "clients/#{@client.client_id}/suppressionlist.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc", "suppressionlist.json")
+ res = @client.suppressionlist
+ res.ResultsOrderedBy.should == "email"
+ res.OrderDirection.should == "asc"
+ res.PageNumber.should == 1
+ res.PageSize.should == 1000
+ res.RecordsOnThisPage.should == 5
+ res.TotalNumberOfRecords.should == 5
+ res.NumberOfPages.should == 1
+ res.Results.size.should == 5
+ res.Results.first.EmailAddress.should == "example+1@example.com"
+ res.Results.first.Date.should == "2010-10-26 10:55:31"
+ res.Results.first.State.should == "Suppressed"
end
should "get all templates" do
stub_get(@api_key, "clients/#{@client.client_id}/templates.json", "templates.json")
templates = @client.templates