Use feature block for email update specs
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Râu Cao 2023-05-28 15:25:53 +02:00
parent 05426e4ced
commit 51489a83ab
Signed by: raucao
GPG Key ID: 15E65F399D084BA9

View File

@ -2,6 +2,8 @@ require 'rails_helper'
RSpec.describe 'Account settings', type: :feature do
let(:user) { create :user }
feature "Update email address" do
let(:geraint) { create :user, id: 2, cn: 'geraint', email: "lamagliarosa@example.com" }
before do
@ -14,7 +16,7 @@ RSpec.describe 'Account settings', type: :feature do
.with("valid password").and_return(true)
end
scenario 'Update email address fails with invalid password' do
scenario 'fails with invalid password' do
visit setting_path(:account)
fill_in 'Address', with: "lamagliarosa@example.com"
fill_in 'Current password', with: "invalid password"
@ -27,7 +29,7 @@ RSpec.describe 'Account settings', type: :feature do
end
end
scenario 'Update email address fails when new address already taken' do
scenario 'fails when new address already taken' do
visit setting_path(:account)
fill_in 'Address', with: "lamagliarosa@example.com"
fill_in 'Current password', with: "valid password"
@ -40,7 +42,7 @@ RSpec.describe 'Account settings', type: :feature do
end
end
scenario 'Update email address works' do
scenario 'works with valid password and address' do
visit setting_path(:account)
fill_in 'Address', with: "lamagliabianca@example.com"
fill_in 'Current password', with: "valid password"
@ -53,3 +55,4 @@ RSpec.describe 'Account settings', type: :feature do
end
end
end
end