Sha256: 4a81c198d580fd26a5f4ff6a9c99fbeaf22ec5d0fb9bb60d0754bd9b15628f06

Contents?: true

Size: 1.54 KB

Versions: 15

Compression:

Stored size: 1.54 KB

Contents

require File.dirname(__FILE__) + '/helper'

class TemplateTest < Test::Unit::TestCase
  context "when an api caller is authenticated" do
    setup do
      @api_key = '123123123123123123123'
      CreateSend.api_key @api_key
      @template = CreateSend::Template.new('98y2e98y289dh89h938389')
    end

    should "create a template" do
      client_id = '87y8d7qyw8d7yq8w7ydwqwd'
      stub_post(@api_key, "templates/#{client_id}.json", "create_template.json")
      template_id = CreateSend::Template.create client_id, "Template One", "http://templates.org/index.html", 
        "http://templates.org/files.zip"
      template_id.should == "98y2e98y289dh89h938389"
    end

    should "get details of a template" do
      stub_get(@api_key, "templates/#{@template.template_id}.json", "template_details.json")
      t = @template.details
      t.TemplateID.should == "98y2e98y289dh89h938389"
      t.Name.should == "Template One"
      t.PreviewURL.should == "http://preview.createsend.com/createsend/templates/previewTemplate.aspx?ID=01AF532CD8889B33&d=r&c=E816F55BFAD1A753"
      t.ScreenshotURL.should == "http://preview.createsend.com/ts/r/14/833/263/14833263.jpg?0318092600"
    end

    should "update a template" do
      stub_put(@api_key, "templates/#{@template.template_id}.json", nil)
      @template.update "Template One Updated", "http://templates.org/index.html", "http://templates.org/files.zip"
    end

    should "delete a template" do
      stub_delete(@api_key, "templates/#{@template.template_id}.json", nil)
      @template.delete
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
createsend-2.5.1 test/template_test.rb
createsend-2.5.0 test/template_test.rb
createsend-2.4.0 test/template_test.rb
createsend-2.3.0 test/template_test.rb
createsend-2.2.0 test/template_test.rb
createsend-2.1.0 test/template_test.rb
createsend-2.0.0 test/template_test.rb
createsend-1.1.1 test/template_test.rb
createsend-1.1.0 test/template_test.rb
createsend-1.0.4 test/template_test.rb
createsend-1.0.3 test/template_test.rb
createsend-1.0.2 test/template_test.rb
createsend-1.0.1 test/template_test.rb
createsend-1.0.0 test/template_test.rb
createsend-0.3.2 test/template_test.rb