home controller 100% spec'd
This commit is contained in:
parent
0dcbf16814
commit
6ccf738589
5 changed files with 211 additions and 21 deletions
|
|
@ -1,21 +1,23 @@
|
|||
require_relative '../spec_helper'
|
||||
|
||||
feature HomeController do
|
||||
let(:user) { create :user }
|
||||
before { login user }
|
||||
describe 'my profile' do
|
||||
before { visit my_profile_path }
|
||||
let(:user) { create :user }
|
||||
|
||||
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
|
||||
before { login user }
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue