From 3be6841f6fa006aaea7b83d5b0485f31c42a19ff Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Thu, 8 Sep 2022 17:47:07 +0200 Subject: [PATCH] add home_spec integration test --- spec/integration/home_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spec/integration/home_spec.rb diff --git a/spec/integration/home_spec.rb b/spec/integration/home_spec.rb new file mode 100644 index 00000000..ec5af29d --- /dev/null +++ b/spec/integration/home_spec.rb @@ -0,0 +1,21 @@ +require_relative '../spec_helper' + +feature HomeController do + let(:user) { create :user } + before { login user } + 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' + end + end +end \ No newline at end of file