Backend support for group invites

This commit is contained in:
Sam
2014-05-09 11:45:18 +10:00
parent 34d1668f9f
commit 3f07c1d0a1
7 changed files with 87 additions and 79 deletions

View File

@ -299,11 +299,6 @@ describe Topic do
context 'invite' do
it "delegates to topic.invite_by_email when the user doesn't exist, but it's an email" do
topic.expects(:invite_by_email).with(topic.user, 'jake@adventuretime.ooo')
topic.invite(topic.user, 'jake@adventuretime.ooo')
end
context 'existing user' do
let(:walter) { Fabricate(:walter_white) }
@ -324,19 +319,14 @@ describe Topic do
end
context 'by email' do
it 'returns true' do
topic.invite(topic.user, walter.email).should be_true
end
it 'adds walter to the allowed users' do
topic.invite(topic.user, walter.email)
it 'adds user correctly' do
lambda {
topic.invite(topic.user, walter.email).should be_true
}.should change(Notification, :count)
topic.allowed_users.include?(walter).should be_true
end
it 'creates a notification' do
lambda { topic.invite(topic.user, walter.email) }.should change(Notification, :count)
end
end
end