Sha256: 1e130b5eb16ef4f8824c2ae6c18bff580588ec88014e703735c2655922dc1135
Contents?: true
Size: 1.36 KB
Versions: 8
Compression:
Stored size: 1.36 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Rentjuicer::Lead do before do @rentjuicer = new_rentjuicer @lead = Rentjuicer::Lead.new(@rentjuicer) end context "a successfull creation" do before do mock_get(@lead.resource, 'lead.json', :name => 'Tom Cocca') end it "should not return an error on create" do lambda { @lead.create('Tom Cocca') }.should_not raise_exception end it "should not return an error on create!" do lambda { @lead.create!('Tom Cocca') }.should_not raise_exception end it "should be a success?" do @response = @lead.create('Tom Cocca') @response.success?.should be_true end end context "unsucessful submission" do before do mock_get(@lead.resource, 'lead_error.json', :name => '') end it "should return an error on create!" do lambda { @lead.create!('') }.should raise_exception(Rentjuicer::Error, "Rentjuicer Error: invalid parameter - `name` is required (code: 3)") end it "should not return an error on create" do lambda { @lead.create('') }.should_not raise_exception end it "should not be a successful submission on create" do @result = @lead.create('') @result.success?.should be_false end end end
Version data entries
8 entries across 8 versions & 1 rubygems