Skip to content

Instantly share code, notes, and snippets.

@allcentury
Created November 13, 2014 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allcentury/3058d20018965d85152e to your computer and use it in GitHub Desktop.
Save allcentury/3058d20018965d85152e to your computer and use it in GitHub Desktop.
FactoryGirl
it 'user can be invited twice which causes new token generation' do
user2 = create(:user, email: "already_invited@validic.com")
token = user2.invitation_token
date = user2.invitation_created_at
count = User.count
post :create, invitation: { email: 'already_invited@validic.com',
organization_id: @org.org_id,
role: 'standard'
}
user2.reload
expect(response).to have_http_status(201)
expect(User.count).to eq count
expect(User.where(email: user2.email).count).to eq 1
expect(user2.invitation_token).to_not eq token
expect(user2.invitation_created_at).to_not eq date
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment