Change single quotes to double quotes

This commit is contained in:
Julian Herrero
2019-02-01 16:48:49 +01:00
parent 4a12425987
commit 31ac8b7f55
302 changed files with 6403 additions and 6403 deletions

View File

@@ -1,32 +1,32 @@
require 'rails_helper'
require "rails_helper"
feature 'Valuation budget investments' do
feature "Valuation budget investments" do
let(:budget) { create(:budget, :valuating) }
let(:valuator) do
create(:valuator, user: create(:user, username: 'Rachel', email: 'rachel@valuators.org'))
create(:valuator, user: create(:user, username: "Rachel", email: "rachel@valuators.org"))
end
background do
login_as(valuator.user)
end
scenario 'Disabled with a feature flag' do
Setting['feature.budgets'] = nil
scenario "Disabled with a feature flag" do
Setting["feature.budgets"] = nil
expect{
visit valuation_budget_budget_investments_path(create(:budget))
}.to raise_exception(FeatureFlags::FeatureDisabled)
Setting['feature.budgets'] = true
Setting["feature.budgets"] = true
end
scenario 'Display link to valuation section' do
scenario "Display link to valuation section" do
visit root_path
expect(page).to have_link "Valuation", href: valuation_root_path
end
feature 'Index' do
scenario 'Index shows budget investments assigned to current valuator' do
feature "Index" do
scenario "Index shows budget investments assigned to current valuator" do
investment1 = create(:budget_investment, :visible_to_valuators, budget: budget)
investment2 = create(:budget_investment, :visible_to_valuators, budget: budget)
@@ -38,7 +38,7 @@ feature 'Valuation budget investments' do
expect(page).not_to have_content(investment2.title)
end
scenario 'Index shows no budget investment to admins no valuators' do
scenario "Index shows no budget investment to admins no valuators" do
investment1 = create(:budget_investment, :visible_to_valuators, budget: budget)
investment2 = create(:budget_investment, :visible_to_valuators, budget: budget)
@@ -52,7 +52,7 @@ feature 'Valuation budget investments' do
expect(page).not_to have_content(investment2.title)
end
scenario 'Index orders budget investments by votes' do
scenario "Index orders budget investments by votes" do
investment10 = create(:budget_investment, :visible_to_valuators, budget: budget,
cached_votes_up: 10)
investment100 = create(:budget_investment, :visible_to_valuators, budget: budget,
@@ -70,7 +70,7 @@ feature 'Valuation budget investments' do
expect(investment10.title).to appear_before(investment1.title)
end
scenario 'Index displays investments paginated' do
scenario "Index displays investments paginated" do
per_page = Kaminari.config.default_per_page
(per_page + 2).times do
investment = create(:budget_investment, :visible_to_valuators, budget: budget)
@@ -79,7 +79,7 @@ feature 'Valuation budget investments' do
visit valuation_budget_budget_investments_path(budget)
expect(page).to have_css('.budget_investment', count: per_page)
expect(page).to have_css(".budget_investment", count: per_page)
within("ul.pagination") do
expect(page).to have_content("1")
expect(page).to have_content("2")
@@ -87,7 +87,7 @@ feature 'Valuation budget investments' do
click_link "Next", exact: false
end
expect(page).to have_css('.budget_investment', count: 2)
expect(page).to have_css(".budget_investment", count: 2)
end
scenario "Index filtering by heading", :js do
@@ -123,10 +123,10 @@ feature 'Valuation budget investments' do
expect(page).not_to have_link("Finished ONE")
expect(page).not_to have_link("Finished TWO")
expect(page).to have_link('All headings (4)')
expect(page).to have_link('Only Valuating (1)')
expect(page).to have_link('Valuating&Finished (2)')
expect(page).to have_link('Only Finished (1)')
expect(page).to have_link("All headings (4)")
expect(page).to have_link("Only Valuating (1)")
expect(page).to have_link("Valuating&Finished (2)")
expect(page).to have_link("Only Finished (1)")
click_link "Only Valuating (1)", exact: false
expect(page).to have_link("Valuating Investment ONE")
@@ -134,7 +134,7 @@ feature 'Valuation budget investments' do
expect(page).not_to have_link("Finished ONE")
expect(page).not_to have_link("Finished TWO")
click_link 'Valuation finished'
click_link "Valuation finished"
expect(page).not_to have_link("Valuating Investment ONE")
expect(page).not_to have_link("Valuating Investment TWO")
expect(page).not_to have_link("Finished ONE")
@@ -146,7 +146,7 @@ feature 'Valuation budget investments' do
expect(page).not_to have_link("Finished ONE")
expect(page).not_to have_link("Finished TWO")
click_link 'Valuation finished'
click_link "Valuation finished"
expect(page).not_to have_link("Valuating Investment ONE")
expect(page).not_to have_link("Valuating Investment TWO")
expect(page).to have_link("Finished ONE")
@@ -158,7 +158,7 @@ feature 'Valuation budget investments' do
expect(page).not_to have_link("Finished ONE")
expect(page).not_to have_link("Finished TWO")
click_link 'Valuation finished'
click_link "Valuation finished"
expect(page).not_to have_link("Valuating Investment ONE")
expect(page).not_to have_link("Valuating Investment TWO")
expect(page).not_to have_link("Finished ONE")
@@ -166,8 +166,8 @@ feature 'Valuation budget investments' do
end
scenario "Current filter is properly highlighted" do
filters_links = {'valuating' => 'Under valuation',
'valuation_finished' => 'Valuation finished'}
filters_links = {"valuating" => "Under valuation",
"valuation_finished" => "Valuation finished"}
visit valuation_budget_budget_investments_path(budget)
@@ -199,28 +199,28 @@ feature 'Valuation budget investments' do
expect(page).to have_content("Ongoing valuation")
expect(page).not_to have_content("Old idea")
visit valuation_budget_budget_investments_path(budget, filter: 'valuating')
visit valuation_budget_budget_investments_path(budget, filter: "valuating")
expect(page).to have_content("Ongoing valuation")
expect(page).not_to have_content("Old idea")
visit valuation_budget_budget_investments_path(budget, filter: 'valuation_finished')
visit valuation_budget_budget_investments_path(budget, filter: "valuation_finished")
expect(page).not_to have_content("Ongoing valuation")
expect(page).to have_content("Old idea")
end
end
feature 'Show' do
feature "Show" do
let(:administrator) do
create(:administrator, user: create(:user, username: 'Ana', email: 'ana@admins.org'))
create(:administrator, user: create(:user, username: "Ana", email: "ana@admins.org"))
end
let(:second_valuator) do
create(:valuator, user: create(:user, username: 'Rick', email: 'rick@valuators.org'))
create(:valuator, user: create(:user, username: "Rick", email: "rick@valuators.org"))
end
let(:investment) do
create(:budget_investment, budget: budget, price: 1234, feasibility: 'unfeasible',
unfeasibility_explanation: 'It is impossible',
create(:budget_investment, budget: budget, price: 1234, feasibility: "unfeasible",
unfeasibility_explanation: "It is impossible",
administrator: administrator,)
end
@@ -228,7 +228,7 @@ feature 'Valuation budget investments' do
investment.valuators << [valuator, second_valuator]
end
scenario 'visible for assigned valuators' do
scenario "visible for assigned valuators" do
investment.update(visible_to_valuators: true)
visit valuation_budget_budget_investments_path(budget)
@@ -239,18 +239,18 @@ feature 'Valuation budget investments' do
expect(page).to have_content(investment.description)
expect(page).to have_content(investment.author.name)
expect(page).to have_content(investment.heading.name)
expect(page).to have_content('1234')
expect(page).to have_content('Unfeasible')
expect(page).to have_content('It is impossible')
expect(page).to have_content('Ana (ana@admins.org)')
expect(page).to have_content("1234")
expect(page).to have_content("Unfeasible")
expect(page).to have_content("It is impossible")
expect(page).to have_content("Ana (ana@admins.org)")
within('#assigned_valuators') do
expect(page).to have_content('Rachel (rachel@valuators.org)')
expect(page).to have_content('Rick (rick@valuators.org)')
within("#assigned_valuators") do
expect(page).to have_content("Rachel (rachel@valuators.org)")
expect(page).to have_content("Rick (rick@valuators.org)")
end
end
scenario 'visible for admins' do
scenario "visible for admins" do
logout
login_as create(:administrator).user
@@ -260,18 +260,18 @@ feature 'Valuation budget investments' do
expect(page).to have_content(investment.description)
expect(page).to have_content(investment.author.name)
expect(page).to have_content(investment.heading.name)
expect(page).to have_content('1234')
expect(page).to have_content('Unfeasible')
expect(page).to have_content('It is impossible')
expect(page).to have_content('Ana (ana@admins.org)')
expect(page).to have_content("1234")
expect(page).to have_content("Unfeasible")
expect(page).to have_content("It is impossible")
expect(page).to have_content("Ana (ana@admins.org)")
within('#assigned_valuators') do
expect(page).to have_content('Rachel (rachel@valuators.org)')
expect(page).to have_content('Rick (rick@valuators.org)')
within("#assigned_valuators") do
expect(page).to have_content("Rachel (rachel@valuators.org)")
expect(page).to have_content("Rick (rick@valuators.org)")
end
end
scenario 'not visible for not assigned valuators' do
scenario "not visible for not assigned valuators" do
logout
login_as create(:valuator).user
@@ -282,7 +282,7 @@ feature 'Valuation budget investments' do
end
feature 'Valuate' do
feature "Valuate" do
let(:admin) { create(:administrator) }
let(:investment) do
group = create(:budget_group, budget: budget)
@@ -295,71 +295,71 @@ feature 'Valuation budget investments' do
investment.valuators << valuator
end
scenario 'Dossier empty by default' do
scenario "Dossier empty by default" do
investment.update(visible_to_valuators: true)
visit valuation_budget_budget_investments_path(budget)
click_link investment.title
within('#price') { expect(page).to have_content('Undefined') }
within('#price_first_year') { expect(page).to have_content('Undefined') }
within('#duration') { expect(page).to have_content('Undefined') }
within('#feasibility') { expect(page).to have_content('Undecided') }
expect(page).not_to have_content('Valuation finished')
within("#price") { expect(page).to have_content("Undefined") }
within("#price_first_year") { expect(page).to have_content("Undefined") }
within("#duration") { expect(page).to have_content("Undefined") }
within("#feasibility") { expect(page).to have_content("Undecided") }
expect(page).not_to have_content("Valuation finished")
end
scenario 'Edit dossier' do
scenario "Edit dossier" do
investment.update(visible_to_valuators: true)
visit valuation_budget_budget_investments_path(budget)
within("#budget_investment_#{investment.id}") do
click_link "Edit dossier"
end
fill_in 'budget_investment_price', with: '12345'
fill_in 'budget_investment_price_first_year', with: '9876'
fill_in 'budget_investment_price_explanation', with: 'Very cheap idea'
choose 'budget_investment_feasibility_feasible'
fill_in 'budget_investment_duration', with: '19 months'
click_button 'Save changes'
fill_in "budget_investment_price", with: "12345"
fill_in "budget_investment_price_first_year", with: "9876"
fill_in "budget_investment_price_explanation", with: "Very cheap idea"
choose "budget_investment_feasibility_feasible"
fill_in "budget_investment_duration", with: "19 months"
click_button "Save changes"
expect(page).to have_content "Dossier updated"
visit valuation_budget_budget_investments_path(budget)
click_link investment.title
within('#price') { expect(page).to have_content('12345') }
within('#price_first_year') { expect(page).to have_content('9876') }
expect(page).to have_content('Very cheap idea')
within('#duration') { expect(page).to have_content('19 months') }
within('#feasibility') { expect(page).to have_content('Feasible') }
expect(page).not_to have_content('Valuation finished')
within("#price") { expect(page).to have_content("12345") }
within("#price_first_year") { expect(page).to have_content("9876") }
expect(page).to have_content("Very cheap idea")
within("#duration") { expect(page).to have_content("19 months") }
within("#feasibility") { expect(page).to have_content("Feasible") }
expect(page).not_to have_content("Valuation finished")
end
scenario 'Feasibility can be marked as pending' do
scenario "Feasibility can be marked as pending" do
visit valuation_budget_budget_investment_path(budget, investment)
click_link 'Edit dossier'
click_link "Edit dossier"
expect(find("#budget_investment_feasibility_undecided")).to be_checked
choose 'budget_investment_feasibility_feasible'
click_button 'Save changes'
choose "budget_investment_feasibility_feasible"
click_button "Save changes"
visit edit_valuation_budget_budget_investment_path(budget, investment)
expect(find("#budget_investment_feasibility_undecided")).not_to be_checked
expect(find("#budget_investment_feasibility_feasible")).to be_checked
choose 'budget_investment_feasibility_undecided'
click_button 'Save changes'
choose "budget_investment_feasibility_undecided"
click_button "Save changes"
visit edit_valuation_budget_budget_investment_path(budget, investment)
expect(find("#budget_investment_feasibility_undecided")).to be_checked
end
scenario 'Feasibility selection makes proper fields visible', :js do
feasible_fields = ['Price (€)', 'Cost during the first year (€)', 'Price explanation',
'Time scope']
unfeasible_fields = ['Feasibility explanation']
any_feasibility_fields = ['Valuation finished']
scenario "Feasibility selection makes proper fields visible", :js do
feasible_fields = ["Price (€)", "Cost during the first year (€)", "Price explanation",
"Time scope"]
unfeasible_fields = ["Feasibility explanation"]
any_feasibility_fields = ["Valuation finished"]
undecided_fields = feasible_fields + unfeasible_fields + any_feasibility_fields
visit edit_valuation_budget_budget_investment_path(budget, investment)
@@ -370,7 +370,7 @@ feature 'Valuation budget investments' do
expect(page).to have_content(field)
end
choose 'budget_investment_feasibility_feasible'
choose "budget_investment_feasibility_feasible"
unfeasible_fields.each do |field|
expect(page).not_to have_content(field)
@@ -380,7 +380,7 @@ feature 'Valuation budget investments' do
expect(page).to have_content(field)
end
choose 'budget_investment_feasibility_unfeasible'
choose "budget_investment_feasibility_unfeasible"
feasible_fields.each do |field|
expect(page).not_to have_content(field)
@@ -390,7 +390,7 @@ feature 'Valuation budget investments' do
expect(page).to have_content(field)
end
click_button 'Save changes'
click_button "Save changes"
visit edit_valuation_budget_budget_investment_path(budget, investment)
@@ -403,45 +403,45 @@ feature 'Valuation budget investments' do
expect(page).to have_content(field)
end
choose 'budget_investment_feasibility_undecided'
choose "budget_investment_feasibility_undecided"
undecided_fields.each do |field|
expect(page).to have_content(field)
end
end
scenario 'Finish valuation' do
scenario "Finish valuation" do
investment.update(visible_to_valuators: true)
visit valuation_budget_budget_investment_path(budget, investment)
click_link 'Edit dossier'
click_link "Edit dossier"
find_field('budget_investment[valuation_finished]').click
click_button 'Save changes'
find_field("budget_investment[valuation_finished]").click
click_button "Save changes"
visit valuation_budget_budget_investments_path(budget)
expect(page).not_to have_content investment.title
click_link 'Valuation finished'
click_link "Valuation finished"
expect(page).to have_content investment.title
click_link investment.title
expect(page).to have_content('Valuation finished')
expect(page).to have_content("Valuation finished")
end
context 'Reopen valuation' do
context "Reopen valuation" do
background do
investment.update(
valuation_finished: true,
feasibility: 'feasible',
unfeasibility_explanation: 'Explanation is explanatory',
feasibility: "feasible",
unfeasibility_explanation: "Explanation is explanatory",
price: 999,
price_first_year: 666,
price_explanation: 'Democracy is not cheap',
duration: '1 light year'
price_explanation: "Democracy is not cheap",
duration: "1 light year"
)
end
scenario 'Admins can reopen & modify finished valuation' do
scenario "Admins can reopen & modify finished valuation" do
logout
login_as(admin.user)
visit edit_valuation_budget_budget_investment_path(budget, investment)
@@ -449,27 +449,27 @@ feature 'Valuation budget investments' do
expect(page).to have_selector("input[id='budget_investment_feasibility_undecided']")
expect(page).to have_selector("textarea[id='budget_investment_unfeasibility_explanation']")
expect(page).to have_selector("input[name='budget_investment[valuation_finished]']")
expect(page).to have_button('Save changes')
expect(page).to have_button("Save changes")
end
scenario 'Valuators that are not admins cannot reopen or modify a finished valuation' do
scenario "Valuators that are not admins cannot reopen or modify a finished valuation" do
visit edit_valuation_budget_budget_investment_path(budget, investment)
expect(page).not_to have_selector("input[id='budget_investment_feasibility_undecided']")
expect(page).not_to have_selector("textarea[id='budget_investment_unfeasibility_explanation']")
expect(page).not_to have_selector("input[name='budget_investment[valuation_finished]']")
expect(page).to have_content('Valuation finished')
expect(page).to have_content('Feasibility: Feasible')
expect(page).to have_content('Feasibility explanation: Explanation is explanatory')
expect(page).to have_content('Price (€): 999')
expect(page).to have_content('Cost during the first year: 666')
expect(page).to have_content('Price explanation: Democracy is not cheap')
expect(page).to have_content('Time scope: 1 light year')
expect(page).not_to have_button('Save changes')
expect(page).to have_content("Valuation finished")
expect(page).to have_content("Feasibility: Feasible")
expect(page).to have_content("Feasibility explanation: Explanation is explanatory")
expect(page).to have_content("Price (€): 999")
expect(page).to have_content("Cost during the first year: 666")
expect(page).to have_content("Price explanation: Democracy is not cheap")
expect(page).to have_content("Time scope: 1 light year")
expect(page).not_to have_button("Save changes")
end
end
scenario 'Validates price formats' do
scenario "Validates price formats" do
investment.update(visible_to_valuators: true)
visit valuation_budget_budget_investments_path(budget)
@@ -478,16 +478,16 @@ feature 'Valuation budget investments' do
click_link "Edit dossier"
end
fill_in 'budget_investment_price', with: '12345,98'
fill_in 'budget_investment_price_first_year', with: '9876.6'
click_button 'Save changes'
fill_in "budget_investment_price", with: "12345,98"
fill_in "budget_investment_price_first_year", with: "9876.6"
click_button "Save changes"
expect(page).to have_content('2 errors')
expect(page).to have_content('Only integer numbers', count: 2)
expect(page).to have_content("2 errors")
expect(page).to have_content("Only integer numbers", count: 2)
end
scenario 'not visible to valuators when budget is not valuating' do
budget.update(phase: 'publishing_prices')
scenario "not visible to valuators when budget is not valuating" do
budget.update(phase: "publishing_prices")
investment = create(:budget_investment, budget: budget)
investment.valuators << [valuator]
@@ -495,11 +495,11 @@ feature 'Valuation budget investments' do
login_as(valuator.user)
visit edit_valuation_budget_budget_investment_path(budget, investment)
expect(page).to have_content('Investments can only be valuated when Budget is in valuating phase')
expect(page).to have_content("Investments can only be valuated when Budget is in valuating phase")
end
scenario 'visible to admins regardless of not being in valuating phase' do
budget.update(phase: 'publishing_prices')
scenario "visible to admins regardless of not being in valuating phase" do
budget.update(phase: "publishing_prices")
user = create(:user)
admin = create(:administrator, user: user)
@@ -511,7 +511,7 @@ feature 'Valuation budget investments' do
login_as(admin.user)
visit valuation_budget_budget_investment_path(budget, investment)
click_link 'Edit dossier'
click_link "Edit dossier"
expect(page).to have_content investment.title
end