Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

Commit

Permalink
Add some test coverage for invitations
Browse files Browse the repository at this point in the history
  • Loading branch information
levent committed Feb 10, 2015
1 parent 91e3818 commit e16b11d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/features/create_invitation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,30 @@
click_button 'Send invite'
expect(page).to have_content 'Invalid email address'
end

context 'with existing user' do
before do
@other_user = create_person
create_project(@other_user)
end

it 'adds them to new project' do
visit "/projects/#{@project.id}/invitations/new"
fill_in 'Email', :with => @other_user.email
click_button 'Send invite'
expect(page).to have_content "#{@other_user.email}"
end
end

context 'with existing invite' do
before do
Invitation.create!(email: 'newguy@example.com', project: @project)
end

it 'should allow deleting the invite' do
visit "/projects/#{@project.id}/people"
click_link "Remove invitation"
expect(Invitation.where(email: 'newguy@example.com')).to be_empty
end
end
end

0 comments on commit e16b11d

Please sign in to comment.