Update tests for users who enable NO_EMAILS
parent
2dfb3ca94f
commit
f31a3bd84f
|
@ -138,17 +138,20 @@ describe Api::UsersController do
|
|||
expect(json[:user])
|
||||
.to include(Users::ResendVerification::ALREADY_VERIFIED)
|
||||
end
|
||||
unless ENV["NO_EMAILS"]
|
||||
it 're-sends verification email' do
|
||||
unverified = User.create!(email: Faker::Internet.email,
|
||||
password: "password123",
|
||||
password_confirmation: "password123")
|
||||
|
||||
it 're-sends verification email' do
|
||||
unverified = User.create!(email: Faker::Internet.email,
|
||||
password: "password123",
|
||||
password_confirmation: "password123")
|
||||
post :resend_verification,
|
||||
params: { email: unverified.email },
|
||||
format: :json
|
||||
|
||||
post :resend_verification,
|
||||
params: { email: unverified.email },
|
||||
format: :json
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(json[:user]).to include(Users::ResendVerification::SENT)
|
||||
expect(response.status).to eq(200)
|
||||
expect(json[:user]).to include(Users::ResendVerification::SENT)
|
||||
end
|
||||
else
|
||||
puts "Skipping test because NO_EMAILS was enabled."
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,11 +40,14 @@ describe SessionToken do
|
|||
expect(result.success?).to be(false)
|
||||
expect(result.errors.values.first.message).to include("is not valid")
|
||||
end
|
||||
|
||||
it "doesn't mint tokens for unverified users" do
|
||||
user.update_attributes!(verified_at: nil)
|
||||
expect {
|
||||
SessionToken.issue_to(user, iat: 000, exp: 1, iss: "//lycos.com:9867")
|
||||
}.to raise_error(Errors::Forbidden)
|
||||
unless ENV["NO_EMAILS"]
|
||||
it "doesn't mint tokens for unverified users" do
|
||||
user.update_attributes!(verified_at: nil)
|
||||
expect {
|
||||
SessionToken.issue_to(user, iat: 000, exp: 1, iss: "//lycos.com:9867")
|
||||
}.to raise_error(Errors::Forbidden)
|
||||
end
|
||||
else
|
||||
puts "Skipping a test because NO_EMAILS was enabled."
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue