2022-10-31 16:36:06 +01:00
|
|
|
require_relative '../spec_helper'
|
|
|
|
|
|
|
|
feature 'my profile page' do
|
2023-05-12 13:01:12 +02:00
|
|
|
let(:user) { create(:user) }
|
2022-10-31 16:36:06 +01:00
|
|
|
|
|
|
|
before { login user }
|
|
|
|
|
|
|
|
describe 'my profile' do
|
|
|
|
before { visit my_profile_path }
|
|
|
|
|
|
|
|
it 'is accessible' do
|
|
|
|
expect(page).to have_field 'user_first_name'
|
|
|
|
expect(find_field('user_first_name').value).to eq user.first_name
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates first name' do
|
|
|
|
fill_in 'user_first_name', with: 'foo'
|
|
|
|
click_button I18n.t('ui.save')
|
|
|
|
expect(User.find(user.id).first_name).to eq 'foo'
|
|
|
|
expect(page).to have_selector '.alert-success'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|