foodsoft/spec/integration/home_spec.rb

24 lines
584 B
Ruby
Raw Normal View History

2022-09-08 17:47:07 +02:00
require_relative '../spec_helper'
feature HomeController do
2022-10-05 14:53:13 +02:00
let(:user) { create :user }
2022-09-08 17:47:07 +02:00
2022-10-05 14:53:13 +02:00
before { login user }
2022-09-08 17:47:07 +02:00
2022-10-05 14:53:13 +02:00
describe 'my profile' do
before { visit my_profile_path }
it 'is accessible' do
expect(page).to have_selector 'input[id=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('Save')
expect(User.find(user.id).first_name).to eq 'foo'
expect(page).to have_selector '.alert-success'
2022-09-08 17:47:07 +02:00
end
2022-10-05 14:53:13 +02:00
end
end