Skip to content

Instantly share code, notes, and snippets.

@cayblood
Created January 29, 2011 14:58
Show Gist options
  • Save cayblood/801891 to your computer and use it in GitHub Desktop.
Save cayblood/801891 to your computer and use it in GitHub Desktop.
it "should create a user if an unused email is provided" do
VCR.use_cassette('create_user_with_email', :record => :new_episodes) do
options = {:email => 'carl@youngbloods.org'}
UUIDTools::UUID.stub!(:random_create).and_return('7c4037cc-e021-48c0-990a-51b3e82d48d6')
response = @api.create_user(options)
response.should be_a(Hash)
response['guid']
end
end
it 'should raise an exception if the supplied email address is already in use' do
VCR.use_cassette('duplicate_email', :record => :new_episodes) do
options = {:email => 'carl@youngbloods.org'}
lambda { @api.create_user(options) }.should raise_exception(RuntimeError, "Unable to create user: email has already been taken")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment