Files
grecia/spec/features/management/email_verifications_spec.rb
Javi Martín db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00

36 lines
1.1 KiB
Ruby

require "rails_helper"
describe "EmailVerifications" do
scenario "Verifying a level 1 user via email" do
login_as_manager
user = create(:user)
visit management_document_verifications_path
fill_in "document_verification_document_number", with: "12345678Z"
click_button "Check document"
expect(page).to have_content "Please introduce the email used on the account"
fill_in "email_verification_email", with: user.email
click_button "Send verification email"
expect(page).to have_content("In order to completely verify this user, it is necessary that the user clicks on a link")
user.reload
login_as(user)
sent_token = /.*email_verification_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
visit email_path(email_verification_token: sent_token)
expect(page).to have_content "You are a verified user"
expect(page).not_to have_link "Verify my account"
expect(page).to have_content "Account verified"
expect(user.reload.document_number).to eq("12345678Z")
expect(user).to be_level_three_verified
end
end