adds account tests to increase test coverage

This commit is contained in:
kikito
2015-08-17 18:31:04 +02:00
parent c3bee45eda
commit 66c8931ae9

View File

@@ -19,6 +19,18 @@ feature 'Account' do
expect(page).to have_selector(avatar('Manuela Colau'), count: 1) expect(page).to have_selector(avatar('Manuela Colau'), count: 1)
end end
scenario 'Show organization' do
create(:organization, user: @user, name: "Manuela Corp")
visit account_path
expect(page).to have_selector("input[value='Manuela Corp']")
expect(page).to_not have_selector("input[value='Manuela']")
expect(page).to_not have_selector("input[value='Colau']")
expect(page).to have_selector(avatar('Manuela Corp'), count: 1)
end
scenario 'Edit' do scenario 'Edit' do
visit account_path visit account_path
@@ -38,6 +50,24 @@ feature 'Account' do
expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']") expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']")
end end
scenario 'Edit Organization' do
create(:organization, user: @user, name: "Manuela Corp")
visit account_path
fill_in 'account_organization_attributes_name', with: 'Google'
check 'account_email_on_debate_comment'
check 'account_email_on_comment_reply'
click_button 'Save changes'
expect(page).to have_content "Saved"
visit account_path
expect(page).to have_selector("input[value='Google']")
expect(page).to have_selector("input[id='account_email_on_debate_comment'][value='1']")
expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']")
end
scenario "Errors on edit" do scenario "Errors on edit" do
visit account_path visit account_path