Use feature block for email update specs
This commit is contained in:
parent
05426e4ced
commit
51489a83ab
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user