Add CRUD Milestone on Admin::BudgetInvestment. Rename Checkpoint to Milestone.

This commit is contained in:
taitus
2017-06-22 13:25:17 +02:00
parent beeb5412d7
commit f220952883
20 changed files with 277 additions and 33 deletions

View File

@@ -0,0 +1,70 @@
require 'rails_helper'
feature 'Admin budget investment milestones' do
background do
admin = create(:administrator)
login_as(admin.user)
@investment = create(:budget_investment)
end
context "Index" do
scenario 'Displaying milestones' do
milestone = create(:budget_investment_milestone, investment: @investment)
visit admin_budget_budget_investment_path(@investment.budget, @investment)
expect(page).to have_content("Milestone")
expect(page).to have_content(milestone.title)
expect(page).to have_content(milestone.id)
end
end
context "New" do
scenario "Add milestone" do
visit admin_budget_budget_investment_path(@investment.budget, @investment)
click_link 'Create new milestone'
fill_in 'budget_investment_milestone_title', with: 'New title milestone'
fill_in 'budget_investment_milestone_description', with: 'New description milestone'
click_button 'Create milestone'
expect(page).to have_content 'New title milestone'
expect(page).to have_content 'New description milestone'
end
end
context "Edit" do
scenario "Change title and description" do
milestone = create(:budget_investment_milestone, investment: @investment)
visit admin_budget_budget_investment_path(@investment.budget, @investment)
click_link milestone.title
fill_in 'budget_investment_milestone_title', with: 'Changed title'
fill_in 'budget_investment_milestone_description', with: 'Changed description'
click_button 'Update milestone'
expect(page).to have_content 'Changed title'
expect(page).to have_content 'Changed description'
end
end
context "Delete" do
scenario "Remove milestone" do
milestone = create(:budget_investment_milestone, investment: @investment, title: "Title will it remove")
visit admin_budget_budget_investment_path(@investment.budget, @investment)
click_link "Delete milestone"
expect(page).to_not have_content 'Title will it remove'
end
end
end

View File

@@ -27,7 +27,7 @@ feature 'Admin budget investments' do
context "Index" do
scenario 'Displaying investmentss' do
scenario 'Displaying investments' do
budget_investment = create(:budget_investment, budget: @budget, cached_votes_up: 77)
visit admin_budget_budget_investments_path(budget_id: @budget.id)
expect(page).to have_content(budget_investment.title)