Add missing double quotes
We overlooked a few single quotes while we changed thousands of them.
This commit is contained in:
@@ -5,7 +5,7 @@ module HasOrders
|
|||||||
def has_orders(valid_orders, *args)
|
def has_orders(valid_orders, *args)
|
||||||
before_action(*args) do |c|
|
before_action(*args) do |c|
|
||||||
@valid_orders = valid_orders.respond_to?(:call) ? valid_orders.call(c) : valid_orders.dup
|
@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
|
@current_order = @valid_orders.include?(params[:order]) ? params[:order] : @valid_orders.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module FollowablesHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def followable_class_name(followable)
|
def followable_class_name(followable)
|
||||||
followable.class.to_s.parameterize('_')
|
followable.class.to_s.parameterize("_")
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_or_build_follow(user, followable)
|
def find_or_build_follow(user, followable)
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ module ProposalsHelper
|
|||||||
|
|
||||||
def empty_recommended_proposals_message_text(user)
|
def empty_recommended_proposals_message_text(user)
|
||||||
if user.interests.any?
|
if user.interests.any?
|
||||||
t('proposals.index.recommendations.without_results')
|
t("proposals.index.recommendations.without_results")
|
||||||
else
|
else
|
||||||
t('proposals.index.recommendations.without_interests')
|
t("proposals.index.recommendations.without_interests")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<%= f.text_field :custom_list, value: @process.tag_list_on(:customs).to_s,
|
<%= f.text_field :custom_list, value: @process.tag_list_on(:customs).to_s,
|
||||||
label: false,
|
label: false,
|
||||||
placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"),
|
placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"),
|
||||||
class: 'js-tag-list',
|
class: "js-tag-list",
|
||||||
aria: {describedby: "tag-list-help-text"} %>
|
aria: {describedby: "tag-list-help-text"} %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<% if proposals.any? %>
|
<% if proposals.any? %>
|
||||||
<h3><%= page_entries_info proposals %></h3>
|
<h3><%= page_entries_info proposals %></h3>
|
||||||
|
|
||||||
<%= render 'shared/wide_order_selector', i18n_namespace: "admin.legislation.processes.proposals" %>
|
<%= render "shared/wide_order_selector", i18n_namespace: "admin.legislation.processes.proposals" %>
|
||||||
|
|
||||||
<table class="stack" id="legislation_proposals_list">
|
<table class="stack" id="legislation_proposals_list">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
<h2><%= @process.title %></h2>
|
<h2><%= @process.title %></h2>
|
||||||
|
|
||||||
<%= render 'admin/legislation/processes/subnav', process: @process, active: 'proposals' %>
|
<%= render "admin/legislation/processes/subnav", process: @process, active: "proposals" %>
|
||||||
|
|
||||||
<%= render 'form' %>
|
<%= render "form" %>
|
||||||
<%= render 'proposals', proposals: @proposals %>
|
<%= render "proposals", proposals: @proposals %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<span class="icon-comment" aria-hidden="true"></span>
|
<span class="icon-comment" aria-hidden="true"></span>
|
||||||
|
|
||||||
<div class="comment-number">
|
<div class="comment-number">
|
||||||
<%= t('legislation.annotations.comments.comments_count',
|
<%= t("legislation.annotations.comments.comments_count",
|
||||||
count: annotation.comments.roots.count) %>
|
count: annotation.comments.roots.count) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ default: &default
|
|||||||
pool: 5
|
pool: 5
|
||||||
port: 5432
|
port: 5432
|
||||||
username: postgres
|
username: postgres
|
||||||
password: <%= ENV['POSTGRES_PASSWORD'] %>
|
password: <%= ENV["POSTGRES_PASSWORD"] %>
|
||||||
|
|
||||||
development: &development
|
development: &development
|
||||||
<<: *default
|
<<: *default
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Ckeditor.setup do |config|
|
|||||||
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
|
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
|
||||||
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||||
# available as additional gems.
|
# available as additional gems.
|
||||||
require 'ckeditor/orm/active_record'
|
require "ckeditor/orm/active_record"
|
||||||
|
|
||||||
config.authorize_with :cancan
|
config.authorize_with :cancan
|
||||||
|
|
||||||
|
|||||||
@@ -71,19 +71,19 @@ describe GraphqlController, type: :request do
|
|||||||
let(:query_string) { "{ proposal(id: #{proposal.id}) { title } }" }
|
let(:query_string) { "{ proposal(id: #{proposal.id}) { title } }" }
|
||||||
|
|
||||||
specify "when absent" do
|
specify "when absent" do
|
||||||
get '/graphql', query: query_string
|
get "/graphql", query: query_string
|
||||||
|
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "when specified as the 'null' string" do
|
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)
|
expect(response).to have_http_status(:ok)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "when specified as an empty string" do
|
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)
|
expect(response).to have_http_status(:ok)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :spending_proposal do
|
factory :spending_proposal do
|
||||||
sequence(:title) { |n| "Spending Proposal #{n} title" }
|
sequence(:title) { |n| "Spending Proposal #{n} title" }
|
||||||
description 'Spend money on this'
|
description "Spend money on this"
|
||||||
feasible_explanation 'This proposal is not viable because...'
|
feasible_explanation "This proposal is not viable because..."
|
||||||
external_url 'http://external_documention.org'
|
external_url "http://external_documention.org"
|
||||||
terms_of_service '1'
|
terms_of_service "1"
|
||||||
association :author, factory: :user
|
association :author, factory: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :budget do
|
factory :budget do
|
||||||
sequence(:name) { |n| "#{Faker::Lorem.word} #{n}" }
|
sequence(:name) { |n| "#{Faker::Lorem.word} #{n}" }
|
||||||
currency_symbol "€"
|
currency_symbol "€"
|
||||||
phase 'accepting'
|
phase "accepting"
|
||||||
description_drafting "This budget is drafting"
|
description_drafting "This budget is drafting"
|
||||||
description_informing "This budget is informing"
|
description_informing "This budget is informing"
|
||||||
description_accepting "This budget is accepting"
|
description_accepting "This budget is accepting"
|
||||||
@@ -24,47 +24,47 @@ FactoryBot.define do
|
|||||||
description_finished "This budget is finished"
|
description_finished "This budget is finished"
|
||||||
|
|
||||||
trait :drafting do
|
trait :drafting do
|
||||||
phase 'drafting'
|
phase "drafting"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :informing do
|
trait :informing do
|
||||||
phase 'informing'
|
phase "informing"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :accepting do
|
trait :accepting do
|
||||||
phase 'accepting'
|
phase "accepting"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :reviewing do
|
trait :reviewing do
|
||||||
phase 'reviewing'
|
phase "reviewing"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :selecting do
|
trait :selecting do
|
||||||
phase 'selecting'
|
phase "selecting"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :valuating do
|
trait :valuating do
|
||||||
phase 'valuating'
|
phase "valuating"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :publishing_prices do
|
trait :publishing_prices do
|
||||||
phase 'publishing_prices'
|
phase "publishing_prices"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :balloting do
|
trait :balloting do
|
||||||
phase 'balloting'
|
phase "balloting"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :reviewing_ballots do
|
trait :reviewing_ballots do
|
||||||
phase 'reviewing_ballots'
|
phase "reviewing_ballots"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :finished do
|
trait :finished do
|
||||||
phase 'finished'
|
phase "finished"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_group, class: 'Budget::Group' do
|
factory :budget_group, class: "Budget::Group" do
|
||||||
budget
|
budget
|
||||||
sequence(:name) { |n| "Group #{n}" }
|
sequence(:name) { |n| "Group #{n}" }
|
||||||
|
|
||||||
@@ -73,28 +73,28 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_heading, class: 'Budget::Heading' do
|
factory :budget_heading, class: "Budget::Heading" do
|
||||||
association :group, factory: :budget_group
|
association :group, factory: :budget_group
|
||||||
sequence(:name) { |n| "Heading #{n}" }
|
sequence(:name) { |n| "Heading #{n}" }
|
||||||
price 1000000
|
price 1000000
|
||||||
population 1234
|
population 1234
|
||||||
latitude '40.416775'
|
latitude "40.416775"
|
||||||
longitude '-3.703790'
|
longitude "-3.703790"
|
||||||
|
|
||||||
trait :drafting_budget do
|
trait :drafting_budget do
|
||||||
association :group, factory: [:budget_group, :drafting_budget]
|
association :group, factory: [:budget_group, :drafting_budget]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_investment, class: 'Budget::Investment' do
|
factory :budget_investment, class: "Budget::Investment" do
|
||||||
sequence(:title) { |n| "Budget Investment #{n} title" }
|
sequence(:title) { |n| "Budget Investment #{n} title" }
|
||||||
association :heading, factory: :budget_heading
|
association :heading, factory: :budget_heading
|
||||||
association :author, factory: :user
|
association :author, factory: :user
|
||||||
description 'Spend money on this'
|
description "Spend money on this"
|
||||||
price 10
|
price 10
|
||||||
unfeasibility_explanation ''
|
unfeasibility_explanation ""
|
||||||
skip_map '1'
|
skip_map "1"
|
||||||
terms_of_service '1'
|
terms_of_service "1"
|
||||||
incompatible false
|
incompatible false
|
||||||
|
|
||||||
trait :with_confidence_score do
|
trait :with_confidence_score do
|
||||||
@@ -141,7 +141,7 @@ FactoryBot.define do
|
|||||||
trait :selected_with_price do
|
trait :selected_with_price do
|
||||||
selected
|
selected
|
||||||
price 1000
|
price 1000
|
||||||
price_explanation 'Because of reasons'
|
price_explanation "Because of reasons"
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :unselected do
|
trait :unselected do
|
||||||
@@ -169,7 +169,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_phase, class: 'Budget::Phase' do
|
factory :budget_phase, class: "Budget::Phase" do
|
||||||
budget
|
budget
|
||||||
kind :balloting
|
kind :balloting
|
||||||
summary Faker::Lorem.sentence(3)
|
summary Faker::Lorem.sentence(3)
|
||||||
@@ -179,17 +179,17 @@ FactoryBot.define do
|
|||||||
enabled true
|
enabled true
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_ballot, class: 'Budget::Ballot' do
|
factory :budget_ballot, class: "Budget::Ballot" do
|
||||||
association :user, factory: :user
|
association :user, factory: :user
|
||||||
budget
|
budget
|
||||||
end
|
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 :ballot, factory: :budget_ballot
|
||||||
association :investment, factory: :budget_investment
|
association :investment, factory: :budget_investment
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_reclassified_vote, class: 'Budget::ReclassifiedVote' do
|
factory :budget_reclassified_vote, class: "Budget::ReclassifiedVote" do
|
||||||
user
|
user
|
||||||
association :investment, factory: :budget_investment
|
association :investment, factory: :budget_investment
|
||||||
reason "unfeasible"
|
reason "unfeasible"
|
||||||
@@ -199,9 +199,9 @@ FactoryBot.define do
|
|||||||
sequence(:name) { |n| "Valuator Group #{n}" }
|
sequence(:name) { |n| "Valuator Group #{n}" }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :heading_content_block, class: 'Budget::ContentBlock' do
|
factory :heading_content_block, class: "Budget::ContentBlock" do
|
||||||
association :heading, factory: :budget_heading
|
association :heading, factory: :budget_heading
|
||||||
locale 'en'
|
locale "en"
|
||||||
body 'Some heading contents'
|
body "Some heading contents"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,40 +1,40 @@
|
|||||||
require 'rails_helper'
|
require "rails_helper"
|
||||||
|
|
||||||
feature 'Budgets' do
|
feature "Budgets" do
|
||||||
|
|
||||||
let(:budget) { create(:budget) }
|
let(:budget) { create(:budget) }
|
||||||
let(:level_two_user) { create(:user, :level_two) }
|
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)
|
group1 = create(:budget_group, budget: budget)
|
||||||
group2 = create(:budget_group, budget: budget)
|
group2 = create(:budget_group, budget: budget)
|
||||||
heading1 = create(:budget_heading, group: group1)
|
heading1 = create(:budget_heading, group: group1)
|
||||||
heading2 = create(:budget_heading, group: group2)
|
heading2 = create(:budget_heading, group: group2)
|
||||||
|
|
||||||
budget.update_attributes(phase: 'informing')
|
budget.update_attributes(phase: "informing")
|
||||||
|
|
||||||
visit budgets_path
|
visit budgets_path
|
||||||
|
|
||||||
within("#budget_heading") do
|
within("#budget_heading") do
|
||||||
expect(page).to have_content(budget.name)
|
expect(page).to have_content(budget.name)
|
||||||
expect(page).to have_content(budget.description)
|
expect(page).to have_content(budget.description)
|
||||||
expect(page).to have_content('Actual phase')
|
expect(page).to have_content("Actual phase")
|
||||||
expect(page).to have_content('Information')
|
expect(page).to have_content("Information")
|
||||||
expect(page).to have_link('Help with participatory budgets')
|
expect(page).to have_link("Help with participatory budgets")
|
||||||
expect(page).to have_link('See all phases')
|
expect(page).to have_link("See all phases")
|
||||||
end
|
end
|
||||||
|
|
||||||
budget.update_attributes(phase: 'publishing_prices')
|
budget.update_attributes(phase: "publishing_prices")
|
||||||
visit budgets_path
|
visit budgets_path
|
||||||
|
|
||||||
within("#budget_heading") do
|
within("#budget_heading") do
|
||||||
expect(page).to have_content('Publishing projects prices')
|
expect(page).to have_content("Publishing projects prices")
|
||||||
end
|
end
|
||||||
|
|
||||||
within('#budget_info') do
|
within("#budget_info") do
|
||||||
expect(page).to have_content(group1.name)
|
expect(page).to have_content(group1.name)
|
||||||
expect(page).to have_content(group2.name)
|
expect(page).to have_content(group2.name)
|
||||||
expect(page).to have_content(heading1.name)
|
expect(page).to have_content(heading1.name)
|
||||||
@@ -46,7 +46,7 @@ feature 'Budgets' do
|
|||||||
expect(page).not_to have_content("#finished_budgets")
|
expect(page).not_to have_content("#finished_budgets")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Show finished budgets list' do
|
scenario "Show finished budgets list" do
|
||||||
finished_budget_1 = create(:budget, :finished)
|
finished_budget_1 = create(:budget, :finished)
|
||||||
finished_budget_2 = create(:budget, :finished)
|
finished_budget_2 = create(:budget, :finished)
|
||||||
drafting_budget = create(:budget, :drafting)
|
drafting_budget = create(:budget, :drafting)
|
||||||
@@ -132,7 +132,7 @@ feature 'Budgets' do
|
|||||||
end
|
end
|
||||||
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)
|
budget = create(:budget)
|
||||||
group = create(:budget_group, budget: budget)
|
group = create(:budget_group, budget: budget)
|
||||||
@@ -149,12 +149,12 @@ feature 'Budgets' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Not show investment links earlier of balloting ' do
|
scenario "Not show investment links earlier of balloting " do
|
||||||
|
|
||||||
budget = create(:budget)
|
budget = create(:budget)
|
||||||
group = create(:budget_group, budget: budget)
|
group = create(:budget_group, budget: budget)
|
||||||
heading = create(:budget_heading, group: group)
|
heading = create(:budget_heading, group: group)
|
||||||
phases_without_links = ['drafting','informing']
|
phases_without_links = ["drafting", "informing"]
|
||||||
not_allowed_phase_list = Budget::Phase::PHASE_KINDS -
|
not_allowed_phase_list = Budget::Phase::PHASE_KINDS -
|
||||||
phases_without_links -
|
phases_without_links -
|
||||||
allowed_phase_list
|
allowed_phase_list
|
||||||
@@ -188,45 +188,45 @@ feature 'Budgets' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Index shows only published phases' do
|
scenario "Index shows only published phases" do
|
||||||
|
|
||||||
budget.update(phase: :finished)
|
budget.update(phase: :finished)
|
||||||
phases = budget.phases
|
phases = budget.phases
|
||||||
phases.drafting.update(starts_at: '30-12-2017', ends_at: '31-12-2017', enabled: true,
|
phases.drafting.update(starts_at: "30-12-2017", ends_at: "31-12-2017", enabled: true,
|
||||||
description: 'Description of drafting phase',
|
description: "Description of drafting phase",
|
||||||
summary: '<p>This is the summary for drafting phase</p>')
|
summary: "<p>This is the summary for drafting phase</p>")
|
||||||
|
|
||||||
phases.accepting.update(starts_at: '01-01-2018', ends_at: '10-01-2018', enabled: true,
|
phases.accepting.update(starts_at: "01-01-2018", ends_at: "10-01-2018", enabled: true,
|
||||||
description: 'Description of accepting phase',
|
description: "Description of accepting phase",
|
||||||
summary: 'This is the summary for 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,
|
phases.reviewing.update(starts_at: "11-01-2018", ends_at: "20-01-2018", enabled: false,
|
||||||
description: 'Description of reviewing phase',
|
description: "Description of reviewing phase",
|
||||||
summary: 'This is the summary for 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,
|
phases.selecting.update(starts_at: "21-01-2018", ends_at: "01-02-2018", enabled: true,
|
||||||
description: 'Description of selecting phase',
|
description: "Description of selecting phase",
|
||||||
summary: 'This is the summary for 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,
|
phases.valuating.update(starts_at: "10-02-2018", ends_at: "20-02-2018", enabled: false,
|
||||||
description: 'Description of valuating phase',
|
description: "Description of valuating phase",
|
||||||
summary: 'This is the summary for 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,
|
phases.publishing_prices.update(starts_at: "21-02-2018", ends_at: "01-03-2018", enabled: false,
|
||||||
description: 'Description of publishing prices phase',
|
description: "Description of publishing prices phase",
|
||||||
summary: 'This is the summary for 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,
|
phases.balloting.update(starts_at: "02-03-2018", ends_at: "10-03-2018", enabled: true,
|
||||||
description: 'Description of balloting phase',
|
description: "Description of balloting phase",
|
||||||
summary: 'This is the summary for 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,
|
phases.reviewing_ballots.update(starts_at: "11-03-2018", ends_at: "20-03-2018", enabled: false,
|
||||||
description: 'Description of reviewing ballots phase',
|
description: "Description of reviewing ballots phase",
|
||||||
summary: 'This is the summary for 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,
|
phases.finished.update(starts_at: "21-03-2018", ends_at: "30-03-2018", enabled: true,
|
||||||
description: 'Description of finished phase',
|
description: "Description of finished phase",
|
||||||
summary: 'This is the summary for finished phase')
|
summary: "This is the summary for finished phase")
|
||||||
|
|
||||||
visit budgets_path
|
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 "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 "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 "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 "This is the summary for accepting phase"
|
||||||
expect(page).to have_content "January 01, 2018 - January 20, 2018"
|
expect(page).to have_content "January 01, 2018 - January 20, 2018"
|
||||||
@@ -348,7 +348,7 @@ feature 'Budgets' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Show' do
|
context "Show" do
|
||||||
|
|
||||||
scenario "List all groups" do
|
scenario "List all groups" do
|
||||||
group1 = create(:budget_group, budget: budget)
|
group1 = create(:budget_group, budget: budget)
|
||||||
@@ -470,7 +470,7 @@ feature 'Budgets' do
|
|||||||
|
|
||||||
background do
|
background do
|
||||||
logout
|
logout
|
||||||
budget.update(phase: 'drafting')
|
budget.update(phase: "drafting")
|
||||||
create(:budget)
|
create(:budget)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -503,10 +503,10 @@ feature 'Budgets' do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Accepting' do
|
context "Accepting" do
|
||||||
|
|
||||||
background do
|
background do
|
||||||
budget.update(phase: 'accepting')
|
budget.update(phase: "accepting")
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Permissions" do
|
context "Permissions" do
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
require 'rails_helper'
|
require "rails_helper"
|
||||||
require 'sessions_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(:budget) { create(:budget, name: "Big Budget") }
|
||||||
let(:other_budget) { create(:budget, name: "What a Budget!") }
|
let(:other_budget) { create(:budget, name: "What a Budget!") }
|
||||||
let(:group) { create(:budget_group, name: "Health", budget: budget) }
|
let(:group) { create(:budget_group, name: "Health", budget: budget) }
|
||||||
@@ -15,19 +15,19 @@ feature 'Budget Investments' do
|
|||||||
"budget_investment_path"
|
"budget_investment_path"
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Setting['feature.allow_images'] = true
|
Setting["feature.allow_images"] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
Setting['feature.allow_images'] = nil
|
Setting["feature.allow_images"] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Concerns" do
|
context "Concerns" do
|
||||||
it_behaves_like 'notifiable in-app', Budget::Investment
|
it_behaves_like "notifiable in-app", Budget::Investment
|
||||||
it_behaves_like 'relationable', Budget::Investment
|
it_behaves_like "relationable", Budget::Investment
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Index' do
|
scenario "Index" do
|
||||||
investments = [create(:budget_investment, heading: heading),
|
investments = [create(:budget_investment, heading: heading),
|
||||||
create(:budget_investment, heading: heading),
|
create(:budget_investment, heading: heading),
|
||||||
create(:budget_investment, :feasible, heading: heading)]
|
create(:budget_investment, :feasible, heading: heading)]
|
||||||
@@ -37,9 +37,9 @@ feature 'Budget Investments' do
|
|||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
click_link "Health"
|
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|
|
investments.each do |investment|
|
||||||
within('#budget-investments') do
|
within("#budget-investments") do
|
||||||
expect(page).to have_content investment.title
|
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).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)
|
expect(page).not_to have_content(unfeasible_investment.title)
|
||||||
@@ -47,38 +47,38 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Index view mode' do
|
scenario "Index view mode" do
|
||||||
investments = [create(:budget_investment, heading: heading),
|
investments = [create(:budget_investment, heading: heading),
|
||||||
create(:budget_investment, heading: heading),
|
create(:budget_investment, heading: heading),
|
||||||
create(:budget_investment, heading: heading)]
|
create(:budget_investment, heading: heading)]
|
||||||
|
|
||||||
visit budget_path(budget)
|
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|
|
investments.each do |investment|
|
||||||
within('#budget-investments') do
|
within("#budget-investments") do
|
||||||
expect(page).to have_link investment.title
|
expect(page).to have_link investment.title
|
||||||
expect(page).not_to have_content(investment.description)
|
expect(page).not_to have_content(investment.description)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
click_button 'View mode'
|
click_button "View mode"
|
||||||
|
|
||||||
click_link 'Cards'
|
click_link "Cards"
|
||||||
|
|
||||||
investments.each do |investment|
|
investments.each do |investment|
|
||||||
within('#budget-investments') do
|
within("#budget-investments") do
|
||||||
expect(page).to have_link investment.title
|
expect(page).to have_link investment.title
|
||||||
expect(page).to have_content(investment.description)
|
expect(page).to have_content(investment.description)
|
||||||
end
|
end
|
||||||
end
|
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 = create(:budget_investment, heading: heading)
|
||||||
investment_with_image = create(:budget_investment, heading: heading)
|
investment_with_image = create(:budget_investment, heading: heading)
|
||||||
image = create(:image, imageable: investment_with_image)
|
image = create(:image, imageable: investment_with_image)
|
||||||
@@ -93,7 +93,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
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)
|
create(:budget_investment, heading: heading)
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
within("#sidebar") do
|
within("#sidebar") do
|
||||||
@@ -111,7 +111,7 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
context("Search") do
|
context("Search") do
|
||||||
|
|
||||||
scenario 'Search by text' do
|
scenario "Search by text" do
|
||||||
investment1 = create(:budget_investment, heading: heading, title: "Get Schwifty")
|
investment1 = create(:budget_investment, heading: heading, title: "Get Schwifty")
|
||||||
investment2 = create(:budget_investment, heading: heading, title: "Schwifty Hello")
|
investment2 = create(:budget_investment, heading: heading, title: "Schwifty Hello")
|
||||||
investment3 = create(:budget_investment, heading: heading, title: "Do not show me")
|
investment3 = create(:budget_investment, heading: heading, title: "Do not show me")
|
||||||
@@ -124,7 +124,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
within("#budget-investments") do
|
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(investment1.title)
|
||||||
expect(page).to have_content(investment2.title)
|
expect(page).to have_content(investment2.title)
|
||||||
@@ -168,7 +168,7 @@ feature 'Budget Investments' do
|
|||||||
visit budget_investments_path(budget)
|
visit budget_investments_path(budget)
|
||||||
|
|
||||||
click_link "Advanced search"
|
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"
|
click_button "Filter"
|
||||||
|
|
||||||
expect(page).to have_content("There are 2 investments")
|
expect(page).to have_content("There are 2 investments")
|
||||||
@@ -191,7 +191,7 @@ feature 'Budget Investments' do
|
|||||||
visit budget_investments_path(budget)
|
visit budget_investments_path(budget)
|
||||||
|
|
||||||
click_link "Advanced search"
|
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"
|
click_button "Filter"
|
||||||
|
|
||||||
expect(page).to have_content("There are 2 investments")
|
expect(page).to have_content("There are 2 investments")
|
||||||
@@ -214,7 +214,7 @@ feature 'Budget Investments' do
|
|||||||
visit budget_investments_path(budget)
|
visit budget_investments_path(budget)
|
||||||
|
|
||||||
click_link "Advanced search"
|
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"
|
click_button "Filter"
|
||||||
|
|
||||||
expect(page).to have_content("There are 2 investments")
|
expect(page).to have_content("There are 2 investments")
|
||||||
@@ -237,7 +237,7 @@ feature 'Budget Investments' do
|
|||||||
visit budget_investments_path(budget)
|
visit budget_investments_path(budget)
|
||||||
|
|
||||||
click_link "Advanced search"
|
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"
|
click_button "Filter"
|
||||||
|
|
||||||
expect(page).to have_content("There are 2 investments")
|
expect(page).to have_content("There are 2 investments")
|
||||||
@@ -260,7 +260,7 @@ feature 'Budget Investments' do
|
|||||||
visit budget_investments_path(budget)
|
visit budget_investments_path(budget)
|
||||||
|
|
||||||
click_link "Advanced search"
|
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"
|
click_button "Filter"
|
||||||
|
|
||||||
expect(page).to have_content("There are 2 investments")
|
expect(page).to have_content("There are 2 investments")
|
||||||
@@ -416,7 +416,7 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
click_link "Advanced search"
|
click_link "Advanced search"
|
||||||
fill_in "Write the text", with: "Schwifty"
|
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"
|
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||||
|
|
||||||
click_button "Filter"
|
click_button "Filter"
|
||||||
@@ -433,7 +433,7 @@ feature 'Budget Investments' do
|
|||||||
click_link "Advanced search"
|
click_link "Advanced search"
|
||||||
|
|
||||||
fill_in "Write the text", with: "Schwifty"
|
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"
|
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||||
|
|
||||||
click_button "Filter"
|
click_button "Filter"
|
||||||
@@ -442,8 +442,8 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
within "#js-advanced-search" do
|
within "#js-advanced-search" do
|
||||||
expect(page).to have_selector("input[name='search'][value='Schwifty']")
|
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[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[date_min]", selected: "Last 24 hours")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -452,16 +452,16 @@ feature 'Budget Investments' do
|
|||||||
click_link "Advanced search"
|
click_link "Advanced search"
|
||||||
|
|
||||||
select "Customized", from: "js-advanced-search-date-min"
|
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_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_max", with: 1.day.ago.strftime("%d/%m/%Y")
|
||||||
click_button "Filter"
|
click_button "Filter"
|
||||||
|
|
||||||
expect(page).to have_content("investments cannot be found")
|
expect(page).to have_content("investments cannot be found")
|
||||||
|
|
||||||
within "#js-advanced-search" do
|
within "#js-advanced-search" do
|
||||||
expect(page).to have_select('advanced_search[date_min]', selected: 'Customized')
|
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_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_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime("%d/%m/%Y")}']")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
context("Filters") do
|
context("Filters") do
|
||||||
|
|
||||||
scenario 'by unfeasibility' do
|
scenario "by unfeasibility" do
|
||||||
investment1 = create(:budget_investment, :unfeasible, heading: heading, valuation_finished: true)
|
investment1 = create(:budget_investment, :unfeasible, heading: heading, valuation_finished: true)
|
||||||
investment2 = create(:budget_investment, :feasible, heading: heading)
|
investment2 = create(:budget_investment, :feasible, heading: heading)
|
||||||
investment3 = create(:budget_investment, 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")
|
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unfeasible")
|
||||||
|
|
||||||
within("#budget-investments") do
|
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).to have_content(investment1.title)
|
||||||
expect(page).not_to have_content(investment2.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
|
scenario "by unfeasibilty link for group with one heading" do
|
||||||
budget.update(phase: :balloting)
|
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)
|
heading = create(:budget_heading, name: "Madrid", group: group)
|
||||||
|
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
click_link 'See unfeasible investments'
|
click_link "See unfeasible investments"
|
||||||
|
|
||||||
click_link "All City"
|
click_link "All City"
|
||||||
|
|
||||||
@@ -505,16 +505,16 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
scenario "by unfeasibilty link for group with many headings" do
|
scenario "by unfeasibilty link for group with many headings" do
|
||||||
budget.update(phase: :balloting)
|
budget.update(phase: :balloting)
|
||||||
group = create(:budget_group, name: 'Districts', budget: budget)
|
group = create(:budget_group, name: "Districts", budget: budget)
|
||||||
heading1 = create(:budget_heading, name: 'Carabanchel', group: group)
|
heading1 = create(:budget_heading, name: "Carabanchel", group: group)
|
||||||
heading2 = create(:budget_heading, name: 'Barajas', group: group)
|
heading2 = create(:budget_heading, name: "Barajas", group: group)
|
||||||
|
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
|
|
||||||
click_link 'See unfeasible investments'
|
click_link "See unfeasible investments"
|
||||||
|
|
||||||
click_link 'Districts'
|
click_link "Districts"
|
||||||
click_link 'Carabanchel'
|
click_link "Carabanchel"
|
||||||
|
|
||||||
expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unfeasible")
|
expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unfeasible")
|
||||||
expect(page).to have_current_path(expected_path)
|
expect(page).to have_current_path(expected_path)
|
||||||
@@ -582,7 +582,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "Orders" do
|
context "Orders" do
|
||||||
before { budget.update(phase: 'selecting') }
|
before { budget.update(phase: "selecting") }
|
||||||
|
|
||||||
scenario "Default order is random" do
|
scenario "Default order is random" do
|
||||||
per_page = Kaminari.config.default_per_page
|
per_page = Kaminari.config.default_per_page
|
||||||
@@ -613,7 +613,7 @@ feature 'Budget Investments' do
|
|||||||
expect(order).not_to eq(new_order)
|
expect(order).not_to eq(new_order)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Random order maintained with pagination' do
|
scenario "Random order maintained with pagination" do
|
||||||
per_page = Kaminari.config.default_per_page
|
per_page = Kaminari.config.default_per_page
|
||||||
(per_page + 2).times { create(:budget_investment, heading: heading) }
|
(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 }
|
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"
|
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(page).to have_content "You're on page 1"
|
||||||
|
|
||||||
new_order = all(".budget-investment h3").collect {|i| i.text }
|
new_order = all(".budget-investment h3").collect {|i| i.text }
|
||||||
expect(order).to eq(new_order)
|
expect(order).to eq(new_order)
|
||||||
end
|
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) }
|
10.times { |i| create(:budget_investment, heading: heading) }
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
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.times { create(:budget_investment, heading: heading) }
|
||||||
# 12 instead of per_page + 2 because in each page there are 10 (in this case), not 25
|
# 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
|
first_page_investments = investments_order
|
||||||
|
|
||||||
click_link 'Next'
|
click_link "Next"
|
||||||
expect(page).to have_content "You're on page 2"
|
expect(page).to have_content "You're on page 2"
|
||||||
|
|
||||||
second_page_investments = investments_order
|
second_page_investments = investments_order
|
||||||
@@ -664,25 +664,25 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Proposals are ordered by confidence_score' do
|
scenario "Proposals are ordered by confidence_score" do
|
||||||
best_proposal = create(:budget_investment, heading: heading, title: 'Best proposal')
|
best_proposal = create(:budget_investment, heading: heading, title: "Best proposal")
|
||||||
best_proposal.update_column(:confidence_score, 10)
|
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)
|
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)
|
medium_proposal.update_column(:confidence_score, 5)
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
click_link 'highest rated'
|
click_link "highest rated"
|
||||||
expect(page).to have_selector('a.is-active', text: '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(best_proposal.title).to appear_before(medium_proposal.title)
|
||||||
expect(medium_proposal.title).to appear_before(worst_proposal.title)
|
expect(medium_proposal.title).to appear_before(worst_proposal.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(current_url).to include('order=confidence_score')
|
expect(current_url).to include("order=confidence_score")
|
||||||
expect(current_url).to include('page=1')
|
expect(current_url).to include("page=1")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Each user has a different and consistent random budget investment order" do
|
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)
|
expect(@first_user_investments_order).not_to eq(@second_user_investments_order)
|
||||||
|
|
||||||
in_browser(:one) do
|
in_browser(:one) do
|
||||||
click_link 'Next'
|
click_link "Next"
|
||||||
expect(page).to have_content "You're on page 2"
|
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(page).to have_content "You're on page 1"
|
||||||
|
|
||||||
expect(investments_order).to eq(@first_user_investments_order)
|
expect(investments_order).to eq(@first_user_investments_order)
|
||||||
end
|
end
|
||||||
|
|
||||||
in_browser(:two) do
|
in_browser(:two) do
|
||||||
click_link 'Next'
|
click_link "Next"
|
||||||
expect(page).to have_content "You're on page 2"
|
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(page).to have_content "You're on page 1"
|
||||||
|
|
||||||
expect(investments_order).to eq(@second_user_investments_order)
|
expect(investments_order).to eq(@second_user_investments_order)
|
||||||
end
|
end
|
||||||
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) }
|
(Kaminari.config.default_per_page * 1.3).to_i.times { create(:budget_investment, heading: heading) }
|
||||||
|
|
||||||
in_browser(:one) do
|
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
|
@first_user_investments_order = investments_order
|
||||||
end
|
end
|
||||||
|
|
||||||
in_browser(:two) do
|
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
|
@second_user_investments_order = investments_order
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -761,10 +761,10 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
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) }
|
10.times { create(:budget_investment) }
|
||||||
|
|
||||||
budget.update(phase: 'finished')
|
budget.update(phase: "finished")
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
order = all(".budget-investment h3").collect {|i| i.text }
|
order = all(".budget-investment h3").collect {|i| i.text }
|
||||||
@@ -803,82 +803,82 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Phase I - Accepting' do
|
context "Phase I - Accepting" do
|
||||||
before { budget.update(phase: 'accepting') }
|
before { budget.update(phase: "accepting") }
|
||||||
|
|
||||||
scenario 'Create with invisible_captcha honeypot field' do
|
scenario "Create with invisible_captcha honeypot field" do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select heading.name, from: 'budget_investment_heading_id'
|
select heading.name, from: "budget_investment_heading_id"
|
||||||
fill_in 'budget_investment_title', with: 'I am a bot'
|
fill_in "budget_investment_title", with: "I am a bot"
|
||||||
fill_in 'budget_investment_subtitle', with: 'This is the honeypot'
|
fill_in "budget_investment_subtitle", with: "This is the honeypot"
|
||||||
fill_in 'budget_investment_description', with: 'This is the description'
|
fill_in "budget_investment_description", with: "This is the description"
|
||||||
check 'budget_investment_terms_of_service'
|
check "budget_investment_terms_of_service"
|
||||||
|
|
||||||
click_button 'Create Investment'
|
click_button "Create Investment"
|
||||||
|
|
||||||
expect(page.status_code).to eq(200)
|
expect(page.status_code).to eq(200)
|
||||||
expect(page.html).to be_empty
|
expect(page.html).to be_empty
|
||||||
expect(page).to have_current_path(budget_investments_path(budget_id: budget.id))
|
expect(page).to have_current_path(budget_investments_path(budget_id: budget.id))
|
||||||
end
|
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)
|
allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY)
|
||||||
|
|
||||||
login_as(author)
|
login_as(author)
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select heading.name, from: 'budget_investment_heading_id'
|
select heading.name, from: "budget_investment_heading_id"
|
||||||
fill_in 'budget_investment_title', with: 'I am a bot'
|
fill_in "budget_investment_title", with: "I am a bot"
|
||||||
fill_in 'budget_investment_description', with: 'This is the description'
|
fill_in "budget_investment_description", with: "This is the description"
|
||||||
check 'budget_investment_terms_of_service'
|
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))
|
expect(page).to have_current_path(new_budget_investment_path(budget_id: budget.id))
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Create' do
|
scenario "Create" do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select heading.name, from: 'budget_investment_heading_id'
|
select heading.name, from: "budget_investment_heading_id"
|
||||||
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
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_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_location", with: "City center"
|
||||||
fill_in 'budget_investment_organization_name', with: 'T.I.A.'
|
fill_in "budget_investment_organization_name", with: "T.I.A."
|
||||||
fill_in 'budget_investment_tag_list', with: 'Towers'
|
fill_in "budget_investment_tag_list", with: "Towers"
|
||||||
check 'budget_investment_terms_of_service'
|
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 "Investment created successfully"
|
||||||
expect(page).to have_content 'Build a skyscraper'
|
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 "I want to live in a high tower over the clouds"
|
||||||
expect(page).to have_content 'City center'
|
expect(page).to have_content "City center"
|
||||||
expect(page).to have_content 'T.I.A.'
|
expect(page).to have_content "T.I.A."
|
||||||
expect(page).to have_content 'Towers'
|
expect(page).to have_content "Towers"
|
||||||
|
|
||||||
visit user_url(author, filter: :budget_investments)
|
visit user_url(author, filter: :budget_investments)
|
||||||
expect(page).to have_content '1 Investment'
|
expect(page).to have_content "1 Investment"
|
||||||
expect(page).to have_content 'Build a skyscraper'
|
expect(page).to have_content "Build a skyscraper"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Errors on create' do
|
scenario "Errors on create" do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
click_button 'Create Investment'
|
click_button "Create Investment"
|
||||||
expect(page).to have_content error_message
|
expect(page).to have_content error_message
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Suggest' do
|
context "Suggest" do
|
||||||
factory = :budget_investment
|
factory = :budget_investment
|
||||||
|
|
||||||
scenario 'Show up to 5 suggestions', :js do
|
scenario "Show up to 5 suggestions", :js do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
%w(first second third fourth fifth sixth).each do |ordinal|
|
%w(first second third fourth fifth sixth).each do |ordinal|
|
||||||
@@ -894,7 +894,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'No found suggestions', :js do
|
scenario "No found suggestions", :js do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
%w(first second third fourth fifth sixth).each do |ordinal|
|
%w(first second third fourth fifth sixth).each do |ordinal|
|
||||||
@@ -904,8 +904,8 @@ feature 'Budget Investments' do
|
|||||||
visit new_budget_investment_path(budget)
|
visit new_budget_investment_path(budget)
|
||||||
fill_in "budget_investment_title", with: "item"
|
fill_in "budget_investment_title", with: "item"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within("div#js-suggest") do
|
||||||
expect(page).not_to have_content 'You are seeing'
|
expect(page).not_to have_content "You are seeing"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -919,8 +919,8 @@ feature 'Budget Investments' do
|
|||||||
visit new_budget_investment_path(other_budget)
|
visit new_budget_investment_path(other_budget)
|
||||||
fill_in "budget_investment_title", with: "search"
|
fill_in "budget_investment_title", with: "search"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within("div#js-suggest") do
|
||||||
expect(page).not_to have_content 'You are seeing'
|
expect(page).not_to have_content "You are seeing"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -930,10 +930,10 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
expect(page).not_to have_link('Check my ballot')
|
expect(page).not_to have_link("Check my ballot")
|
||||||
expect(page).not_to have_css('#progress_bar')
|
expect(page).not_to have_css("#progress_bar")
|
||||||
within('#sidebar') do
|
within("#sidebar") do
|
||||||
expect(page).not_to have_content('My ballot')
|
expect(page).not_to have_content("My ballot")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -946,8 +946,8 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select_options = find('#budget_investment_heading_id').all('option').collect(&:text)
|
select_options = find("#budget_investment_heading_id").all("option").collect(&:text)
|
||||||
expect(select_options.first).to eq('')
|
expect(select_options.first).to eq("")
|
||||||
expect(select_options.second).to eq("Toda la ciudad")
|
expect(select_options.second).to eq("Toda la ciudad")
|
||||||
expect(select_options.third).to eq("Health: More health professionals")
|
expect(select_options.third).to eq("Health: More health professionals")
|
||||||
expect(select_options.fourth).to eq("Health: More hospitals")
|
expect(select_options.fourth).to eq("Health: More hospitals")
|
||||||
@@ -1036,18 +1036,18 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Can access the community' do
|
scenario "Can access the community" do
|
||||||
Setting['feature.community'] = true
|
Setting["feature.community"] = true
|
||||||
|
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
||||||
expect(page).to have_content "Access the community"
|
expect(page).to have_content "Access the community"
|
||||||
|
|
||||||
Setting['feature.community'] = false
|
Setting["feature.community"] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Can not access the community' do
|
scenario "Can not access the community" do
|
||||||
Setting['feature.community'] = false
|
Setting["feature.community"] = false
|
||||||
|
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
||||||
@@ -1078,7 +1078,7 @@ feature 'Budget Investments' do
|
|||||||
group: group,
|
group: group,
|
||||||
heading: heading,
|
heading: heading,
|
||||||
price: 16,
|
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
|
end
|
||||||
|
|
||||||
background do
|
background do
|
||||||
@@ -1174,7 +1174,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Show (not selected budget investment)" do
|
scenario "Show (not selected budget investment)" do
|
||||||
budget.update(phase: 'balloting')
|
budget.update(phase: "balloting")
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
login_as(user)
|
login_as(user)
|
||||||
|
|
||||||
@@ -1219,7 +1219,7 @@ feature 'Budget Investments' do
|
|||||||
budget: budget,
|
budget: budget,
|
||||||
group: group,
|
group: group,
|
||||||
heading: heading,
|
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)
|
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
||||||
|
|
||||||
@@ -1237,7 +1237,7 @@ feature 'Budget Investments' do
|
|||||||
budget: budget,
|
budget: budget,
|
||||||
group: group,
|
group: group,
|
||||||
heading: heading,
|
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)
|
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
|
within("#budget_investment_#{sp1.id}") do
|
||||||
expect(page).to have_content(sp1.title)
|
expect(page).to have_content(sp1.title)
|
||||||
click_link('Delete')
|
click_link("Delete")
|
||||||
end
|
end
|
||||||
|
|
||||||
visit user_path(user, tab: :budget_investments)
|
visit user_path(user, tab: :budget_investments)
|
||||||
@@ -1483,25 +1483,25 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Order by cost (only when balloting)' do
|
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 = create(:budget_investment, :selected, heading: heading, title: "Build a nice house", price: 1000)
|
||||||
mid_investment.update_column(:confidence_score, 10)
|
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)
|
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)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
click_link 'by price'
|
click_link "by price"
|
||||||
expect(page).to have_selector('a.is-active', text: '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(high_investment.title).to appear_before(mid_investment.title)
|
||||||
expect(mid_investment.title).to appear_before(low_investment.title)
|
expect(mid_investment.title).to appear_before(low_investment.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(current_url).to include('order=price')
|
expect(current_url).to include("order=price")
|
||||||
expect(current_url).to include('page=1')
|
expect(current_url).to include("page=1")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Show" do
|
scenario "Show" do
|
||||||
@@ -1526,11 +1526,11 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Confirm", :js do
|
scenario "Confirm", :js do
|
||||||
budget.update(phase: 'balloting')
|
budget.update(phase: "balloting")
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
|
|
||||||
global_group = create(:budget_group, budget: budget, name: 'Global Group')
|
global_group = create(:budget_group, budget: budget, name: "Global Group")
|
||||||
global_heading = create(:budget_heading, group: global_group, name: 'Global Heading',
|
global_heading = create(:budget_heading, group: global_group, name: "Global Heading",
|
||||||
latitude: -43.145412, longitude: 12.009423)
|
latitude: -43.145412, longitude: 12.009423)
|
||||||
|
|
||||||
carabanchel_heading = create(:budget_heading, group: group, name: "Carabanchel")
|
carabanchel_heading = create(:budget_heading, group: group, name: "Carabanchel")
|
||||||
@@ -1622,19 +1622,19 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Ballot is visible' do
|
scenario "Ballot is visible" do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
expect(page).to have_link('Check my ballot')
|
expect(page).to have_link("Check my ballot")
|
||||||
expect(page).to have_css('#progress_bar')
|
expect(page).to have_css("#progress_bar")
|
||||||
within('#sidebar') do
|
within("#sidebar") do
|
||||||
expect(page).to have_content('My ballot')
|
expect(page).to have_content("My ballot")
|
||||||
end
|
end
|
||||||
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)
|
investment1 = create(:budget_investment, :unselected, :feasible, heading: heading, valuation_finished: true)
|
||||||
investment2 = create(:budget_investment, :selected, :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)
|
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")
|
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unselected")
|
||||||
|
|
||||||
within("#budget-investments") do
|
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).to have_content(investment1.title)
|
||||||
expect(page).not_to have_content(investment2.title)
|
expect(page).not_to have_content(investment2.title)
|
||||||
@@ -1653,11 +1653,11 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Shows unselected link for group with one heading" do
|
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)
|
heading = create(:budget_heading, name: "Madrid", group: group)
|
||||||
|
|
||||||
visit budget_path(budget)
|
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"
|
click_link "All City"
|
||||||
|
|
||||||
@@ -1666,16 +1666,16 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Shows unselected link for group with many headings" do
|
scenario "Shows unselected link for group with many headings" do
|
||||||
group = create(:budget_group, name: 'Districts', budget: budget)
|
group = create(:budget_group, name: "Districts", budget: budget)
|
||||||
heading1 = create(:budget_heading, name: 'Carabanchel', group: group)
|
heading1 = create(:budget_heading, name: "Carabanchel", group: group)
|
||||||
heading2 = create(:budget_heading, name: 'Barajas', group: group)
|
heading2 = create(:budget_heading, name: "Barajas", group: group)
|
||||||
|
|
||||||
visit budget_path(budget)
|
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 "Districts"
|
||||||
click_link 'Carabanchel'
|
click_link "Carabanchel"
|
||||||
|
|
||||||
expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unselected")
|
expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unselected")
|
||||||
expect(page).to have_current_path(expected_path)
|
expect(page).to have_current_path(expected_path)
|
||||||
@@ -1747,7 +1747,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Flagging an investment as innapropriate', :js do
|
scenario "Flagging an investment as innapropriate", :js do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
|
|
||||||
@@ -1765,7 +1765,7 @@ feature 'Budget Investments' do
|
|||||||
expect(Flag.flagged?(user, investment)).to be
|
expect(Flag.flagged?(user, investment)).to be
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Unflagging an investment', :js do
|
scenario "Unflagging an investment", :js do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
Flag.flag(user, investment)
|
Flag.flag(user, investment)
|
||||||
@@ -1784,7 +1784,7 @@ feature 'Budget Investments' do
|
|||||||
expect(Flag.flagged?(user, investment)).not_to be
|
expect(Flag.flagged?(user, investment)).not_to be
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Flagging an investment updates the DOM properly', :js do
|
scenario "Flagging an investment updates the DOM properly", :js do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
|
|
||||||
@@ -1811,7 +1811,7 @@ feature 'Budget Investments' do
|
|||||||
expect(Flag.flagged?(user, investment)).not_to be
|
expect(Flag.flagged?(user, investment)).not_to be
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'sidebar map' do
|
context "sidebar map" do
|
||||||
scenario "Display 6 investment's markers on sidebar map", :js do
|
scenario "Display 6 investment's markers on sidebar map", :js do
|
||||||
investment1 = create(:budget_investment, heading: heading)
|
investment1 = create(:budget_investment, heading: heading)
|
||||||
investment2 = create(:budget_investment, heading: heading)
|
investment2 = create(:budget_investment, heading: heading)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
require 'rails_helper'
|
require "rails_helper"
|
||||||
|
|
||||||
feature 'Budget Investments' do
|
feature "Budget Investments" do
|
||||||
|
|
||||||
background do
|
background do
|
||||||
login_as_manager
|
login_as_manager
|
||||||
@budget = create(:budget, phase: 'selecting', name: "2033")
|
@budget = create(:budget, phase: "selecting", name: "2033")
|
||||||
@group = create(:budget_group, budget: @budget, name: 'Whole city')
|
@group = create(:budget_group, budget: @budget, name: "Whole city")
|
||||||
@heading = create(:budget_heading, group: @group, name: "Health")
|
@heading = create(:budget_heading, group: @group, name: "Health")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -19,9 +19,9 @@ feature 'Budget Investments' do
|
|||||||
management = true
|
management = true
|
||||||
|
|
||||||
context "Create" do
|
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)
|
user = create(:user, :level_two)
|
||||||
|
|
||||||
login_managed_user(user)
|
login_managed_user(user)
|
||||||
@@ -38,23 +38,23 @@ feature 'Budget Investments' do
|
|||||||
expect(page).to have_content user.document_number
|
expect(page).to have_content user.document_number
|
||||||
end
|
end
|
||||||
|
|
||||||
select "Health", from: 'budget_investment_heading_id'
|
select "Health", from: "budget_investment_heading_id"
|
||||||
fill_in 'budget_investment_title', with: 'Build a park in my neighborhood'
|
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_description", with: "There is no parks here..."
|
||||||
fill_in 'budget_investment_location', with: 'City center'
|
fill_in "budget_investment_location", with: "City center"
|
||||||
fill_in 'budget_investment_organization_name', with: 'T.I.A.'
|
fill_in "budget_investment_organization_name", with: "T.I.A."
|
||||||
fill_in 'budget_investment_tag_list', with: 'green'
|
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 "Health"
|
||||||
expect(page).to have_content 'Build a park in my neighborhood'
|
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 "There is no parks here..."
|
||||||
expect(page).to have_content 'City center'
|
expect(page).to have_content "City center"
|
||||||
expect(page).to have_content 'T.I.A.'
|
expect(page).to have_content "T.I.A."
|
||||||
expect(page).to have_content 'green'
|
expect(page).to have_content "green"
|
||||||
expect(page).to have_content user.name
|
expect(page).to have_content user.name
|
||||||
expect(page).to have_content I18n.l(@budget.created_at.to_date)
|
expect(page).to have_content I18n.l(@budget.created_at.to_date)
|
||||||
end
|
end
|
||||||
@@ -88,7 +88,7 @@ feature 'Budget Investments' do
|
|||||||
click_button "Search"
|
click_button "Search"
|
||||||
|
|
||||||
within("#budget-investments") do
|
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).to have_content(budget_investment1.title)
|
||||||
expect(page).not_to have_content(budget_investment2.title)
|
expect(page).not_to have_content(budget_investment2.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']",
|
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"
|
click_button "Search"
|
||||||
|
|
||||||
within("#budget-investments") do
|
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).not_to have_content(budget_investment1.title)
|
||||||
expect(page).to have_content(budget_investment2.title)
|
expect(page).to have_content(budget_investment2.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",
|
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",
|
||||||
@@ -145,7 +145,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
within("#budget-investments") do
|
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)}']",
|
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']",
|
||||||
text: budget_investment1.title)
|
text: budget_investment1.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",
|
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
|
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)
|
budget_investment = create(:budget_investment, budget: @budget, heading: @heading)
|
||||||
|
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
@@ -232,7 +232,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# This test passes ok locally but fails on the last two lines in Travis
|
# 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)
|
budget_investment = create(:budget_investment, budget: @budget)
|
||||||
|
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
@@ -248,7 +248,7 @@ feature 'Budget Investments' do
|
|||||||
click_link budget_investment.title
|
click_link budget_investment.title
|
||||||
end
|
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 "1 support"
|
||||||
expect(page).to have_content "You have already supported this. Share it!"
|
expect(page).to have_content "You have already supported this. Share it!"
|
||||||
end
|
end
|
||||||
@@ -267,7 +267,7 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
context "Printing" do
|
context "Printing" do
|
||||||
|
|
||||||
scenario 'Printing budget investments' do
|
scenario "Printing budget investments" do
|
||||||
16.times { create(:budget_investment, budget: @budget, heading: @heading) }
|
16.times { create(:budget_investment, budget: @budget, heading: @heading) }
|
||||||
|
|
||||||
click_link "Print budget investments"
|
click_link "Print budget investments"
|
||||||
@@ -277,17 +277,17 @@ feature 'Budget Investments' do
|
|||||||
click_link "Print budget investments"
|
click_link "Print budget investments"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_css('.budget-investment', count: 15)
|
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("a[href='javascript:window.print();']", text: "Print")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Filtering budget investments by heading to be printed", :js do
|
scenario "Filtering budget investments by heading to be printed", :js do
|
||||||
district_9 = create(:budget_heading, group: @group, name: "District Nine")
|
district_9 = create(:budget_heading, group: @group, name: "District Nine")
|
||||||
another_heading = create(:budget_heading, group: @group)
|
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)
|
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)
|
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)
|
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')
|
unvoted_investment = create(:budget_investment, budget: @budget, heading: another_heading, title: "Add new districts to the city")
|
||||||
|
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
login_managed_user(user)
|
login_managed_user(user)
|
||||||
@@ -299,17 +299,17 @@ feature 'Budget Investments' do
|
|||||||
click_link "Print budget investments"
|
click_link "Print budget investments"
|
||||||
end
|
end
|
||||||
|
|
||||||
within '#budget-investments' do
|
within "#budget-investments" do
|
||||||
expect(page).to have_content(unvoted_investment.title)
|
expect(page).to have_content(unvoted_investment.title)
|
||||||
expect(page).to have_content(mid_investment.title)
|
expect(page).to have_content(mid_investment.title)
|
||||||
expect(page).to have_content(top_investment.title)
|
expect(page).to have_content(top_investment.title)
|
||||||
expect(page).to have_content(low_investment.title)
|
expect(page).to have_content(low_investment.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
select 'Whole city: District Nine', from: 'heading_id'
|
select "Whole city: District Nine", from: "heading_id"
|
||||||
click_button("Search")
|
click_button("Search")
|
||||||
|
|
||||||
within '#budget-investments' do
|
within "#budget-investments" do
|
||||||
expect(page).not_to have_content(unvoted_investment.title)
|
expect(page).not_to have_content(unvoted_investment.title)
|
||||||
expect(top_investment.title).to appear_before(mid_investment.title)
|
expect(top_investment.title).to appear_before(mid_investment.title)
|
||||||
expect(mid_investment.title).to appear_before(low_investment.title)
|
expect(mid_investment.title).to appear_before(low_investment.title)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
end
|
end
|
||||||
|
|
||||||
within("#related_content") do
|
within("#related_content") do
|
||||||
fill_in 'url', with: "#{Setting['url'] + related2.url}"
|
fill_in "url", with: "#{Setting["url"] + related2.url}"
|
||||||
click_button "Add"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
click_on("Add related content")
|
click_on("Add related content")
|
||||||
|
|
||||||
within("#related_content") do
|
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"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user