Merge pull request #629 from AyuntamientoMadrid/letter-verification-fix
fixes an issue where users which requested a letter did not get the verification code set up
This commit is contained in:
@@ -3,11 +3,12 @@ class Verification::Letter
|
|||||||
|
|
||||||
attr_accessor :user, :verification_code, :email, :password, :verify
|
attr_accessor :user, :verification_code, :email, :password, :verify
|
||||||
|
|
||||||
validates :email, presence: true
|
|
||||||
validates :password, presence: true
|
|
||||||
validates :verification_code, presence: true
|
|
||||||
|
|
||||||
validate :validate_existing_user
|
validate :validate_existing_user
|
||||||
|
|
||||||
|
validates :email, presence: true, if: :verify?
|
||||||
|
validates :password, presence: true, if: :verify?
|
||||||
|
validates :verification_code, presence: true, if: :verify?
|
||||||
|
|
||||||
validate :validate_correct_code, if: :verify?
|
validate :validate_correct_code, if: :verify?
|
||||||
|
|
||||||
def save
|
def save
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ feature 'Verify Letter' do
|
|||||||
click_link "Request a letter"
|
click_link "Request a letter"
|
||||||
|
|
||||||
expect(page).to have_content "Before voting you'll receive a letter whith the instructions for verify your account."
|
expect(page).to have_content "Before voting you'll receive a letter whith the instructions for verify your account."
|
||||||
|
|
||||||
|
user.reload
|
||||||
|
|
||||||
|
expect(user.letter_requested_at).to be
|
||||||
|
expect(user.letter_verification_code).to be
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Go to office instead of send letter' do
|
scenario 'Go to office instead of send letter' do
|
||||||
|
|||||||
Reference in New Issue
Block a user