Feature: resend invites

This commit is contained in:
Arpit Jalan
2014-10-07 00:18:56 +05:30
parent 379b810397
commit 78fd99fc40
8 changed files with 79 additions and 4 deletions

View File

@ -280,6 +280,40 @@ describe InvitesController do
end
context '.resend_invite' do
it 'requires you to be logged in' do
lambda {
delete :resend_invite, email: 'first_name@example.com'
}.should raise_error(Discourse::NotLoggedIn)
end
context 'while logged in' do
let!(:user) { log_in }
let!(:invite) { Fabricate(:invite, invited_by: user) }
let(:another_invite) { Fabricate(:invite, email: 'last_name@example.com') }
it 'raises an error when the email is missing' do
lambda { post :resend_invite }.should raise_error(ActionController::ParameterMissing)
end
it "raises an error when the email cannot be found" do
lambda { post :resend_invite, email: 'first_name@example.com' }.should raise_error(Discourse::InvalidParameters)
end
it 'raises an error when the invite is not yours' do
lambda { post :resend_invite, email: another_invite.email }.should raise_error(Discourse::InvalidParameters)
end
it "resends the invite" do
Invite.any_instance.expects(:resend_invite)
post :resend_invite, email: invite.email
end
end
end
context '.check_csv_chunk' do
it 'requires you to be logged in' do
lambda {