spec/models/user_invitation_spec.rb in iugusdk-1.0.0.alpha.0 vs spec/models/user_invitation_spec.rb in iugusdk-1.0.0.alpha.1
- old
+ new
@@ -1,9 +1,11 @@
require 'spec_helper'
describe UserInvitation do
+ it { should belong_to :account }
+
context "before save" do
context "if has no token" do
it 'should generate one' do
@user_invitation = UserInvitation.new(:email => "test@test.test", :roles => "user")
@@ -64,19 +66,13 @@
@account = Fabricate(:account)
@user = Fabricate(:user)
end
it 'should add user to account' do
- @user_invitation.account_id = @account.id
+ @user_invitation.account = @account
@user_invitation.save
@user_invitation.accept(@user)
@account.account_users.find_by_user_id(@user.id).should_not be_nil
- end
-
- it 'should raise error when account_id is invalid' do
- @user_invitation.account_id = 2039812
- @user_invitation.save
- lambda { @user_invitation.accept(@user) }.should raise_error
end
it 'should save invite roles on account_user' do
@user_invitation.account_id = @account.id
@user_invitation.roles =(["user", "guest"].join(','))