FEATURE: Allow sending invites to staged users

This commit is contained in:
Gerhard Schlager
2018-01-19 15:29:15 +01:00
parent f74ac826c5
commit dde0fcc658
7 changed files with 79 additions and 20 deletions

View File

@ -1580,4 +1580,24 @@ describe User do
end
end
describe "#unstage" do
it "correctyl unstages a user" do
staged_user = Fabricate(:staged, email: 'staged@account.com', active: true, username: 'staged1', name: 'Stage Name')
params = { email: 'staged@account.com', active: true, username: 'unstaged1', name: 'Foo Bar' }
user = User.unstage(params)
expect(user.id).to eq(staged_user.id)
expect(user.username).to eq('unstaged1')
expect(user.name).to eq('Foo Bar')
expect(user.active).to eq(false)
expect(user.email).to eq('staged@account.com')
end
it "returns nil when the user cannot be unstaged" do
Fabricate(:coding_horror)
expect(User.unstage(email: 'jeff@somewhere.com')).to be_nil
expect(User.unstage(email: 'no@account.com')).to be_nil
end
end
end