diff --git a/app/controllers/concerns/has_orders.rb b/app/controllers/concerns/has_orders.rb index 90be317f0..40dcac20f 100644 --- a/app/controllers/concerns/has_orders.rb +++ b/app/controllers/concerns/has_orders.rb @@ -5,7 +5,7 @@ module HasOrders def has_orders(valid_orders, *args) before_action(*args) do |c| @valid_orders = valid_orders.respond_to?(:call) ? valid_orders.call(c) : valid_orders.dup - @valid_orders.delete('relevance') if params[:search].blank? + @valid_orders.delete("relevance") if params[:search].blank? @current_order = @valid_orders.include?(params[:order]) ? params[:order] : @valid_orders.first end end diff --git a/app/helpers/followables_helper.rb b/app/helpers/followables_helper.rb index 48dd761ce..5641a33bc 100644 --- a/app/helpers/followables_helper.rb +++ b/app/helpers/followables_helper.rb @@ -22,7 +22,7 @@ module FollowablesHelper end def followable_class_name(followable) - followable.class.to_s.parameterize('_') + followable.class.to_s.parameterize("_") end def find_or_build_follow(user, followable) diff --git a/app/helpers/proposals_helper.rb b/app/helpers/proposals_helper.rb index 84407f840..633f469a3 100644 --- a/app/helpers/proposals_helper.rb +++ b/app/helpers/proposals_helper.rb @@ -34,9 +34,9 @@ module ProposalsHelper def empty_recommended_proposals_message_text(user) if user.interests.any? - t('proposals.index.recommendations.without_results') + t("proposals.index.recommendations.without_results") else - t('proposals.index.recommendations.without_interests') + t("proposals.index.recommendations.without_interests") end end diff --git a/app/views/admin/legislation/proposals/_form.html.erb b/app/views/admin/legislation/proposals/_form.html.erb index 94e94d157..63617c57d 100644 --- a/app/views/admin/legislation/proposals/_form.html.erb +++ b/app/views/admin/legislation/proposals/_form.html.erb @@ -21,7 +21,7 @@ <%= f.text_field :custom_list, value: @process.tag_list_on(:customs).to_s, label: false, placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"), - class: 'js-tag-list', + class: "js-tag-list", aria: {describedby: "tag-list-help-text"} %> diff --git a/app/views/admin/legislation/proposals/_proposals.html.erb b/app/views/admin/legislation/proposals/_proposals.html.erb index 9250e2a42..8682eeab6 100644 --- a/app/views/admin/legislation/proposals/_proposals.html.erb +++ b/app/views/admin/legislation/proposals/_proposals.html.erb @@ -1,7 +1,7 @@ <% if proposals.any? %>

<%= page_entries_info proposals %>

- <%= render 'shared/wide_order_selector', i18n_namespace: "admin.legislation.processes.proposals" %> + <%= render "shared/wide_order_selector", i18n_namespace: "admin.legislation.processes.proposals" %> diff --git a/app/views/admin/legislation/proposals/index.html.erb b/app/views/admin/legislation/proposals/index.html.erb index d8dd407a5..d758254fa 100644 --- a/app/views/admin/legislation/proposals/index.html.erb +++ b/app/views/admin/legislation/proposals/index.html.erb @@ -8,8 +8,8 @@

<%= @process.title %>

- <%= render 'admin/legislation/processes/subnav', process: @process, active: 'proposals' %> + <%= render "admin/legislation/processes/subnav", process: @process, active: "proposals" %> - <%= render 'form' %> - <%= render 'proposals', proposals: @proposals %> + <%= render "form" %> + <%= render "proposals", proposals: @proposals %> diff --git a/app/views/legislation/annotations/_comment_header.html.erb b/app/views/legislation/annotations/_comment_header.html.erb index f8602aa7e..26cd21469 100644 --- a/app/views/legislation/annotations/_comment_header.html.erb +++ b/app/views/legislation/annotations/_comment_header.html.erb @@ -1,7 +1,7 @@
- <%= t('legislation.annotations.comments.comments_count', + <%= t("legislation.annotations.comments.comments_count", count: annotation.comments.roots.count) %>
diff --git a/config/database-docker.yml.example b/config/database-docker.yml.example index dc1efbd7e..48e1c30db 100644 --- a/config/database-docker.yml.example +++ b/config/database-docker.yml.example @@ -6,7 +6,7 @@ default: &default pool: 5 port: 5432 username: postgres - password: <%= ENV['POSTGRES_PASSWORD'] %> + password: <%= ENV["POSTGRES_PASSWORD"] %> development: &development <<: *default diff --git a/config/initializers/ckeditor.rb b/config/initializers/ckeditor.rb index 1e173cca8..338cea974 100644 --- a/config/initializers/ckeditor.rb +++ b/config/initializers/ckeditor.rb @@ -3,7 +3,7 @@ Ckeditor.setup do |config| # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. - require 'ckeditor/orm/active_record' + require "ckeditor/orm/active_record" config.authorize_with :cancan diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb index 46d1d69df..4cd6ba8c6 100644 --- a/spec/controllers/graphql_controller_spec.rb +++ b/spec/controllers/graphql_controller_spec.rb @@ -71,19 +71,19 @@ describe GraphqlController, type: :request do let(:query_string) { "{ proposal(id: #{proposal.id}) { title } }" } specify "when absent" do - get '/graphql', query: query_string + get "/graphql", query: query_string expect(response).to have_http_status(:ok) end specify "when specified as the 'null' string" do - get '/graphql', query: query_string, variables: 'null' + get "/graphql", query: query_string, variables: "null" expect(response).to have_http_status(:ok) end specify "when specified as an empty string" do - get '/graphql', query: query_string, variables: '' + get "/graphql", query: query_string, variables: "" expect(response).to have_http_status(:ok) end diff --git a/spec/factories/budgets.rb b/spec/factories/budgets.rb index e741eb683..0b9130825 100644 --- a/spec/factories/budgets.rb +++ b/spec/factories/budgets.rb @@ -1,17 +1,17 @@ FactoryBot.define do factory :spending_proposal do sequence(:title) { |n| "Spending Proposal #{n} title" } - description 'Spend money on this' - feasible_explanation 'This proposal is not viable because...' - external_url 'http://external_documention.org' - terms_of_service '1' + description "Spend money on this" + feasible_explanation "This proposal is not viable because..." + external_url "http://external_documention.org" + terms_of_service "1" association :author, factory: :user end factory :budget do sequence(:name) { |n| "#{Faker::Lorem.word} #{n}" } currency_symbol "€" - phase 'accepting' + phase "accepting" description_drafting "This budget is drafting" description_informing "This budget is informing" description_accepting "This budget is accepting" @@ -24,47 +24,47 @@ FactoryBot.define do description_finished "This budget is finished" trait :drafting do - phase 'drafting' + phase "drafting" end trait :informing do - phase 'informing' + phase "informing" end trait :accepting do - phase 'accepting' + phase "accepting" end trait :reviewing do - phase 'reviewing' + phase "reviewing" end trait :selecting do - phase 'selecting' + phase "selecting" end trait :valuating do - phase 'valuating' + phase "valuating" end trait :publishing_prices do - phase 'publishing_prices' + phase "publishing_prices" end trait :balloting do - phase 'balloting' + phase "balloting" end trait :reviewing_ballots do - phase 'reviewing_ballots' + phase "reviewing_ballots" end trait :finished do - phase 'finished' + phase "finished" end end - factory :budget_group, class: 'Budget::Group' do + factory :budget_group, class: "Budget::Group" do budget sequence(:name) { |n| "Group #{n}" } @@ -73,28 +73,28 @@ FactoryBot.define do end end - factory :budget_heading, class: 'Budget::Heading' do + factory :budget_heading, class: "Budget::Heading" do association :group, factory: :budget_group sequence(:name) { |n| "Heading #{n}" } price 1000000 population 1234 - latitude '40.416775' - longitude '-3.703790' + latitude "40.416775" + longitude "-3.703790" trait :drafting_budget do association :group, factory: [:budget_group, :drafting_budget] end end - factory :budget_investment, class: 'Budget::Investment' do + factory :budget_investment, class: "Budget::Investment" do sequence(:title) { |n| "Budget Investment #{n} title" } association :heading, factory: :budget_heading association :author, factory: :user - description 'Spend money on this' + description "Spend money on this" price 10 - unfeasibility_explanation '' - skip_map '1' - terms_of_service '1' + unfeasibility_explanation "" + skip_map "1" + terms_of_service "1" incompatible false trait :with_confidence_score do @@ -141,7 +141,7 @@ FactoryBot.define do trait :selected_with_price do selected price 1000 - price_explanation 'Because of reasons' + price_explanation "Because of reasons" end trait :unselected do @@ -169,7 +169,7 @@ FactoryBot.define do end end - factory :budget_phase, class: 'Budget::Phase' do + factory :budget_phase, class: "Budget::Phase" do budget kind :balloting summary Faker::Lorem.sentence(3) @@ -179,17 +179,17 @@ FactoryBot.define do enabled true end - factory :budget_ballot, class: 'Budget::Ballot' do + factory :budget_ballot, class: "Budget::Ballot" do association :user, factory: :user budget end - factory :budget_ballot_line, class: 'Budget::Ballot::Line' do + factory :budget_ballot_line, class: "Budget::Ballot::Line" do association :ballot, factory: :budget_ballot association :investment, factory: :budget_investment end - factory :budget_reclassified_vote, class: 'Budget::ReclassifiedVote' do + factory :budget_reclassified_vote, class: "Budget::ReclassifiedVote" do user association :investment, factory: :budget_investment reason "unfeasible" @@ -199,9 +199,9 @@ FactoryBot.define do sequence(:name) { |n| "Valuator Group #{n}" } end - factory :heading_content_block, class: 'Budget::ContentBlock' do + factory :heading_content_block, class: "Budget::ContentBlock" do association :heading, factory: :budget_heading - locale 'en' - body 'Some heading contents' + locale "en" + body "Some heading contents" end end diff --git a/spec/features/budgets/budgets_spec.rb b/spec/features/budgets/budgets_spec.rb index b115d6e52..0aa886014 100644 --- a/spec/features/budgets/budgets_spec.rb +++ b/spec/features/budgets/budgets_spec.rb @@ -1,40 +1,40 @@ -require 'rails_helper' +require "rails_helper" -feature 'Budgets' do +feature "Budgets" do let(:budget) { create(:budget) } let(:level_two_user) { create(:user, :level_two) } - let(:allowed_phase_list) { ['balloting', 'reviewing_ballots', 'finished'] } + let(:allowed_phase_list) { ["balloting", "reviewing_ballots", "finished"] } - context 'Index' do + context "Index" do - scenario 'Show normal index with links' do + scenario "Show normal index with links" do group1 = create(:budget_group, budget: budget) group2 = create(:budget_group, budget: budget) heading1 = create(:budget_heading, group: group1) heading2 = create(:budget_heading, group: group2) - budget.update_attributes(phase: 'informing') + budget.update_attributes(phase: "informing") visit budgets_path within("#budget_heading") do expect(page).to have_content(budget.name) expect(page).to have_content(budget.description) - expect(page).to have_content('Actual phase') - expect(page).to have_content('Information') - expect(page).to have_link('Help with participatory budgets') - expect(page).to have_link('See all phases') + expect(page).to have_content("Actual phase") + expect(page).to have_content("Information") + expect(page).to have_link("Help with participatory budgets") + expect(page).to have_link("See all phases") end - budget.update_attributes(phase: 'publishing_prices') + budget.update_attributes(phase: "publishing_prices") visit budgets_path within("#budget_heading") do - expect(page).to have_content('Publishing projects prices') + expect(page).to have_content("Publishing projects prices") end - within('#budget_info') do + within("#budget_info") do expect(page).to have_content(group1.name) expect(page).to have_content(group2.name) expect(page).to have_content(heading1.name) @@ -46,7 +46,7 @@ feature 'Budgets' do expect(page).not_to have_content("#finished_budgets") end - scenario 'Show finished budgets list' do + scenario "Show finished budgets list" do finished_budget_1 = create(:budget, :finished) finished_budget_2 = create(:budget, :finished) drafting_budget = create(:budget, :drafting) @@ -132,7 +132,7 @@ feature 'Budgets' do end end - scenario 'Show investment links only on balloting or later' do + scenario "Show investment links only on balloting or later" do budget = create(:budget) group = create(:budget_group, budget: budget) @@ -149,12 +149,12 @@ feature 'Budgets' do end end - scenario 'Not show investment links earlier of balloting ' do + scenario "Not show investment links earlier of balloting " do budget = create(:budget) group = create(:budget_group, budget: budget) heading = create(:budget_heading, group: group) - phases_without_links = ['drafting','informing'] + phases_without_links = ["drafting", "informing"] not_allowed_phase_list = Budget::Phase::PHASE_KINDS - phases_without_links - allowed_phase_list @@ -188,45 +188,45 @@ feature 'Budgets' do end end - scenario 'Index shows only published phases' do + scenario "Index shows only published phases" do budget.update(phase: :finished) phases = budget.phases - phases.drafting.update(starts_at: '30-12-2017', ends_at: '31-12-2017', enabled: true, - description: 'Description of drafting phase', - summary: '

This is the summary for drafting phase

') + phases.drafting.update(starts_at: "30-12-2017", ends_at: "31-12-2017", enabled: true, + description: "Description of drafting phase", + summary: "

This is the summary for drafting phase

") - phases.accepting.update(starts_at: '01-01-2018', ends_at: '10-01-2018', enabled: true, - description: 'Description of accepting phase', - summary: 'This is the summary for accepting phase') + phases.accepting.update(starts_at: "01-01-2018", ends_at: "10-01-2018", enabled: true, + description: "Description of accepting phase", + summary: "This is the summary for accepting phase") - phases.reviewing.update(starts_at: '11-01-2018', ends_at: '20-01-2018', enabled: false, - description: 'Description of reviewing phase', - summary: 'This is the summary for reviewing phase') + phases.reviewing.update(starts_at: "11-01-2018", ends_at: "20-01-2018", enabled: false, + description: "Description of reviewing phase", + summary: "This is the summary for reviewing phase") - phases.selecting.update(starts_at: '21-01-2018', ends_at: '01-02-2018', enabled: true, - description: 'Description of selecting phase', - summary: 'This is the summary for selecting phase') + phases.selecting.update(starts_at: "21-01-2018", ends_at: "01-02-2018", enabled: true, + description: "Description of selecting phase", + summary: "This is the summary for selecting phase") - phases.valuating.update(starts_at: '10-02-2018', ends_at: '20-02-2018', enabled: false, - description: 'Description of valuating phase', - summary: 'This is the summary for valuating phase') + phases.valuating.update(starts_at: "10-02-2018", ends_at: "20-02-2018", enabled: false, + description: "Description of valuating phase", + summary: "This is the summary for valuating phase") - phases.publishing_prices.update(starts_at: '21-02-2018', ends_at: '01-03-2018', enabled: false, - description: 'Description of publishing prices phase', - summary: 'This is the summary for publishing_prices phase') + phases.publishing_prices.update(starts_at: "21-02-2018", ends_at: "01-03-2018", enabled: false, + description: "Description of publishing prices phase", + summary: "This is the summary for publishing_prices phase") - phases.balloting.update(starts_at: '02-03-2018', ends_at: '10-03-2018', enabled: true, - description: 'Description of balloting phase', - summary: 'This is the summary for balloting phase') + phases.balloting.update(starts_at: "02-03-2018", ends_at: "10-03-2018", enabled: true, + description: "Description of balloting phase", + summary: "This is the summary for balloting phase") - phases.reviewing_ballots.update(starts_at: '11-03-2018', ends_at: '20-03-2018', enabled: false, - description: 'Description of reviewing ballots phase', - summary: 'This is the summary for reviewing_ballots phase') + phases.reviewing_ballots.update(starts_at: "11-03-2018", ends_at: "20-03-2018", enabled: false, + description: "Description of reviewing ballots phase", + summary: "This is the summary for reviewing_ballots phase") - phases.finished.update(starts_at: '21-03-2018', ends_at: '30-03-2018', enabled: true, - description: 'Description of finished phase', - summary: 'This is the summary for finished phase') + phases.finished.update(starts_at: "21-03-2018", ends_at: "30-03-2018", enabled: true, + description: "Description of finished phase", + summary: "This is the summary for finished phase") visit budgets_path @@ -239,7 +239,7 @@ feature 'Budgets' do expect(page).not_to have_content "This is the summary for publishing_prices phase" expect(page).not_to have_content "February 21, 2018 - March 01, 2018" expect(page).not_to have_content "This is the summary for reviewing_ballots phase" - expect(page).not_to have_content "March 11, 2018 - March 20, 2018'" + expect(page).not_to have_content "March 11, 2018 - March 20, 2018" expect(page).to have_content "This is the summary for accepting phase" expect(page).to have_content "January 01, 2018 - January 20, 2018" @@ -348,7 +348,7 @@ feature 'Budgets' do end end - context 'Show' do + context "Show" do scenario "List all groups" do group1 = create(:budget_group, budget: budget) @@ -470,7 +470,7 @@ feature 'Budgets' do background do logout - budget.update(phase: 'drafting') + budget.update(phase: "drafting") create(:budget) end @@ -503,10 +503,10 @@ feature 'Budgets' do end - context 'Accepting' do + context "Accepting" do background do - budget.update(phase: 'accepting') + budget.update(phase: "accepting") end context "Permissions" do diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index c82018cac..26cb0350a 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -1,10 +1,10 @@ -require 'rails_helper' -require 'sessions_helper' +require "rails_helper" +require "sessions_helper" -feature 'Budget Investments' do +feature "Budget Investments" do - let(:author) { create(:user, :level_two, username: 'Isabel') } + let(:author) { create(:user, :level_two, username: "Isabel") } let(:budget) { create(:budget, name: "Big Budget") } let(:other_budget) { create(:budget, name: "What a Budget!") } let(:group) { create(:budget_group, name: "Health", budget: budget) } @@ -15,19 +15,19 @@ feature 'Budget Investments' do "budget_investment_path" before do - Setting['feature.allow_images'] = true + Setting["feature.allow_images"] = true end after do - Setting['feature.allow_images'] = nil + Setting["feature.allow_images"] = nil end context "Concerns" do - it_behaves_like 'notifiable in-app', Budget::Investment - it_behaves_like 'relationable', Budget::Investment + it_behaves_like "notifiable in-app", Budget::Investment + it_behaves_like "relationable", Budget::Investment end - scenario 'Index' do + scenario "Index" do investments = [create(:budget_investment, heading: heading), create(:budget_investment, heading: heading), create(:budget_investment, :feasible, heading: heading)] @@ -37,9 +37,9 @@ feature 'Budget Investments' do visit budget_path(budget) click_link "Health" - expect(page).to have_selector('#budget-investments .budget-investment', count: 3) + expect(page).to have_selector("#budget-investments .budget-investment", count: 3) investments.each do |investment| - within('#budget-investments') do + within("#budget-investments") do expect(page).to have_content investment.title expect(page).to have_css("a[href='#{budget_investment_path(budget_id: budget.id, id: investment.id)}']", text: investment.title) expect(page).not_to have_content(unfeasible_investment.title) @@ -47,38 +47,38 @@ feature 'Budget Investments' do end end - scenario 'Index view mode' do + scenario "Index view mode" do investments = [create(:budget_investment, heading: heading), create(:budget_investment, heading: heading), create(:budget_investment, heading: heading)] visit budget_path(budget) - click_link 'Health' + click_link "Health" - click_button 'View mode' + click_button "View mode" - click_link 'List' + click_link "List" investments.each do |investment| - within('#budget-investments') do + within("#budget-investments") do expect(page).to have_link investment.title expect(page).not_to have_content(investment.description) end end - click_button 'View mode' + click_button "View mode" - click_link 'Cards' + click_link "Cards" investments.each do |investment| - within('#budget-investments') do + within("#budget-investments") do expect(page).to have_link investment.title expect(page).to have_content(investment.description) end end end - scenario 'Index should show investment descriptive image only when is defined' do + scenario "Index should show investment descriptive image only when is defined" do investment = create(:budget_investment, heading: heading) investment_with_image = create(:budget_investment, heading: heading) image = create(:image, imageable: investment_with_image) @@ -93,7 +93,7 @@ feature 'Budget Investments' do end end - scenario 'Index should show a map if heading has coordinates defined', :js do + scenario "Index should show a map if heading has coordinates defined", :js do create(:budget_investment, heading: heading) visit budget_investments_path(budget, heading_id: heading.id) within("#sidebar") do @@ -111,7 +111,7 @@ feature 'Budget Investments' do context("Search") do - scenario 'Search by text' do + scenario "Search by text" do investment1 = create(:budget_investment, heading: heading, title: "Get Schwifty") investment2 = create(:budget_investment, heading: heading, title: "Schwifty Hello") investment3 = create(:budget_investment, heading: heading, title: "Do not show me") @@ -124,7 +124,7 @@ feature 'Budget Investments' do end within("#budget-investments") do - expect(page).to have_css('.budget-investment', count: 2) + expect(page).to have_css(".budget-investment", count: 2) expect(page).to have_content(investment1.title) expect(page).to have_content(investment2.title) @@ -168,7 +168,7 @@ feature 'Budget Investments' do visit budget_investments_path(budget) click_link "Advanced search" - select Setting['official_level_1_name'], from: "advanced_search_official_level" + select Setting["official_level_1_name"], from: "advanced_search_official_level" click_button "Filter" expect(page).to have_content("There are 2 investments") @@ -191,7 +191,7 @@ feature 'Budget Investments' do visit budget_investments_path(budget) click_link "Advanced search" - select Setting['official_level_2_name'], from: "advanced_search_official_level" + select Setting["official_level_2_name"], from: "advanced_search_official_level" click_button "Filter" expect(page).to have_content("There are 2 investments") @@ -214,7 +214,7 @@ feature 'Budget Investments' do visit budget_investments_path(budget) click_link "Advanced search" - select Setting['official_level_3_name'], from: "advanced_search_official_level" + select Setting["official_level_3_name"], from: "advanced_search_official_level" click_button "Filter" expect(page).to have_content("There are 2 investments") @@ -237,7 +237,7 @@ feature 'Budget Investments' do visit budget_investments_path(budget) click_link "Advanced search" - select Setting['official_level_4_name'], from: "advanced_search_official_level" + select Setting["official_level_4_name"], from: "advanced_search_official_level" click_button "Filter" expect(page).to have_content("There are 2 investments") @@ -260,7 +260,7 @@ feature 'Budget Investments' do visit budget_investments_path(budget) click_link "Advanced search" - select Setting['official_level_5_name'], from: "advanced_search_official_level" + select Setting["official_level_5_name"], from: "advanced_search_official_level" click_button "Filter" expect(page).to have_content("There are 2 investments") @@ -416,7 +416,7 @@ feature 'Budget Investments' do click_link "Advanced search" fill_in "Write the text", with: "Schwifty" - select Setting['official_level_1_name'], from: "advanced_search_official_level" + select Setting["official_level_1_name"], from: "advanced_search_official_level" select "Last 24 hours", from: "js-advanced-search-date-min" click_button "Filter" @@ -433,7 +433,7 @@ feature 'Budget Investments' do click_link "Advanced search" fill_in "Write the text", with: "Schwifty" - select Setting['official_level_1_name'], from: "advanced_search_official_level" + select Setting["official_level_1_name"], from: "advanced_search_official_level" select "Last 24 hours", from: "js-advanced-search-date-min" click_button "Filter" @@ -442,8 +442,8 @@ feature 'Budget Investments' do within "#js-advanced-search" do expect(page).to have_selector("input[name='search'][value='Schwifty']") - expect(page).to have_select('advanced_search[official_level]', selected: Setting['official_level_1_name']) - expect(page).to have_select('advanced_search[date_min]', selected: 'Last 24 hours') + expect(page).to have_select("advanced_search[official_level]", selected: Setting["official_level_1_name"]) + expect(page).to have_select("advanced_search[date_min]", selected: "Last 24 hours") end end @@ -452,16 +452,16 @@ feature 'Budget Investments' do click_link "Advanced search" select "Customized", from: "js-advanced-search-date-min" - fill_in "advanced_search_date_min", with: 7.days.ago.strftime('%d/%m/%Y') - fill_in "advanced_search_date_max", with: 1.day.ago.strftime('%d/%m/%Y') + fill_in "advanced_search_date_min", with: 7.days.ago.strftime("%d/%m/%Y") + fill_in "advanced_search_date_max", with: 1.day.ago.strftime("%d/%m/%Y") click_button "Filter" expect(page).to have_content("investments cannot be found") within "#js-advanced-search" do - expect(page).to have_select('advanced_search[date_min]', selected: 'Customized') - expect(page).to have_selector("input[name='advanced_search[date_min]'][value*='#{7.days.ago.strftime('%d/%m/%Y')}']") - expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime('%d/%m/%Y')}']") + expect(page).to have_select("advanced_search[date_min]", selected: "Customized") + expect(page).to have_selector("input[name='advanced_search[date_min]'][value*='#{7.days.ago.strftime("%d/%m/%Y")}']") + expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime("%d/%m/%Y")}']") end end @@ -471,7 +471,7 @@ feature 'Budget Investments' do context("Filters") do - scenario 'by unfeasibility' do + scenario "by unfeasibility" do investment1 = create(:budget_investment, :unfeasible, heading: heading, valuation_finished: true) investment2 = create(:budget_investment, :feasible, heading: heading) investment3 = create(:budget_investment, heading: heading) @@ -480,7 +480,7 @@ feature 'Budget Investments' do visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unfeasible") within("#budget-investments") do - expect(page).to have_css('.budget-investment', count: 1) + expect(page).to have_css(".budget-investment", count: 1) expect(page).to have_content(investment1.title) expect(page).not_to have_content(investment2.title) @@ -491,11 +491,11 @@ feature 'Budget Investments' do scenario "by unfeasibilty link for group with one heading" do budget.update(phase: :balloting) - group = create(:budget_group, name: 'All City', budget: budget) + group = create(:budget_group, name: "All City", budget: budget) heading = create(:budget_heading, name: "Madrid", group: group) visit budget_path(budget) - click_link 'See unfeasible investments' + click_link "See unfeasible investments" click_link "All City" @@ -505,16 +505,16 @@ feature 'Budget Investments' do scenario "by unfeasibilty link for group with many headings" do budget.update(phase: :balloting) - group = create(:budget_group, name: 'Districts', budget: budget) - heading1 = create(:budget_heading, name: 'Carabanchel', group: group) - heading2 = create(:budget_heading, name: 'Barajas', group: group) + group = create(:budget_group, name: "Districts", budget: budget) + heading1 = create(:budget_heading, name: "Carabanchel", group: group) + heading2 = create(:budget_heading, name: "Barajas", group: group) visit budget_path(budget) - click_link 'See unfeasible investments' + click_link "See unfeasible investments" - click_link 'Districts' - click_link 'Carabanchel' + click_link "Districts" + click_link "Carabanchel" expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unfeasible") expect(page).to have_current_path(expected_path) @@ -582,7 +582,7 @@ feature 'Budget Investments' do end context "Orders" do - before { budget.update(phase: 'selecting') } + before { budget.update(phase: "selecting") } scenario "Default order is random" do per_page = Kaminari.config.default_per_page @@ -613,7 +613,7 @@ feature 'Budget Investments' do expect(order).not_to eq(new_order) end - scenario 'Random order maintained with pagination' do + scenario "Random order maintained with pagination" do per_page = Kaminari.config.default_per_page (per_page + 2).times { create(:budget_investment, heading: heading) } @@ -621,17 +621,17 @@ feature 'Budget Investments' do order = all(".budget-investment h3").collect {|i| i.text } - click_link 'Next' + click_link "Next" expect(page).to have_content "You're on page 2" - click_link 'Previous' + click_link "Previous" expect(page).to have_content "You're on page 1" new_order = all(".budget-investment h3").collect {|i| i.text } expect(order).to eq(new_order) end - scenario 'Random order maintained when going back from show' do + scenario "Random order maintained when going back from show" do 10.times { |i| create(:budget_investment, heading: heading) } visit budget_investments_path(budget, heading_id: heading.id) @@ -649,11 +649,11 @@ feature 'Budget Investments' do 12.times { create(:budget_investment, heading: heading) } # 12 instead of per_page + 2 because in each page there are 10 (in this case), not 25 - visit budget_investments_path(budget, order: 'random') + visit budget_investments_path(budget, order: "random") first_page_investments = investments_order - click_link 'Next' + click_link "Next" expect(page).to have_content "You're on page 2" second_page_investments = investments_order @@ -664,25 +664,25 @@ feature 'Budget Investments' do end - scenario 'Proposals are ordered by confidence_score' do - best_proposal = create(:budget_investment, heading: heading, title: 'Best proposal') + scenario "Proposals are ordered by confidence_score" do + best_proposal = create(:budget_investment, heading: heading, title: "Best proposal") best_proposal.update_column(:confidence_score, 10) - worst_proposal = create(:budget_investment, heading: heading, title: 'Worst proposal') + worst_proposal = create(:budget_investment, heading: heading, title: "Worst proposal") worst_proposal.update_column(:confidence_score, 2) - medium_proposal = create(:budget_investment, heading: heading, title: 'Medium proposal') + medium_proposal = create(:budget_investment, heading: heading, title: "Medium proposal") medium_proposal.update_column(:confidence_score, 5) visit budget_investments_path(budget, heading_id: heading.id) - click_link 'highest rated' - expect(page).to have_selector('a.is-active', text: 'highest rated') + click_link "highest rated" + expect(page).to have_selector("a.is-active", text: "highest rated") - within '#budget-investments' do + within "#budget-investments" do expect(best_proposal.title).to appear_before(medium_proposal.title) expect(medium_proposal.title).to appear_before(worst_proposal.title) end - expect(current_url).to include('order=confidence_score') - expect(current_url).to include('page=1') + expect(current_url).to include("order=confidence_score") + expect(current_url).to include("page=1") end scenario "Each user has a different and consistent random budget investment order" do @@ -701,36 +701,36 @@ feature 'Budget Investments' do expect(@first_user_investments_order).not_to eq(@second_user_investments_order) in_browser(:one) do - click_link 'Next' + click_link "Next" expect(page).to have_content "You're on page 2" - click_link 'Previous' + click_link "Previous" expect(page).to have_content "You're on page 1" expect(investments_order).to eq(@first_user_investments_order) end in_browser(:two) do - click_link 'Next' + click_link "Next" expect(page).to have_content "You're on page 2" - click_link 'Previous' + click_link "Previous" expect(page).to have_content "You're on page 1" expect(investments_order).to eq(@second_user_investments_order) end end - scenario 'Each user has a equal and consistent budget investment order when the random_seed is equal' do + scenario "Each user has a equal and consistent budget investment order when the random_seed is equal" do (Kaminari.config.default_per_page * 1.3).to_i.times { create(:budget_investment, heading: heading) } in_browser(:one) do - visit budget_investments_path(budget, heading: heading, random_seed: '1') + visit budget_investments_path(budget, heading: heading, random_seed: "1") @first_user_investments_order = investments_order end in_browser(:two) do - visit budget_investments_path(budget, heading: heading, random_seed: '1') + visit budget_investments_path(budget, heading: heading, random_seed: "1") @second_user_investments_order = investments_order end @@ -761,10 +761,10 @@ feature 'Budget Investments' do end end - scenario 'Order is random if budget is finished' do + scenario "Order is random if budget is finished" do 10.times { create(:budget_investment) } - budget.update(phase: 'finished') + budget.update(phase: "finished") visit budget_investments_path(budget, heading_id: heading.id) order = all(".budget-investment h3").collect {|i| i.text } @@ -803,82 +803,82 @@ feature 'Budget Investments' do end - context 'Phase I - Accepting' do - before { budget.update(phase: 'accepting') } + context "Phase I - Accepting" do + before { budget.update(phase: "accepting") } - scenario 'Create with invisible_captcha honeypot field' do + scenario "Create with invisible_captcha honeypot field" do login_as(author) visit new_budget_investment_path(budget_id: budget.id) - select heading.name, from: 'budget_investment_heading_id' - fill_in 'budget_investment_title', with: 'I am a bot' - fill_in 'budget_investment_subtitle', with: 'This is the honeypot' - fill_in 'budget_investment_description', with: 'This is the description' - check 'budget_investment_terms_of_service' + select heading.name, from: "budget_investment_heading_id" + fill_in "budget_investment_title", with: "I am a bot" + fill_in "budget_investment_subtitle", with: "This is the honeypot" + fill_in "budget_investment_description", with: "This is the description" + check "budget_investment_terms_of_service" - click_button 'Create Investment' + click_button "Create Investment" expect(page.status_code).to eq(200) expect(page.html).to be_empty expect(page).to have_current_path(budget_investments_path(budget_id: budget.id)) end - scenario 'Create budget investment too fast' do + scenario "Create budget investment too fast" do allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY) login_as(author) visit new_budget_investment_path(budget_id: budget.id) - select heading.name, from: 'budget_investment_heading_id' - fill_in 'budget_investment_title', with: 'I am a bot' - fill_in 'budget_investment_description', with: 'This is the description' - check 'budget_investment_terms_of_service' + select heading.name, from: "budget_investment_heading_id" + fill_in "budget_investment_title", with: "I am a bot" + fill_in "budget_investment_description", with: "This is the description" + check "budget_investment_terms_of_service" - click_button 'Create Investment' + click_button "Create Investment" - expect(page).to have_content 'Sorry, that was too quick! Please resubmit' + expect(page).to have_content "Sorry, that was too quick! Please resubmit" expect(page).to have_current_path(new_budget_investment_path(budget_id: budget.id)) end - scenario 'Create' do + scenario "Create" do login_as(author) visit new_budget_investment_path(budget_id: budget.id) - select heading.name, from: 'budget_investment_heading_id' - fill_in 'budget_investment_title', with: 'Build a skyscraper' - fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds' - fill_in 'budget_investment_location', with: 'City center' - fill_in 'budget_investment_organization_name', with: 'T.I.A.' - fill_in 'budget_investment_tag_list', with: 'Towers' - check 'budget_investment_terms_of_service' + select heading.name, from: "budget_investment_heading_id" + fill_in "budget_investment_title", with: "Build a skyscraper" + fill_in "budget_investment_description", with: "I want to live in a high tower over the clouds" + fill_in "budget_investment_location", with: "City center" + fill_in "budget_investment_organization_name", with: "T.I.A." + fill_in "budget_investment_tag_list", with: "Towers" + check "budget_investment_terms_of_service" - click_button 'Create Investment' + click_button "Create Investment" - expect(page).to have_content 'Investment created successfully' - expect(page).to have_content 'Build a skyscraper' - expect(page).to have_content 'I want to live in a high tower over the clouds' - expect(page).to have_content 'City center' - expect(page).to have_content 'T.I.A.' - expect(page).to have_content 'Towers' + expect(page).to have_content "Investment created successfully" + expect(page).to have_content "Build a skyscraper" + expect(page).to have_content "I want to live in a high tower over the clouds" + expect(page).to have_content "City center" + expect(page).to have_content "T.I.A." + expect(page).to have_content "Towers" visit user_url(author, filter: :budget_investments) - expect(page).to have_content '1 Investment' - expect(page).to have_content 'Build a skyscraper' + expect(page).to have_content "1 Investment" + expect(page).to have_content "Build a skyscraper" end - scenario 'Errors on create' do + scenario "Errors on create" do login_as(author) visit new_budget_investment_path(budget_id: budget.id) - click_button 'Create Investment' + click_button "Create Investment" expect(page).to have_content error_message end - context 'Suggest' do + context "Suggest" do factory = :budget_investment - scenario 'Show up to 5 suggestions', :js do + scenario "Show up to 5 suggestions", :js do login_as(author) %w(first second third fourth fifth sixth).each do |ordinal| @@ -894,7 +894,7 @@ feature 'Budget Investments' do end end - scenario 'No found suggestions', :js do + scenario "No found suggestions", :js do login_as(author) %w(first second third fourth fifth sixth).each do |ordinal| @@ -904,8 +904,8 @@ feature 'Budget Investments' do visit new_budget_investment_path(budget) fill_in "budget_investment_title", with: "item" - within('div#js-suggest') do - expect(page).not_to have_content 'You are seeing' + within("div#js-suggest") do + expect(page).not_to have_content "You are seeing" end end @@ -919,8 +919,8 @@ feature 'Budget Investments' do visit new_budget_investment_path(other_budget) fill_in "budget_investment_title", with: "search" - within('div#js-suggest') do - expect(page).not_to have_content 'You are seeing' + within("div#js-suggest") do + expect(page).not_to have_content "You are seeing" end end end @@ -930,10 +930,10 @@ feature 'Budget Investments' do visit budget_investments_path(budget, heading_id: heading.id) - expect(page).not_to have_link('Check my ballot') - expect(page).not_to have_css('#progress_bar') - within('#sidebar') do - expect(page).not_to have_content('My ballot') + expect(page).not_to have_link("Check my ballot") + expect(page).not_to have_css("#progress_bar") + within("#sidebar") do + expect(page).not_to have_content("My ballot") end end @@ -946,8 +946,8 @@ feature 'Budget Investments' do visit new_budget_investment_path(budget_id: budget.id) - select_options = find('#budget_investment_heading_id').all('option').collect(&:text) - expect(select_options.first).to eq('') + select_options = find("#budget_investment_heading_id").all("option").collect(&:text) + expect(select_options.first).to eq("") expect(select_options.second).to eq("Toda la ciudad") expect(select_options.third).to eq("Health: More health professionals") expect(select_options.fourth).to eq("Health: More hospitals") @@ -1036,18 +1036,18 @@ feature 'Budget Investments' do end - scenario 'Can access the community' do - Setting['feature.community'] = true + scenario "Can access the community" do + Setting["feature.community"] = true investment = create(:budget_investment, heading: heading) visit budget_investment_path(budget_id: budget.id, id: investment.id) expect(page).to have_content "Access the community" - Setting['feature.community'] = false + Setting["feature.community"] = false end - scenario 'Can not access the community' do - Setting['feature.community'] = false + scenario "Can not access the community" do + Setting["feature.community"] = false investment = create(:budget_investment, heading: heading) visit budget_investment_path(budget_id: budget.id, id: investment.id) @@ -1078,7 +1078,7 @@ feature 'Budget Investments' do group: group, heading: heading, price: 16, - price_explanation: 'Every wheel is 4 euros, so total is 16') + price_explanation: "Every wheel is 4 euros, so total is 16") end background do @@ -1174,7 +1174,7 @@ feature 'Budget Investments' do end scenario "Show (not selected budget investment)" do - budget.update(phase: 'balloting') + budget.update(phase: "balloting") user = create(:user) login_as(user) @@ -1219,7 +1219,7 @@ feature 'Budget Investments' do budget: budget, group: group, heading: heading, - unfeasibility_explanation: 'Local government is not competent in this matter') + unfeasibility_explanation: "Local government is not competent in this matter") visit budget_investment_path(budget_id: budget.id, id: investment.id) @@ -1237,7 +1237,7 @@ feature 'Budget Investments' do budget: budget, group: group, heading: heading, - unfeasibility_explanation: 'Local government is not competent in this matter') + unfeasibility_explanation: "Local government is not competent in this matter") visit budget_investment_path(budget_id: budget.id, id: investment.id) @@ -1300,7 +1300,7 @@ feature 'Budget Investments' do within("#budget_investment_#{sp1.id}") do expect(page).to have_content(sp1.title) - click_link('Delete') + click_link("Delete") end visit user_path(user, tab: :budget_investments) @@ -1483,25 +1483,25 @@ feature 'Budget Investments' do end end - scenario 'Order by cost (only when balloting)' do - mid_investment = create(:budget_investment, :selected, heading: heading, title: 'Build a nice house', price: 1000) + scenario "Order by cost (only when balloting)" do + mid_investment = create(:budget_investment, :selected, heading: heading, title: "Build a nice house", price: 1000) mid_investment.update_column(:confidence_score, 10) - low_investment = create(:budget_investment, :selected, heading: heading, title: 'Build an ugly house', price: 1000) + low_investment = create(:budget_investment, :selected, heading: heading, title: "Build an ugly house", price: 1000) low_investment.update_column(:confidence_score, 5) - high_investment = create(:budget_investment, :selected, heading: heading, title: 'Build a skyscraper', price: 20000) + high_investment = create(:budget_investment, :selected, heading: heading, title: "Build a skyscraper", price: 20000) visit budget_investments_path(budget, heading_id: heading.id) - click_link 'by price' - expect(page).to have_selector('a.is-active', text: 'by price') + click_link "by price" + expect(page).to have_selector("a.is-active", text: "by price") - within '#budget-investments' do + within "#budget-investments" do expect(high_investment.title).to appear_before(mid_investment.title) expect(mid_investment.title).to appear_before(low_investment.title) end - expect(current_url).to include('order=price') - expect(current_url).to include('page=1') + expect(current_url).to include("order=price") + expect(current_url).to include("page=1") end scenario "Show" do @@ -1526,11 +1526,11 @@ feature 'Budget Investments' do end scenario "Confirm", :js do - budget.update(phase: 'balloting') + budget.update(phase: "balloting") user = create(:user, :level_two) - global_group = create(:budget_group, budget: budget, name: 'Global Group') - global_heading = create(:budget_heading, group: global_group, name: 'Global Heading', + global_group = create(:budget_group, budget: budget, name: "Global Group") + global_heading = create(:budget_heading, group: global_group, name: "Global Heading", latitude: -43.145412, longitude: 12.009423) carabanchel_heading = create(:budget_heading, group: group, name: "Carabanchel") @@ -1622,19 +1622,19 @@ feature 'Budget Investments' do end end - scenario 'Ballot is visible' do + scenario "Ballot is visible" do login_as(author) visit budget_investments_path(budget, heading_id: heading.id) - expect(page).to have_link('Check my ballot') - expect(page).to have_css('#progress_bar') - within('#sidebar') do - expect(page).to have_content('My ballot') + expect(page).to have_link("Check my ballot") + expect(page).to have_css("#progress_bar") + within("#sidebar") do + expect(page).to have_content("My ballot") end end - scenario 'Show unselected budget investments' do + scenario "Show unselected budget investments" do investment1 = create(:budget_investment, :unselected, :feasible, heading: heading, valuation_finished: true) investment2 = create(:budget_investment, :selected, :feasible, heading: heading, valuation_finished: true) investment3 = create(:budget_investment, :selected, :feasible, heading: heading, valuation_finished: true) @@ -1643,7 +1643,7 @@ feature 'Budget Investments' do visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unselected") within("#budget-investments") do - expect(page).to have_css('.budget-investment', count: 1) + expect(page).to have_css(".budget-investment", count: 1) expect(page).to have_content(investment1.title) expect(page).not_to have_content(investment2.title) @@ -1653,11 +1653,11 @@ feature 'Budget Investments' do end scenario "Shows unselected link for group with one heading" do - group = create(:budget_group, name: 'All City', budget: budget) + group = create(:budget_group, name: "All City", budget: budget) heading = create(:budget_heading, name: "Madrid", group: group) visit budget_path(budget) - click_link 'See investments not selected for balloting phase' + click_link "See investments not selected for balloting phase" click_link "All City" @@ -1666,16 +1666,16 @@ feature 'Budget Investments' do end scenario "Shows unselected link for group with many headings" do - group = create(:budget_group, name: 'Districts', budget: budget) - heading1 = create(:budget_heading, name: 'Carabanchel', group: group) - heading2 = create(:budget_heading, name: 'Barajas', group: group) + group = create(:budget_group, name: "Districts", budget: budget) + heading1 = create(:budget_heading, name: "Carabanchel", group: group) + heading2 = create(:budget_heading, name: "Barajas", group: group) visit budget_path(budget) - click_link 'See investments not selected for balloting phase' + click_link "See investments not selected for balloting phase" - click_link 'Districts' - click_link 'Carabanchel' + click_link "Districts" + click_link "Carabanchel" expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unselected") expect(page).to have_current_path(expected_path) @@ -1747,7 +1747,7 @@ feature 'Budget Investments' do end end - scenario 'Flagging an investment as innapropriate', :js do + scenario "Flagging an investment as innapropriate", :js do user = create(:user) investment = create(:budget_investment, heading: heading) @@ -1765,7 +1765,7 @@ feature 'Budget Investments' do expect(Flag.flagged?(user, investment)).to be end - scenario 'Unflagging an investment', :js do + scenario "Unflagging an investment", :js do user = create(:user) investment = create(:budget_investment, heading: heading) Flag.flag(user, investment) @@ -1784,7 +1784,7 @@ feature 'Budget Investments' do expect(Flag.flagged?(user, investment)).not_to be end - scenario 'Flagging an investment updates the DOM properly', :js do + scenario "Flagging an investment updates the DOM properly", :js do user = create(:user) investment = create(:budget_investment, heading: heading) @@ -1811,7 +1811,7 @@ feature 'Budget Investments' do expect(Flag.flagged?(user, investment)).not_to be end - context 'sidebar map' do + context "sidebar map" do scenario "Display 6 investment's markers on sidebar map", :js do investment1 = create(:budget_investment, heading: heading) investment2 = create(:budget_investment, heading: heading) diff --git a/spec/features/management/budget_investments_spec.rb b/spec/features/management/budget_investments_spec.rb index 3c204f7b5..b1ef635d4 100644 --- a/spec/features/management/budget_investments_spec.rb +++ b/spec/features/management/budget_investments_spec.rb @@ -1,11 +1,11 @@ -require 'rails_helper' +require "rails_helper" -feature 'Budget Investments' do +feature "Budget Investments" do background do login_as_manager - @budget = create(:budget, phase: 'selecting', name: "2033") - @group = create(:budget_group, budget: @budget, name: 'Whole city') + @budget = create(:budget, phase: "selecting", name: "2033") + @group = create(:budget_group, budget: @budget, name: "Whole city") @heading = create(:budget_heading, group: @group, name: "Health") end @@ -19,9 +19,9 @@ feature 'Budget Investments' do management = true context "Create" do - before { @budget.update(phase: 'accepting') } + before { @budget.update(phase: "accepting") } - scenario 'Creating budget investments on behalf of someone, selecting a budget' do + scenario "Creating budget investments on behalf of someone, selecting a budget" do user = create(:user, :level_two) login_managed_user(user) @@ -38,23 +38,23 @@ feature 'Budget Investments' do expect(page).to have_content user.document_number end - select "Health", from: 'budget_investment_heading_id' - fill_in 'budget_investment_title', with: 'Build a park in my neighborhood' - fill_in 'budget_investment_description', with: 'There is no parks here...' - fill_in 'budget_investment_location', with: 'City center' - fill_in 'budget_investment_organization_name', with: 'T.I.A.' - fill_in 'budget_investment_tag_list', with: 'green' + select "Health", from: "budget_investment_heading_id" + fill_in "budget_investment_title", with: "Build a park in my neighborhood" + fill_in "budget_investment_description", with: "There is no parks here..." + fill_in "budget_investment_location", with: "City center" + fill_in "budget_investment_organization_name", with: "T.I.A." + fill_in "budget_investment_tag_list", with: "green" - click_button 'Create Investment' + click_button "Create Investment" - expect(page).to have_content 'Investment created successfully.' + expect(page).to have_content "Investment created successfully." - expect(page).to have_content 'Health' - expect(page).to have_content 'Build a park in my neighborhood' - expect(page).to have_content 'There is no parks here...' - expect(page).to have_content 'City center' - expect(page).to have_content 'T.I.A.' - expect(page).to have_content 'green' + expect(page).to have_content "Health" + expect(page).to have_content "Build a park in my neighborhood" + expect(page).to have_content "There is no parks here..." + expect(page).to have_content "City center" + expect(page).to have_content "T.I.A." + expect(page).to have_content "green" expect(page).to have_content user.name expect(page).to have_content I18n.l(@budget.created_at.to_date) end @@ -88,7 +88,7 @@ feature 'Budget Investments' do click_button "Search" within("#budget-investments") do - expect(page).to have_css('.budget-investment', count: 1) + expect(page).to have_css(".budget-investment", count: 1) expect(page).to have_content(budget_investment1.title) expect(page).not_to have_content(budget_investment2.title) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", @@ -115,7 +115,7 @@ feature 'Budget Investments' do click_button "Search" within("#budget-investments") do - expect(page).to have_css('.budget-investment', count: 1) + expect(page).to have_css(".budget-investment", count: 1) expect(page).not_to have_content(budget_investment1.title) expect(page).to have_content(budget_investment2.title) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", @@ -145,7 +145,7 @@ feature 'Budget Investments' do end within("#budget-investments") do - expect(page).to have_css('.budget-investment', count: 2) + expect(page).to have_css(".budget-investment", count: 2) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", text: budget_investment1.title) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", @@ -210,7 +210,7 @@ feature 'Budget Investments' do context "Supporting" do - scenario 'Supporting budget investments on behalf of someone in index view', :js do + scenario "Supporting budget investments on behalf of someone in index view", :js do budget_investment = create(:budget_investment, budget: @budget, heading: @heading) user = create(:user, :level_two) @@ -232,7 +232,7 @@ feature 'Budget Investments' do end # This test passes ok locally but fails on the last two lines in Travis - xscenario 'Supporting budget investments on behalf of someone in show view', :js do + xscenario "Supporting budget investments on behalf of someone in show view", :js do budget_investment = create(:budget_investment, budget: @budget) user = create(:user, :level_two) @@ -248,7 +248,7 @@ feature 'Budget Investments' do click_link budget_investment.title end - find('.js-in-favor a').click + find(".js-in-favor a").click expect(page).to have_content "1 support" expect(page).to have_content "You have already supported this. Share it!" end @@ -267,7 +267,7 @@ feature 'Budget Investments' do context "Printing" do - scenario 'Printing budget investments' do + scenario "Printing budget investments" do 16.times { create(:budget_investment, budget: @budget, heading: @heading) } click_link "Print budget investments" @@ -277,17 +277,17 @@ feature 'Budget Investments' do click_link "Print budget investments" end - expect(page).to have_css('.budget-investment', count: 15) - expect(page).to have_css("a[href='javascript:window.print();']", text: 'Print') + expect(page).to have_css(".budget-investment", count: 15) + expect(page).to have_css("a[href='javascript:window.print();']", text: "Print") end scenario "Filtering budget investments by heading to be printed", :js do district_9 = create(:budget_heading, group: @group, name: "District Nine") another_heading = create(:budget_heading, group: @group) - low_investment = create(:budget_investment, budget: @budget, title: 'Nuke district 9', heading: district_9, cached_votes_up: 1) - mid_investment = create(:budget_investment, budget: @budget, title: 'Change district 9', heading: district_9, cached_votes_up: 10) - top_investment = create(:budget_investment, budget: @budget, title: 'Destroy district 9', heading: district_9, cached_votes_up: 100) - unvoted_investment = create(:budget_investment, budget: @budget, heading: another_heading, title: 'Add new districts to the city') + low_investment = create(:budget_investment, budget: @budget, title: "Nuke district 9", heading: district_9, cached_votes_up: 1) + mid_investment = create(:budget_investment, budget: @budget, title: "Change district 9", heading: district_9, cached_votes_up: 10) + top_investment = create(:budget_investment, budget: @budget, title: "Destroy district 9", heading: district_9, cached_votes_up: 100) + unvoted_investment = create(:budget_investment, budget: @budget, heading: another_heading, title: "Add new districts to the city") user = create(:user, :level_two) login_managed_user(user) @@ -299,17 +299,17 @@ feature 'Budget Investments' do click_link "Print budget investments" end - within '#budget-investments' do + within "#budget-investments" do expect(page).to have_content(unvoted_investment.title) expect(page).to have_content(mid_investment.title) expect(page).to have_content(top_investment.title) expect(page).to have_content(low_investment.title) end - select 'Whole city: District Nine', from: 'heading_id' + select "Whole city: District Nine", from: "heading_id" click_button("Search") - within '#budget-investments' do + within "#budget-investments" do expect(page).not_to have_content(unvoted_investment.title) expect(top_investment.title).to appear_before(mid_investment.title) expect(mid_investment.title).to appear_before(low_investment.title) diff --git a/spec/shared/features/relationable.rb b/spec/shared/features/relationable.rb index f7bdba175..0771c21b2 100644 --- a/spec/shared/features/relationable.rb +++ b/spec/shared/features/relationable.rb @@ -48,7 +48,7 @@ shared_examples "relationable" do |relationable_model_name| end within("#related_content") do - fill_in 'url', with: "#{Setting['url'] + related2.url}" + fill_in "url", with: "#{Setting["url"] + related2.url}" click_button "Add" end @@ -78,7 +78,7 @@ shared_examples "relationable" do |relationable_model_name| click_on("Add related content") within("#related_content") do - fill_in 'url', with: Setting[:url] + relationable.url.to_s + fill_in "url", with: Setting[:url] + relationable.url.to_s click_button "Add" end