Restrict compatilibility edit on admin investment form
Why: * A non-winner but compatible investment shouldn't be marked as incompatible How: * Show incompatilibility checkbox only if investment is winner or incompatible
This commit is contained in:
@@ -312,7 +312,7 @@ feature 'Admin budget investments' do
|
||||
context "Edit" do
|
||||
|
||||
scenario "Change title, incompatible, description or heading" do
|
||||
budget_investment = create(:budget_investment, :selected)
|
||||
budget_investment = create(:budget_investment, :incompatible)
|
||||
create(:budget_heading, group: budget_investment.group, name: "Barbate")
|
||||
|
||||
visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment)
|
||||
@@ -321,7 +321,7 @@ feature 'Admin budget investments' do
|
||||
fill_in 'budget_investment_title', with: 'Potatoes'
|
||||
fill_in 'budget_investment_description', with: 'Carrots'
|
||||
select "#{budget_investment.group.name}: Barbate", from: 'budget_investment[heading_id]'
|
||||
check "budget_investment_incompatible"
|
||||
uncheck "budget_investment_incompatible"
|
||||
check "budget_investment_selected"
|
||||
|
||||
click_button 'Update'
|
||||
@@ -329,10 +329,21 @@ feature 'Admin budget investments' do
|
||||
expect(page).to have_content 'Potatoes'
|
||||
expect(page).to have_content 'Carrots'
|
||||
expect(page).to have_content 'Barbate'
|
||||
expect(page).to have_content 'Incompatible'
|
||||
expect(page).to have_content 'Compatibility: Compatible'
|
||||
expect(page).to have_content 'Selected'
|
||||
end
|
||||
|
||||
scenario "Compatible non-winner can't edit incompatibility" do
|
||||
budget_investment = create(:budget_investment, :selected)
|
||||
create(:budget_heading, group: budget_investment.group, name: "Tetuan")
|
||||
|
||||
visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment)
|
||||
click_link 'Edit'
|
||||
|
||||
expect(page).not_to have_content 'Compatibility'
|
||||
expect(page).not_to have_content 'Mark as incompatible'
|
||||
end
|
||||
|
||||
scenario "Add administrator" do
|
||||
budget_investment = create(:budget_investment)
|
||||
administrator = create(:administrator, user: create(:user, username: 'Marta', email: 'marta@admins.org'))
|
||||
|
||||
Reference in New Issue
Block a user