require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe Pardot::Objects::Prospects do
before do
@client = create_client
end
describe "query" do
def sample_results
%(
2
Jim
Smith
Sue
Green
)
end
it "should take in some arguments" do
fake_get "/api/prospect/version/3/do/query?assigned=true&format=simple&user_key=bar&api_key=my_api_key", sample_results
@client.prospects.query(:assigned => true).should == {"total_results" => 2,
"prospect"=>[
{"last_name"=>"Smith", "first_name"=>"Jim"},
{"last_name"=>"Green", "first_name"=>"Sue"}
]}
end
end
describe "create" do
def sample_results
%(
Jim
Smith
)
end
it "should return the prospect" do
fake_post "/api/prospect/version/3/do/create/email/user@test.com?api_key=my_api_key&user_key=bar&format=simple&first_name=Jim", sample_results
@client.prospects.create("user@test.com", :first_name => "Jim").should == {"last_name"=>"Smith", "first_name"=>"Jim"}
end
end
end