Sha256: 6ff3edc41daab0bdae7454ca530c97e26f289bcda2f0f22bccd36721d8e5d74c

Contents?: true

Size: 1.51 KB

Versions: 10

Compression:

Stored size: 1.51 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe YouGotListed::Lead do
  
  before do
    @ygl = new_ygl
    @lead = YouGotListed::Lead.new(@ygl)
    @success_params = {:first_name => "You", :last_name => "GotListed", :email => "ygl@gmail.com"}
    @failed_params = {}
  end
  
  context "create" do
    context "a successful creation" do
      it "should not raise an exception" do
        lambda {
          VCR.use_cassette('lead.create.error') do
            @response = @lead.create(@success_params)
          end
        }.should_not raise_exception
      end
    end
    
    context "a failed creation" do
      it "should raise an exception" do
        lambda {
          VCR.use_cassette('lead.create.error') do
            @response = @lead.create(@failed_params)
          end
        }.should_not raise_exception
      end
    end
  end
  
  context "create!" do
    context "a successful creation" do
      it "should not raise an exception" do
        lambda {
          VCR.use_cassette('lead.create.error') do
            @response = @lead.create!(@success_params)
          end
        }.should_not raise_exception
      end
    end
    
    context "a failed creation" do
      it "should raise an exception" do
        lambda {
          VCR.use_cassette('lead.create.error') do
            @response = @lead.create!(@failed_params)
          end
        }.should raise_exception(YouGotListed::Error, "YouGotListed Error: Lead first name not specified. (code: 303)")
      end
    end
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
you_got_listed-0.3.3 spec/you_got_listed/lead_spec.rb
you_got_listed-0.3.2 spec/you_got_listed/lead_spec.rb
you_got_listed-0.3.1 spec/you_got_listed/lead_spec.rb
you_got_listed-0.3.0 spec/you_got_listed/lead_spec.rb
you_got_listed-0.2.5 spec/you_got_listed/lead_spec.rb
you_got_listed-0.2.4 spec/you_got_listed/lead_spec.rb
you_got_listed-0.2.3 spec/you_got_listed/lead_spec.rb
you_got_listed-0.2.2 spec/you_got_listed/lead_spec.rb
you_got_listed-0.2.1 spec/you_got_listed/lead_spec.rb
you_got_listed-0.2.0 spec/you_got_listed/lead_spec.rb