Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Admin::Api::StatsController do
|
||||
|
||||
describe "GET index" do
|
||||
let(:user) { create(:administrator).user }
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe ApplicationController do
|
||||
|
||||
describe "#current_budget" do
|
||||
|
||||
it "returns the last budget that is not in draft phase" do
|
||||
create(:budget, :finished, created_at: 2.years.ago, name: "Old")
|
||||
create(:budget, :accepting, created_at: 1.year.ago, name: "Previous")
|
||||
@@ -13,7 +11,5 @@ describe ApplicationController do
|
||||
budget = subject.instance_eval { current_budget }
|
||||
expect(budget.name).to eq("Current")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Budgets::Ballot::LinesController do
|
||||
|
||||
describe "#load_budget" do
|
||||
|
||||
it "raises an error if budget slug is not found" do
|
||||
controller.params[:budget_id] = "wrong_budget"
|
||||
|
||||
@@ -19,7 +17,5 @@ describe Budgets::Ballot::LinesController do
|
||||
controller.send(:load_budget)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe CommentsController do
|
||||
|
||||
describe "POST create" do
|
||||
let(:legal_process) do
|
||||
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe HasFilters do
|
||||
|
||||
class FakeController < ActionController::Base; end
|
||||
|
||||
controller(FakeController) do
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe HasOrders do
|
||||
|
||||
class FakeController < ActionController::Base; end
|
||||
|
||||
controller(FakeController) do
|
||||
|
||||
@@ -2,15 +2,12 @@ require "rails_helper"
|
||||
include RemotelyTranslatable
|
||||
|
||||
describe RemotelyTranslatable do
|
||||
|
||||
before do
|
||||
Setting["feature.remote_translations"] = true
|
||||
end
|
||||
|
||||
describe "#detect_remote_translations" do
|
||||
|
||||
describe "Should detect remote_translations" do
|
||||
|
||||
it "When collections and featured_proposals are not defined in current locale" do
|
||||
proposals = create_list(:proposal, 3)
|
||||
featured_proposals = create_featured_proposals
|
||||
@@ -49,7 +46,6 @@ describe RemotelyTranslatable do
|
||||
expect(detect_remote_translations(widget_feeds).count).to eq 9
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "When defined in current locale should not detect remote_translations" do
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe DebatesController do
|
||||
|
||||
describe "POST create" do
|
||||
before do
|
||||
InvisibleCaptcha.timestamp_enabled = false
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe InstallationController, type: :request do
|
||||
|
||||
describe "consul.json" do
|
||||
let(:test_feature_settings) do
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Legislation::AnnotationsController do
|
||||
|
||||
describe "POST create" do
|
||||
|
||||
let(:legal_process) do
|
||||
create(:legislation_process, allegations_start_date: Date.current - 3.days,
|
||||
allegations_end_date: Date.current + 2.days)
|
||||
@@ -162,6 +160,5 @@ describe Legislation::AnnotationsController do
|
||||
expect(annotation.reload.comments_count).to eq(2)
|
||||
expect(annotation.comments.last.body).to eq("una anotacion")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Legislation::AnswersController do
|
||||
|
||||
describe "POST create" do
|
||||
|
||||
let(:legal_process) do
|
||||
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
||||
debate_end_date: Date.current + 2.days)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Management::BaseController do
|
||||
|
||||
describe "managed_user" do
|
||||
|
||||
it "returns existent user with session document info if present" do
|
||||
session[:document_type] = "1"
|
||||
session[:document_number] = "333333333E"
|
||||
@@ -23,5 +21,4 @@ describe Management::BaseController do
|
||||
expect(managed_user.document_number).to eq "333333333E"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Management::SessionsController do
|
||||
|
||||
describe "Sign in" do
|
||||
|
||||
it "denies access if wrong manager credentials" do
|
||||
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(false)
|
||||
get :create, params: { login: "nonexistent", clave_usuario: "wrong" }
|
||||
@@ -66,5 +64,4 @@ describe Management::SessionsController do
|
||||
expect(response).to be_redirect
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Management::UsersController do
|
||||
|
||||
describe "logout" do
|
||||
it "removes user data from the session" do
|
||||
session[:manager] = { user_key: "31415926", date: "20151031135905", login: "JJB033" }
|
||||
@@ -16,5 +15,4 @@ describe Management::UsersController do
|
||||
expect(response).to be_redirect
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe PagesController do
|
||||
|
||||
describe "Static pages" do
|
||||
it "includes a privacy page" do
|
||||
get :show, params: { id: :privacy }
|
||||
@@ -20,7 +19,6 @@ describe PagesController do
|
||||
end
|
||||
|
||||
describe "More info pages" do
|
||||
|
||||
it "includes a more info page" do
|
||||
get :show, params: { id: "help/index" }
|
||||
expect(response).to be_ok
|
||||
@@ -48,5 +46,4 @@ describe PagesController do
|
||||
expect(response).to be_missing
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe RelatedContentsController do
|
||||
|
||||
describe "#score" do
|
||||
it "raises an error if related content does not exist" do
|
||||
controller.params[:id] = 0
|
||||
@@ -11,5 +10,4 @@ describe RelatedContentsController do
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe RemoteTranslationsController do
|
||||
|
||||
describe "POST create", :delay_jobs do
|
||||
let(:debate) { create(:debate) }
|
||||
|
||||
@@ -42,6 +41,5 @@ describe RemoteTranslationsController do
|
||||
|
||||
expect(subject).to redirect_to("any_path")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Users::RegistrationsController do
|
||||
|
||||
describe "POST check_username" do
|
||||
|
||||
before do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
end
|
||||
@@ -28,7 +26,5 @@ describe Users::RegistrationsController do
|
||||
expect(data[:message]).to eq I18n.t("devise_views.users.registrations.new.username_is_not_available")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -4,7 +4,6 @@ require "rails_helper"
|
||||
# TODO test models, controllers, etc...
|
||||
|
||||
describe "Customization Engine" do
|
||||
|
||||
let(:test_key) { I18n.t("account.show.change_credentials_link") }
|
||||
let!(:default_path) { I18n.load_path }
|
||||
|
||||
@@ -37,5 +36,4 @@ describe "Customization Engine" do
|
||||
I18n.load_path += path
|
||||
I18n.reload!
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -72,6 +72,5 @@ FactoryBot.define do
|
||||
trait :prioritized do
|
||||
prioritized { true }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,7 +104,6 @@ describe "Account" do
|
||||
end
|
||||
|
||||
context "Option to display badge for official position" do
|
||||
|
||||
scenario "Users with official position of level 1" do
|
||||
official_user = create(:user, official_level: 1)
|
||||
|
||||
@@ -133,7 +132,6 @@ describe "Account" do
|
||||
|
||||
expect(page).not_to have_css "#account_official_position_badge"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Errors on edit" do
|
||||
@@ -208,6 +206,5 @@ describe "Account" do
|
||||
expect(user.recommended_debates).to be(false)
|
||||
expect(user.recommended_proposals).to be(false)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -353,5 +353,4 @@ describe "Admin activity" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin Notifications" do
|
||||
|
||||
before do
|
||||
create(:budget)
|
||||
login_as(create(:administrator).user)
|
||||
|
||||
@@ -40,7 +40,6 @@ describe "Admin administrators" do
|
||||
end
|
||||
|
||||
scenario "Delete Administrator when its the current user" do
|
||||
|
||||
within "#administrator_#{admin.id}" do
|
||||
click_on "Delete"
|
||||
end
|
||||
@@ -115,5 +114,4 @@ describe "Admin administrators" do
|
||||
expect(page).to have_content("Admin Alias")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin banners magement" do
|
||||
|
||||
before do
|
||||
login_as(create(:administrator).user)
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin budget groups" do
|
||||
|
||||
let(:budget) { create(:budget, :drafting) }
|
||||
|
||||
before do
|
||||
@@ -10,7 +9,6 @@ describe "Admin budget groups" do
|
||||
end
|
||||
|
||||
context "Feature flag" do
|
||||
|
||||
before do
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
@@ -20,11 +18,9 @@ describe "Admin budget groups" do
|
||||
visit admin_budget_groups_path(budget)
|
||||
end.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Load" do
|
||||
|
||||
let!(:budget) { create(:budget, slug: "budget_slug") }
|
||||
let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) }
|
||||
|
||||
@@ -57,11 +53,9 @@ describe "Admin budget groups" do
|
||||
visit edit_admin_budget_group_path(budget, 0)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying no groups for budget" do
|
||||
visit admin_budget_groups_path(budget)
|
||||
|
||||
@@ -122,11 +116,9 @@ describe "Admin budget groups" do
|
||||
expect(page).to have_content "You cannot delete a Group that has associated headings"
|
||||
expect(page).to have_selector "#budget_group_#{group.id}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "New" do
|
||||
|
||||
scenario "Create group" do
|
||||
visit admin_budget_groups_path(budget)
|
||||
click_link "Create new group"
|
||||
@@ -157,11 +149,9 @@ describe "Admin budget groups" do
|
||||
expect(page).to have_css(".is-invalid-label", text: "Group name")
|
||||
expect(page).to have_content "can't be blank"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
|
||||
scenario "Show group information" do
|
||||
group = create(:budget_group, budget: budget, max_votable_headings: 2)
|
||||
2.times { create(:budget_heading, group: group) }
|
||||
@@ -196,7 +186,6 @@ describe "Admin budget groups" do
|
||||
expect(group.reload.slug).not_to eq old_slug
|
||||
expect(group.slug).to eq "new-english-name"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Update" do
|
||||
@@ -232,6 +221,5 @@ describe "Admin budget groups" do
|
||||
expect(page).to have_css(".is-invalid-label", text: "Group name")
|
||||
expect(page).to have_css("small.form-error", text: "has already been taken")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin budget headings" do
|
||||
|
||||
let(:budget) { create(:budget, :drafting) }
|
||||
let(:group) { create(:budget_group, budget: budget) }
|
||||
|
||||
@@ -11,7 +10,6 @@ describe "Admin budget headings" do
|
||||
end
|
||||
|
||||
context "Feature flag" do
|
||||
|
||||
before do
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
@@ -21,11 +19,9 @@ describe "Admin budget headings" do
|
||||
visit admin_budget_group_headings_path(budget, group)
|
||||
end.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Load" do
|
||||
|
||||
let!(:budget) { create(:budget, slug: "budget_slug") }
|
||||
let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) }
|
||||
let!(:heading) { create(:budget_heading, slug: "heading_slug", group: group) }
|
||||
@@ -75,7 +71,6 @@ describe "Admin budget headings" do
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying no headings for group" do
|
||||
visit admin_budget_group_headings_path(budget, group)
|
||||
|
||||
@@ -138,11 +133,9 @@ describe "Admin budget headings" do
|
||||
expect(page).to have_content "You cannot delete a Heading that has associated investments"
|
||||
expect(page).to have_content "Atlantis"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "New" do
|
||||
|
||||
scenario "Create heading" do
|
||||
visit admin_budget_group_headings_path(budget, group)
|
||||
click_link "Create new heading"
|
||||
@@ -178,11 +171,9 @@ describe "Admin budget headings" do
|
||||
expect(page).to have_css(".is-invalid-label", text: "Amount")
|
||||
expect(page).to have_content "can't be blank"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
|
||||
scenario "Show heading information" do
|
||||
heading = create(:budget_heading, group: group)
|
||||
|
||||
@@ -220,7 +211,6 @@ describe "Admin budget headings" do
|
||||
expect(heading.reload.slug).not_to eq old_slug
|
||||
expect(heading.slug).to eq "new-english-name"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Update" do
|
||||
@@ -277,6 +267,5 @@ describe "Admin budget headings" do
|
||||
expect(page).to have_css(".is-invalid-label", text: "Heading name")
|
||||
expect(page).to have_css("small.form-error", text: "has already been taken")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin budget investments" do
|
||||
|
||||
let(:budget) { create(:budget) }
|
||||
let(:administrator) do
|
||||
create(:administrator, user: create(:user, username: "Ana", email: "ana@admins.org"))
|
||||
@@ -16,7 +15,6 @@ describe "Admin budget investments" do
|
||||
end
|
||||
|
||||
context "Feature flag" do
|
||||
|
||||
before do
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
@@ -24,7 +22,6 @@ describe "Admin budget investments" do
|
||||
scenario "Disabled with a feature flag" do
|
||||
expect { visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Load" do
|
||||
@@ -49,11 +46,9 @@ describe "Admin budget investments" do
|
||||
visit admin_budget_budget_investments_path(0, investment)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying investments" do
|
||||
budget_investment = create(:budget_investment, budget: budget, cached_votes_up: 77)
|
||||
visit admin_budget_budget_investments_path(budget_id: budget.id)
|
||||
@@ -682,7 +677,6 @@ describe "Admin budget investments" do
|
||||
expect(page).not_to have_content("More hospitals")
|
||||
|
||||
expect(page).to have_content("Selected")
|
||||
|
||||
end
|
||||
|
||||
scenario "Combination of select with text search", :js do
|
||||
@@ -717,7 +711,6 @@ describe "Admin budget investments" do
|
||||
expect(page).not_to have_content("More hospitals")
|
||||
|
||||
expect(page).to have_content("Selected")
|
||||
|
||||
end
|
||||
|
||||
scenario "Combination of checkbox with text search and checkbox", :js do
|
||||
@@ -787,7 +780,6 @@ describe "Admin budget investments" do
|
||||
visit admin_budget_budget_investments_path(budget_id: not_finished_budget.id)
|
||||
expect(page).not_to have_content "See results"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Search" do
|
||||
@@ -961,7 +953,6 @@ describe "Admin budget investments" do
|
||||
end
|
||||
|
||||
context "Show" do
|
||||
|
||||
scenario "Show the investment details" do
|
||||
user = create(:user, username: "Rachel", email: "rachel@valuators.org")
|
||||
valuator = create(:valuator, user: user)
|
||||
@@ -1062,7 +1053,6 @@ describe "Admin budget investments" do
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
|
||||
scenario "Change title, incompatible, description or heading" do
|
||||
budget_investment = create(:budget_investment, :incompatible)
|
||||
create(:budget_heading, group: budget_investment.group, name: "Barbate")
|
||||
@@ -1356,7 +1346,6 @@ describe "Admin budget investments" do
|
||||
expect(page).to have_content "Investment project updated succesfully."
|
||||
expect(page).to have_content("Milestone Tags: tag1, tag2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Selecting" do
|
||||
@@ -1698,7 +1687,6 @@ describe "Admin budget investments" do
|
||||
end
|
||||
|
||||
context "Selecting csv" do
|
||||
|
||||
scenario "Downloading CSV file" do
|
||||
create(:budget_investment, budget: budget)
|
||||
|
||||
@@ -1841,7 +1829,6 @@ describe "Admin budget investments" do
|
||||
|
||||
expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," +
|
||||
"visible_to_valuators,selected,incompatible,author")
|
||||
|
||||
end
|
||||
|
||||
scenario "Select an investment when some columns are not displayed", :js do
|
||||
@@ -1859,5 +1846,4 @@ describe "Admin budget investments" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -4,7 +4,6 @@ describe "Admin budget phases" do
|
||||
let(:budget) { create(:budget) }
|
||||
|
||||
context "Edit" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin budgets" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Feature flag" do
|
||||
|
||||
before do
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
@@ -16,11 +14,9 @@ describe "Admin budgets" do
|
||||
scenario "Disabled with a feature flag" do
|
||||
expect { visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Load" do
|
||||
|
||||
let!(:budget) { create(:budget, slug: "budget_slug") }
|
||||
|
||||
scenario "finds budget by slug" do
|
||||
@@ -39,11 +35,9 @@ describe "Admin budgets" do
|
||||
visit admin_budget_path(0)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying no open budgets text" do
|
||||
visit admin_budgets_path
|
||||
|
||||
@@ -105,11 +99,9 @@ describe "Admin budgets" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "New" do
|
||||
|
||||
scenario "Create budget" do
|
||||
visit admin_budgets_path
|
||||
click_link "Create new budget"
|
||||
@@ -142,11 +134,9 @@ describe "Admin budgets" do
|
||||
expect(page).to have_css(".is-invalid-label", text: "Name")
|
||||
expect(page).to have_css("small.form-error", text: "has already been taken")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Destroy" do
|
||||
|
||||
let!(:budget) { create(:budget) }
|
||||
let(:heading) { create(:budget_heading, budget: budget) }
|
||||
|
||||
@@ -193,7 +183,6 @@ describe "Admin budgets" do
|
||||
expect(page).to have_select("budget_phase", selected: "Selecting projects")
|
||||
|
||||
within "#budget-phases-table" do
|
||||
|
||||
Budget::Phase::PHASE_KINDS.each do |phase_kind|
|
||||
phase_index = Budget::Phase::PHASE_KINDS.index(phase_kind)
|
||||
break if phase_kind == Budget::Phase::PHASE_KINDS.last
|
||||
@@ -239,11 +228,9 @@ describe "Admin budgets" do
|
||||
expect(budget.reload.slug).not_to eq old_slug
|
||||
expect(budget.slug).to eq "new-english-name"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Update" do
|
||||
|
||||
before do
|
||||
create(:budget)
|
||||
end
|
||||
@@ -258,11 +245,9 @@ describe "Admin budgets" do
|
||||
expect(page).to have_content("More trees on the streets")
|
||||
expect(page).to have_current_path(admin_budgets_path)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Calculate Budget's Winner Investments" do
|
||||
|
||||
scenario "For a Budget in reviewing balloting", :js do
|
||||
budget = create(:budget, :reviewing_ballots)
|
||||
heading = create(:budget_heading, budget: budget, price: 4)
|
||||
@@ -312,7 +297,6 @@ describe "Admin budgets" do
|
||||
expect(page).to have_content "Recalculate Winner Investments"
|
||||
expect(page).not_to have_content "Calculate Winner Investments"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -64,6 +64,5 @@ describe "Admin change log" do
|
||||
expect(page).to have_content("Edited at")
|
||||
expect(page).to have_content("Edited by")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin comments" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -136,5 +135,4 @@ describe "Admin comments" do
|
||||
expect(current_url).to include("filter=with_confirmed_hide")
|
||||
expect(current_url).to include("page=2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -33,7 +33,6 @@ describe "Admin administrator tasks" do
|
||||
scenario "has a link that allows solving the request" do
|
||||
expect(page).to have_link("Solve")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin debates" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["process.debates"] = nil
|
||||
admin = create(:administrator)
|
||||
@@ -98,5 +97,4 @@ describe "Admin debates" do
|
||||
expect(current_url).to include("filter=with_confirmed_hide")
|
||||
expect(current_url).to include("page=2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin download settings" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -30,7 +29,6 @@ describe "Admin download settings" do
|
||||
end
|
||||
|
||||
context "Download debates" do
|
||||
|
||||
before do
|
||||
create(:debate)
|
||||
end
|
||||
@@ -83,13 +81,11 @@ describe "Admin download settings" do
|
||||
end
|
||||
|
||||
context "Download proposals" do
|
||||
|
||||
before do
|
||||
create(:proposal)
|
||||
end
|
||||
|
||||
scenario "admin csv" do
|
||||
|
||||
visit admin_proposals_path
|
||||
|
||||
click_button "Download"
|
||||
@@ -121,7 +117,6 @@ describe "Admin download settings" do
|
||||
end
|
||||
|
||||
scenario "Update download settings comments" do
|
||||
|
||||
visit admin_edit_download_settings_path(resource: "comments")
|
||||
|
||||
find(:css, "#downloadable_[value='id']").set(true)
|
||||
@@ -155,11 +150,9 @@ describe "Admin download settings" do
|
||||
visit admin_edit_download_settings_path(resource: "legislation_processes")
|
||||
|
||||
expect(page).to have_content("Legislation process")
|
||||
|
||||
end
|
||||
|
||||
scenario "Update download settings legislation process" do
|
||||
|
||||
visit admin_edit_download_settings_path(resource: "legislation_processes")
|
||||
|
||||
find(:css, "#downloadable_[value='id']").set(true)
|
||||
@@ -176,14 +169,12 @@ describe "Admin download settings" do
|
||||
end
|
||||
|
||||
context "Download legislation process" do
|
||||
|
||||
before do
|
||||
create(:legislation_process, :open)
|
||||
create(:legislation_process, :published)
|
||||
end
|
||||
|
||||
scenario "admin csv" do
|
||||
|
||||
visit admin_legislation_processes_path
|
||||
|
||||
click_button "Download"
|
||||
@@ -212,11 +203,9 @@ describe "Admin download settings" do
|
||||
visit admin_edit_download_settings_path(resource: "budget_investments")
|
||||
|
||||
expect(page).to have_content("Participatory budgeting")
|
||||
|
||||
end
|
||||
|
||||
scenario "Update download settings budget investment results" do
|
||||
|
||||
visit admin_edit_download_settings_path(resource: "budget_investments")
|
||||
|
||||
find(:css, "#downloadable_[value='id']").set(true)
|
||||
@@ -236,11 +225,9 @@ describe "Admin download settings" do
|
||||
visit admin_edit_download_settings_path(resource: "budget_investments", config: 1)
|
||||
|
||||
expect(page).to have_content("Participatory budgeting - Milestones")
|
||||
|
||||
end
|
||||
|
||||
scenario "Update download settings budget investment milestones" do
|
||||
|
||||
visit admin_edit_download_settings_path(resource: "budget_investments", config: 1)
|
||||
|
||||
find(:css, "#downloadable_[value='id']").set(true)
|
||||
@@ -319,5 +306,4 @@ describe "Admin download settings" do
|
||||
expect(content_type).to match("text/csv")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin download user emails" do
|
||||
|
||||
let(:admin_user) { create(:user, newsletter: false, email: "admin@consul.dev") }
|
||||
|
||||
before do
|
||||
@@ -10,7 +9,6 @@ describe "Admin download user emails" do
|
||||
end
|
||||
|
||||
context "Download only emails from segment users with newsletter flag & present email " do
|
||||
|
||||
before do
|
||||
create(:user, email: "user@consul.dev")
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin newsletter emails" do
|
||||
|
||||
before do
|
||||
create(:budget)
|
||||
login_as(create(:administrator).user)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin feature flags" do
|
||||
|
||||
before do
|
||||
Setting["process.budgets"] = true
|
||||
login_as(create(:administrator).user)
|
||||
@@ -102,5 +101,4 @@ describe "Admin feature flags" do
|
||||
expect(page).not_to have_button "Enable"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin geozones" do
|
||||
|
||||
before do
|
||||
login_as(create(:administrator).user)
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin hidden budget investments" do
|
||||
|
||||
let(:budget) { create(:budget) }
|
||||
let(:heading) { create(:budget_heading, budget: budget, price: 666666) }
|
||||
|
||||
@@ -101,5 +100,4 @@ describe "Admin hidden budget investments" do
|
||||
expect(current_url).to include("filter=with_confirmed_hide")
|
||||
expect(current_url).to include("page=2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin hidden proposals" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -100,5 +99,4 @@ describe "Admin hidden proposals" do
|
||||
expect(current_url).to include("filter=with_confirmed_hide")
|
||||
expect(current_url).to include("page=2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin hidden users" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -93,5 +92,4 @@ describe "Admin hidden users" do
|
||||
expect(current_url).to include("filter=with_confirmed_hide")
|
||||
expect(current_url).to include("page=2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Homepage" do
|
||||
|
||||
before do
|
||||
Setting["homepage.widgets.feeds.proposals"] = false
|
||||
Setting["homepage.widgets.feeds.debates"] = false
|
||||
@@ -20,9 +19,7 @@ describe "Homepage" do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
context "Header" do
|
||||
|
||||
scenario "Admin menu links to homepage path" do
|
||||
|
||||
visit new_admin_widget_card_path(header_card: true)
|
||||
|
||||
click_link Setting["org_name"] + " Administration"
|
||||
@@ -32,7 +29,6 @@ describe "Homepage" do
|
||||
end
|
||||
|
||||
context "Feeds" do
|
||||
|
||||
scenario "Proposals", :js do
|
||||
5.times { create(:proposal) }
|
||||
|
||||
@@ -120,7 +116,6 @@ describe "Homepage" do
|
||||
end
|
||||
|
||||
xscenario "Deactivate"
|
||||
|
||||
end
|
||||
|
||||
scenario "Cards" do
|
||||
@@ -175,5 +170,4 @@ describe "Homepage" do
|
||||
|
||||
expect(page).to have_content("Recommendations that may interest you")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin legislation draft versions" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Feature flag" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["process.legislation"] = nil
|
||||
process = create(:legislation_process)
|
||||
expect { visit admin_legislation_process_draft_versions_path(process) }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying legislation process draft versions" do
|
||||
process = create(:legislation_process, title: "An example legislation process")
|
||||
draft_version = create(:legislation_draft_version, process: process, title: "Version 1")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin collaborative legislation" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -12,17 +11,14 @@ describe "Admin collaborative legislation" do
|
||||
"admin_legislation_process_milestones_path"
|
||||
|
||||
context "Feature flag" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["process.legislation"] = nil
|
||||
expect { visit admin_legislation_processes_path }
|
||||
.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying collaborative legislation" do
|
||||
process_1 = create(:legislation_process, title: "Process open")
|
||||
process_2 = create(:legislation_process, title: "Process for the future",
|
||||
@@ -62,7 +58,6 @@ describe "Admin collaborative legislation" do
|
||||
expect(process_3.title).to appear_before(process_2.title)
|
||||
expect(process_2.title).to appear_before(process_1.title)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Create" do
|
||||
@@ -189,7 +184,6 @@ describe "Admin collaborative legislation" do
|
||||
expect(find("#legislation_process_background_color").value).to eq "#e7f2fc"
|
||||
expect(find("#legislation_process_font_color").value).to eq "#222222"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Update" do
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin collaborative legislation" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying legislation proposals" do
|
||||
proposal = create(:legislation_proposal, cached_votes_score: 10)
|
||||
|
||||
@@ -81,5 +79,4 @@ describe "Admin collaborative legislation" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin legislation questions" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -10,7 +9,6 @@ describe "Admin legislation questions" do
|
||||
let!(:process) { create(:legislation_process, title: "An example legislation process") }
|
||||
|
||||
context "Feature flag" do
|
||||
|
||||
before do
|
||||
Setting["process.legislation"] = nil
|
||||
end
|
||||
@@ -18,11 +16,9 @@ describe "Admin legislation questions" do
|
||||
scenario "Disabled with a feature flag" do
|
||||
expect { visit admin_legislation_process_questions_path(process) }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Displaying legislation process questions" do
|
||||
create(:legislation_question, process: process, title: "Question 1")
|
||||
create(:legislation_question, process: process, title: "Question 2")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Imports" do
|
||||
|
||||
let(:base_files_path) { %w[spec fixtures files local_census_records import] }
|
||||
|
||||
before do
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin local census records" do
|
||||
|
||||
before do
|
||||
login_as(create(:administrator).user)
|
||||
end
|
||||
|
||||
@@ -81,5 +81,4 @@ describe "Admin managers" do
|
||||
expect(page).not_to have_content(manager1.email)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin milestone statuses" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -91,5 +90,4 @@ describe "Admin milestone statuses" do
|
||||
expect(page).not_to have_content status.description
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -81,5 +81,4 @@ describe "Admin moderators" do
|
||||
expect(page).not_to have_content(moderator1.email)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin::Organizations" do
|
||||
|
||||
before do
|
||||
administrator = create(:user)
|
||||
create(:administrator, user: administrator)
|
||||
@@ -214,5 +213,4 @@ describe "Admin::Organizations" do
|
||||
expect(current_url).to include("filter=pending")
|
||||
expect(current_url).to include("page=2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin Active polls" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -40,5 +39,4 @@ describe "Admin Active polls" do
|
||||
expect(page).to have_content "New description"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin booths assignments" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
describe "Admin Booth Assignment management" do
|
||||
|
||||
let!(:poll) { create(:poll) }
|
||||
let!(:booth) { create(:poll_booth) }
|
||||
|
||||
@@ -147,7 +145,6 @@ describe "Admin booths assignments" do
|
||||
|
||||
expect(page).not_to have_link "Unassign booth"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -325,6 +322,5 @@ describe "Admin booths assignments" do
|
||||
|
||||
expect(page).to have_content "There are no results"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin booths" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Officer Assignments" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -45,5 +44,4 @@ describe "Officer Assignments" do
|
||||
expect(page).not_to have_content "John Edwards"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -31,5 +31,4 @@ describe "Admin poll officers" do
|
||||
|
||||
expect(page).not_to have_css "#officers"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin polls" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -116,7 +115,6 @@ describe "Admin polls" do
|
||||
end
|
||||
|
||||
context "Destroy" do
|
||||
|
||||
scenario "Can destroy poll without questions", :js do
|
||||
poll = create(:poll)
|
||||
|
||||
@@ -164,9 +162,7 @@ describe "Admin polls" do
|
||||
end
|
||||
|
||||
context "Booths" do
|
||||
|
||||
context "Poll show" do
|
||||
|
||||
scenario "No booths" do
|
||||
poll = create(:poll)
|
||||
visit admin_poll_path(poll)
|
||||
@@ -196,9 +192,7 @@ describe "Admin polls" do
|
||||
end
|
||||
|
||||
context "Officers" do
|
||||
|
||||
context "Poll show" do
|
||||
|
||||
scenario "No officers", :js do
|
||||
poll = create(:poll)
|
||||
visit admin_poll_path(poll)
|
||||
@@ -234,9 +228,7 @@ describe "Admin polls" do
|
||||
end
|
||||
|
||||
context "Questions" do
|
||||
|
||||
context "Poll show" do
|
||||
|
||||
scenario "Question list", :js do
|
||||
poll = create(:poll)
|
||||
question = create(:poll_question, poll: poll)
|
||||
@@ -250,9 +242,7 @@ describe "Admin polls" do
|
||||
expect(page).to have_content votation_type_question.title
|
||||
expect(page).not_to have_content other_question.title
|
||||
expect(page).not_to have_content "There are no questions assigned to this poll"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -520,5 +510,4 @@ describe "Admin polls" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Answers" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as admin.user
|
||||
@@ -59,5 +58,4 @@ describe "Answers" do
|
||||
|
||||
expect("Another title").to appear_before("New title")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Documents" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -38,5 +37,4 @@ describe "Documents" do
|
||||
|
||||
expect(page).not_to have_content(document.title)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Images" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -58,5 +57,4 @@ describe "Images" do
|
||||
expect(page).not_to have_css("img[title='#{image.title}']")
|
||||
expect(page).not_to have_content(image.title)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Videos" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -29,5 +28,4 @@ describe "Videos" do
|
||||
expect(page).to have_content(video_title)
|
||||
expect(page).to have_content(video_url)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin poll questions" do
|
||||
|
||||
before do
|
||||
login_as(create(:administrator).user)
|
||||
end
|
||||
@@ -357,9 +356,7 @@ describe "Admin poll questions" do
|
||||
pending "Mark all city by default when creating a poll question from a successful proposal"
|
||||
|
||||
context "Poll select box" do
|
||||
|
||||
scenario "translates the poll name in options", :js do
|
||||
|
||||
poll = create(:poll, name_en: "Name in English", name_es: "Nombre en Español")
|
||||
proposal = create(:proposal)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin shifts" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -260,5 +259,4 @@ describe "Admin shifts" do
|
||||
|
||||
expect(page).to have_content "This booth has no shifts"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin proposal notifications" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -91,5 +90,4 @@ describe "Admin proposal notifications" do
|
||||
expect(current_url).to include("filter=with_confirmed_hide")
|
||||
expect(current_url).to include("page=2")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -10,7 +10,6 @@ describe "Admin proposals" do
|
||||
"admin_proposal_path"
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Search" do
|
||||
create(:proposal, title: "Make Pluto a planet again")
|
||||
create(:proposal, title: "Build a monument to honour CONSUL developers")
|
||||
@@ -49,11 +48,9 @@ describe "Admin proposals" do
|
||||
within("#proposal_#{proposal.id}") { expect(page).to have_link "Select" }
|
||||
expect(proposal.reload.selected?).to be false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Show" do
|
||||
|
||||
scenario "View proposal" do
|
||||
create(:proposal, title: "Create a chaotic future", summary: "Chaos isn't controlled")
|
||||
|
||||
@@ -105,6 +102,5 @@ describe "Admin proposals" do
|
||||
expect(find_field("Mark as selected")).not_to be_checked
|
||||
expect(proposal.reload.selected?).to be false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,7 +31,6 @@ describe "Admin settings" do
|
||||
end
|
||||
|
||||
describe "Update map" do
|
||||
|
||||
scenario "Should not be able when map feature deactivated" do
|
||||
Setting["feature.map"] = false
|
||||
admin = create(:administrator).user
|
||||
@@ -97,11 +96,9 @@ describe "Admin settings" do
|
||||
expect(find("#latitude", visible: false).value).not_to eq "51.48"
|
||||
expect(page).to have_content "Map configuration updated succesfully"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "Update content types" do
|
||||
|
||||
scenario "stores the correct mime types" do
|
||||
setting = Setting.create!(key: "upload.images.content_types", value: "image/png")
|
||||
admin = create(:administrator).user
|
||||
@@ -131,11 +128,9 @@ describe "Admin settings" do
|
||||
expect(find("#jpg")).not_to be_checked
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "Update Remote Census Configuration" do
|
||||
|
||||
before do
|
||||
Setting["feature.remote_census"] = true
|
||||
end
|
||||
@@ -165,13 +160,10 @@ describe "Admin settings" do
|
||||
'"Configure connection to remote census (SOAP)" ' \
|
||||
'on "Features" tab.'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "Should redirect to same tab after update setting" do
|
||||
|
||||
context "remote census" do
|
||||
|
||||
before do
|
||||
Setting["feature.remote_census"] = true
|
||||
end
|
||||
@@ -210,7 +202,6 @@ describe "Admin settings" do
|
||||
end
|
||||
|
||||
context "map configuration" do
|
||||
|
||||
before do
|
||||
Setting["feature.map"] = true
|
||||
end
|
||||
@@ -280,7 +271,6 @@ describe "Admin settings" do
|
||||
end
|
||||
|
||||
describe "Skip verification" do
|
||||
|
||||
scenario "deactivate skip verification", :js do
|
||||
Setting["feature.user.skip_verification"] = "true"
|
||||
setting = Setting.where(key: "feature.user.skip_verification").first
|
||||
@@ -310,7 +300,5 @@ describe "Admin settings" do
|
||||
|
||||
Setting["feature.user.skip_verification"] = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Signature sheets" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -73,11 +72,9 @@ describe "Signature sheets" do
|
||||
|
||||
expect(page).to have_content "1 support"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Create throught all required_fields_to_verify of custom census api" do
|
||||
|
||||
before do
|
||||
Setting["feature.remote_census"] = true
|
||||
Setting["remote_census.request.date_of_birth"] = "some.value"
|
||||
@@ -123,7 +120,6 @@ describe "Signature sheets" do
|
||||
|
||||
expect(page).to have_content "1 support"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Errors on create" do
|
||||
@@ -162,5 +158,4 @@ describe "Signature sheets" do
|
||||
expect(page).to have_content 2
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin custom content blocks" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Documents" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -85,5 +84,4 @@ describe "Documents" do
|
||||
expect(page).to have_content "Document deleted succesfully"
|
||||
expect(page).not_to have_content document.title
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin custom images" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin custom information texts" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -57,7 +56,6 @@ describe "Admin custom information texts" do
|
||||
end
|
||||
|
||||
context "Globalization" do
|
||||
|
||||
scenario "Add a translation", :js do
|
||||
key = "debates.index.section_footer.title"
|
||||
|
||||
@@ -130,5 +128,4 @@ describe "Admin custom information texts" do
|
||||
expect(debate_title.value_en).to eq("Custom debate title")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin custom pages" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "lists all created custom pages" do
|
||||
custom_page = create(:site_customization_page)
|
||||
visit admin_site_customization_pages_path
|
||||
@@ -33,7 +31,6 @@ describe "Admin custom pages" do
|
||||
expect(page).to have_content slug
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Create" do
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Stats" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -9,7 +8,6 @@ describe "Stats" do
|
||||
end
|
||||
|
||||
context "Summary" do
|
||||
|
||||
scenario "General" do
|
||||
create(:debate)
|
||||
2.times { create(:proposal) }
|
||||
@@ -36,11 +34,9 @@ describe "Stats" do
|
||||
expect(page).to have_content "Comment votes 3"
|
||||
expect(page).to have_content "Total votes 6"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Users" do
|
||||
|
||||
scenario "Summary" do
|
||||
1.times { create(:user, :level_three) }
|
||||
2.times { create(:user, :level_two) }
|
||||
@@ -94,11 +90,9 @@ describe "Stats" do
|
||||
|
||||
expect(page).to have_content "Level two users 1"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "Budget investments" do
|
||||
|
||||
context "Supporting phase" do
|
||||
let(:budget) { create(:budget) }
|
||||
let(:group_all_city) { create(:budget_group, budget: budget) }
|
||||
@@ -224,11 +218,9 @@ describe "Stats" do
|
||||
expect(page).to have_content "Participants 2"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "graphs" do
|
||||
|
||||
scenario "event graphs", :js do
|
||||
campaign = create(:campaign)
|
||||
|
||||
@@ -245,11 +237,9 @@ describe "Stats" do
|
||||
expect(page).to have_content event_created_at.strftime("%Y-%m-%d")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Proposal notifications" do
|
||||
|
||||
scenario "Summary stats" do
|
||||
proposal = create(:proposal)
|
||||
|
||||
@@ -296,11 +286,9 @@ describe "Stats" do
|
||||
expect(page).to have_content proposal_notification.body
|
||||
expect(page).to have_content "Proposal not available"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Direct messages" do
|
||||
|
||||
scenario "Summary stats" do
|
||||
sender = create(:user, :level_two)
|
||||
|
||||
@@ -319,11 +307,9 @@ describe "Stats" do
|
||||
expect(page).to have_content "2"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Polls" do
|
||||
|
||||
scenario "Total participants by origin" do
|
||||
create(:poll_officer_assignment)
|
||||
3.times { create(:poll_voter, origin: "web") }
|
||||
@@ -369,7 +355,6 @@ describe "Stats" do
|
||||
end
|
||||
|
||||
within("#polls") do
|
||||
|
||||
within("#poll_#{poll1.id}") do
|
||||
expect(page).to have_content "1"
|
||||
end
|
||||
@@ -377,7 +362,6 @@ describe "Stats" do
|
||||
within("#poll_#{poll2.id}") do
|
||||
expect(page).to have_content "2"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -412,7 +396,5 @@ describe "Stats" do
|
||||
expect(page).to have_content "2"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "System Emails" do
|
||||
|
||||
let(:admin) { create(:administrator) }
|
||||
|
||||
before do
|
||||
@@ -9,7 +8,6 @@ describe "System Emails" do
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
let(:system_emails_with_preview) { %w[proposal_notification_digest] }
|
||||
let(:system_emails) do
|
||||
%w[proposal_notification_digest budget_investment_created budget_investment_selected
|
||||
@@ -19,7 +17,6 @@ describe "System Emails" do
|
||||
end
|
||||
|
||||
context "System emails" do
|
||||
|
||||
scenario "have 'View' button" do
|
||||
visit admin_system_emails_path
|
||||
|
||||
@@ -29,11 +26,9 @@ describe "System Emails" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "System emails with preview" do
|
||||
|
||||
scenario "have 'Preview Pending' and 'Send pending' buttons" do
|
||||
visit admin_system_emails_path
|
||||
|
||||
@@ -49,11 +44,9 @@ describe "System Emails" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "System emails with info" do
|
||||
|
||||
scenario "have information about how to edit the email templates" do
|
||||
visit admin_system_emails_path
|
||||
|
||||
@@ -69,11 +62,9 @@ describe "System Emails" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "View" do
|
||||
|
||||
let(:user) { create(:user, :level_two, username: "John Doe") }
|
||||
let(:budget) { create(:budget, name: "Budget for 2019") }
|
||||
let(:heading) { create(:budget_heading, budget: budget) }
|
||||
@@ -267,7 +258,6 @@ describe "System Emails" do
|
||||
expect(page).to have_link "Cleaner city",
|
||||
href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Preview Pending" do
|
||||
@@ -336,5 +326,4 @@ describe "System Emails" do
|
||||
expect(page).to have_content("Pending notifications sent succesfully")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin tags" do
|
||||
|
||||
before do
|
||||
create(:tag, :category, name: "Existence")
|
||||
login_as(create(:administrator).user)
|
||||
@@ -89,5 +88,4 @@ describe "Admin tags" do
|
||||
expect(Tag.category.where(name: "wow_category")).to exist
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Valuator groups" do
|
||||
|
||||
let(:admin) { create(:administrator).user }
|
||||
|
||||
before do
|
||||
@@ -117,7 +116,5 @@ describe "Valuator groups" do
|
||||
expect(page).to have_content "Valuator updated successfully"
|
||||
expect(page).not_to have_content "Health"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin valuators" do
|
||||
|
||||
let(:admin) { create(:administrator) }
|
||||
let!(:user) { create(:user, username: "Jose Luis Balbin") }
|
||||
let!(:valuator) { create(:valuator) }
|
||||
@@ -110,5 +109,4 @@ describe "Admin valuators" do
|
||||
expect(page).not_to have_content(valuator1.email)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Incomplete verifications" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
@@ -71,5 +70,4 @@ describe "Incomplete verifications" do
|
||||
expect(page).to have_content "Has not confirmed the sms code"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Cards" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator).user
|
||||
login_as(admin)
|
||||
@@ -109,7 +108,6 @@ describe "Cards" do
|
||||
end
|
||||
|
||||
context "Header Card" do
|
||||
|
||||
scenario "Create" do
|
||||
visit admin_homepage_path
|
||||
click_link "Create header"
|
||||
@@ -219,9 +217,7 @@ describe "Cards" do
|
||||
expect(page).to have_current_path admin_site_customization_page_cards_path(custom_page)
|
||||
expect(page).not_to have_content "Card title"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
pending "add image expectactions"
|
||||
|
||||
@@ -84,5 +84,4 @@ describe "Admin" do
|
||||
expect(page).not_to have_css("#moderation_menu")
|
||||
expect(page).not_to have_css("#valuation_menu")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Banner" do
|
||||
|
||||
scenario "The banner is shown correctly" do
|
||||
create(:web_section, name: "homepage")
|
||||
banner = create(:banner, title: "Hello",
|
||||
|
||||
@@ -6,7 +6,6 @@ describe "Poll budget ballot sheets" do
|
||||
let(:poll_officer) { create(:poll_officer) }
|
||||
|
||||
context "Officing recounts and results view" do
|
||||
|
||||
before do
|
||||
create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth,
|
||||
date: Date.current)
|
||||
@@ -30,11 +29,9 @@ describe "Poll budget ballot sheets" do
|
||||
expect(page).to have_content("Add results")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Booth assignment" do
|
||||
|
||||
scenario "Try to access ballot sheets officing without booth assignment" do
|
||||
login_as(poll_officer.user)
|
||||
visit officing_poll_ballot_sheets_path(poll)
|
||||
@@ -70,11 +67,9 @@ describe "Poll budget ballot sheets" do
|
||||
|
||||
expect(page).to have_content "Choose your booth"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
before do
|
||||
create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth,
|
||||
date: Date.current)
|
||||
@@ -91,11 +86,9 @@ describe "Poll budget ballot sheets" do
|
||||
|
||||
expect(page).to have_content "Ballot sheet #{ballot_sheet.id}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "New" do
|
||||
|
||||
before do
|
||||
create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth,
|
||||
date: Date.current)
|
||||
@@ -138,11 +131,9 @@ describe "Poll budget ballot sheets" do
|
||||
|
||||
expect(page).to have_content "Officer assignment can't be blank"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Show" do
|
||||
|
||||
before do
|
||||
create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth,
|
||||
date: Date.current)
|
||||
@@ -161,6 +152,5 @@ describe "Poll budget ballot sheets" do
|
||||
expect(page).to have_content(ballot_sheet.author)
|
||||
expect(page).to have_content(ballot_sheet.data)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Admin Budgets" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator).user
|
||||
login_as(admin)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Create poll if the budget does not have a poll associated" do
|
||||
budget = create(:budget)
|
||||
|
||||
@@ -54,11 +52,9 @@ describe "Admin Budgets" do
|
||||
expect(page).to have_link "Admin ballots", href: admin_poll_booth_assignments_path(poll)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Show" do
|
||||
|
||||
scenario "Do not show questions section if the budget have a poll associated" do
|
||||
poll = create(:poll, :for_budget)
|
||||
|
||||
@@ -72,7 +68,5 @@ describe "Admin Budgets" do
|
||||
expect(page).to have_content("Results")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Budget Poll Officing" do
|
||||
|
||||
scenario "Show sidebar menus if officer has shifts assigned" do
|
||||
booth = create(:poll_booth)
|
||||
booth_assignment = create(:poll_booth_assignment, booth: booth)
|
||||
@@ -35,5 +34,4 @@ describe "Budget Poll Officing" do
|
||||
expect(page).not_to have_content("Validate document")
|
||||
expect(page).not_to have_content("Total recounts and results")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Polls" do
|
||||
|
||||
context "Public index" do
|
||||
|
||||
scenario "Budget polls should not be listed" do
|
||||
poll = create(:poll)
|
||||
budget_poll = create(:poll, :for_budget)
|
||||
@@ -13,11 +11,9 @@ describe "Polls" do
|
||||
expect(page).to have_content(poll.name)
|
||||
expect(page).not_to have_content(budget_poll.name)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Admin index" do
|
||||
|
||||
scenario "Budget polls should not appear in the list" do
|
||||
poll = create(:poll)
|
||||
budget_poll = create(:poll, :for_budget)
|
||||
@@ -29,5 +25,4 @@ describe "Polls" do
|
||||
expect(page).not_to have_content(budget_poll.name)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Poll Questions" do
|
||||
|
||||
before do
|
||||
admin = create(:administrator).user
|
||||
login_as(admin)
|
||||
@@ -16,5 +15,4 @@ describe "Poll Questions" do
|
||||
expect(page).to have_select("poll_id", text: "Citizen Proposal Poll")
|
||||
expect(page).not_to have_select("poll_id", text: "Participatory Budget Poll")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -138,6 +138,5 @@ describe "BudgetPolls", :with_frozen_time do
|
||||
expect(page).to have_content("Has already participated in this poll")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Ballots" do
|
||||
|
||||
let(:user) { create(:user, :level_two) }
|
||||
let!(:budget) { create(:budget, :balloting) }
|
||||
let!(:states) { create(:budget_group, budget: budget, name: "States") }
|
||||
@@ -35,7 +34,6 @@ describe "Ballots" do
|
||||
visit budget_ballot_path(0)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Lines Load" do
|
||||
@@ -51,11 +49,9 @@ describe "Ballots" do
|
||||
|
||||
within("#sidebar") { expect(page).to have_content "More rain" }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Voting" do
|
||||
|
||||
before do
|
||||
login_as(user)
|
||||
visit budget_path(budget)
|
||||
@@ -65,7 +61,6 @@ describe "Ballots" do
|
||||
let!(:districts) { create(:budget_group, budget: budget, name: "Districts") }
|
||||
|
||||
context "Group and Heading Navigation" do
|
||||
|
||||
scenario "Groups" do
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -90,7 +85,6 @@ describe "Ballots" do
|
||||
|
||||
expect(page).to have_link "District 1"
|
||||
expect(page).to have_link "District 2"
|
||||
|
||||
end
|
||||
|
||||
scenario "Investments" do
|
||||
@@ -144,11 +138,9 @@ describe "Ballots" do
|
||||
|
||||
expect(page).to have_content city_investment.title
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Adding and Removing Investments" do
|
||||
|
||||
scenario "Add a investment", :js do
|
||||
create(:budget_investment, :selected, heading: new_york, price: 10000, title: "Bring back King Kong")
|
||||
create(:budget_investment, :selected, heading: new_york, price: 20000, title: "Paint cabs black")
|
||||
@@ -238,12 +230,10 @@ describe "Ballots" do
|
||||
expect(page).to have_content "OpenStreetMap"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#Break up or simplify with helpers
|
||||
context "Balloting in multiple headings" do
|
||||
|
||||
scenario "Independent progress bar for headings", :js do
|
||||
city_heading = create(:budget_heading, group: city, name: "All city", price: 10000000)
|
||||
district_heading1 = create(:budget_heading, group: districts, name: "District 1", price: 1000000)
|
||||
@@ -370,7 +360,6 @@ describe "Ballots" do
|
||||
expect(page).to have_content "You have active votes in another heading: California"
|
||||
expect(page).to have_link california.name, href: budget_investments_path(budget, heading_id: california.id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Showing the ballot" do
|
||||
@@ -428,7 +417,6 @@ describe "Ballots" do
|
||||
|
||||
expect(page).to have_link "You have not voted on this group yet, go vote!", href: budget_group_path(budget, group)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Removing investments from ballot", :js do
|
||||
@@ -508,7 +496,6 @@ describe "Ballots" do
|
||||
end
|
||||
|
||||
context "Permissions" do
|
||||
|
||||
scenario "User not logged in", :js do
|
||||
investment = create(:budget_investment, :selected, heading: new_york)
|
||||
|
||||
@@ -623,7 +610,6 @@ describe "Ballots" do
|
||||
expect(page).to have_content("You have already assigned the available budget")
|
||||
expect(page).to have_selector(".in-favor a", visible: false)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Insufficient funds (removed after destroy)", :js do
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Budgets" do
|
||||
|
||||
let(:budget) { create(:budget) }
|
||||
let(:level_two_user) { create(:user, :level_two) }
|
||||
let(:allowed_phase_list) { ["balloting", "reviewing_ballots", "finished"] }
|
||||
|
||||
context "Load" do
|
||||
|
||||
before { budget.update(slug: "budget_slug") }
|
||||
|
||||
scenario "finds budget by slug" do
|
||||
@@ -27,11 +25,9 @@ describe "Budgets" do
|
||||
visit budget_path(0)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
scenario "Show normal index with links" do
|
||||
group1 = create(:budget_group, budget: budget)
|
||||
group2 = create(:budget_group, budget: budget)
|
||||
@@ -207,7 +203,6 @@ describe "Budgets" do
|
||||
end
|
||||
|
||||
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,
|
||||
@@ -365,7 +360,6 @@ describe "Budgets" do
|
||||
end
|
||||
|
||||
context "Show" do
|
||||
|
||||
scenario "List all groups" do
|
||||
create(:budget_group, budget: budget)
|
||||
create(:budget_group, budget: budget)
|
||||
@@ -477,11 +471,9 @@ describe "Budgets" do
|
||||
visit budget_path(budget)
|
||||
expect(page).not_to have_link "See results"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "In Drafting phase" do
|
||||
|
||||
let(:admin) { create(:administrator).user }
|
||||
|
||||
before do
|
||||
@@ -516,23 +508,19 @@ describe "Budgets" do
|
||||
expect(page.status_code).to eq(200)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Accepting" do
|
||||
|
||||
before do
|
||||
budget.update(phase: "accepting")
|
||||
end
|
||||
|
||||
context "Permissions" do
|
||||
|
||||
scenario "Verified user" do
|
||||
login_as(level_two_user)
|
||||
|
||||
visit budget_path(budget)
|
||||
expect(page).to have_link "Create a budget investment"
|
||||
|
||||
end
|
||||
|
||||
scenario "Unverified user" do
|
||||
@@ -549,7 +537,6 @@ describe "Budgets" do
|
||||
|
||||
expect(page).to have_content "To create a new budget investment you must sign in or sign up"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Executions" do
|
||||
|
||||
let(:budget) { create(:budget, :finished) }
|
||||
let(:group) { create(:budget_group, budget: budget) }
|
||||
let(:heading) { create(:budget_heading, group: group) }
|
||||
@@ -77,7 +76,6 @@ describe "Executions" do
|
||||
end
|
||||
|
||||
context "Images" do
|
||||
|
||||
scenario "renders milestone image if available" do
|
||||
milestone1 = create(:milestone, :with_image, milestoneable: investment1)
|
||||
|
||||
@@ -129,11 +127,9 @@ describe "Executions" do
|
||||
expect(page).to have_content(investment1.title)
|
||||
expect(page).to have_css("img[alt='Second image']")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Filters" do
|
||||
|
||||
let!(:status1) { create(:milestone_status, name: "Studying the project") }
|
||||
let!(:status2) { create(:milestone_status, name: "Bidding") }
|
||||
|
||||
@@ -269,7 +265,6 @@ describe "Executions" do
|
||||
expect(page).not_to have_content(investment1.title)
|
||||
expect(page).to have_content(investment2.title)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Heading Order" do
|
||||
@@ -288,7 +283,6 @@ describe "Executions" do
|
||||
end
|
||||
|
||||
context "No milestones" do
|
||||
|
||||
scenario "Milestone not yet published" do
|
||||
status = create(:milestone_status)
|
||||
create(:milestone, milestoneable: investment1, status: status, publication_date: Date.tomorrow)
|
||||
@@ -297,6 +291,5 @@ describe "Executions" do
|
||||
|
||||
expect(page).to have_content("No winner investments in this state")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Budget Groups" do
|
||||
|
||||
let(:budget) { create(:budget, slug: "budget_slug") }
|
||||
let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) }
|
||||
|
||||
context "Load" do
|
||||
|
||||
scenario "finds group using budget slug and group slug" do
|
||||
visit budget_group_path("budget_slug", "group_slug")
|
||||
expect(page).to have_content "Select an option"
|
||||
@@ -52,5 +50,4 @@ describe "Budget Groups" do
|
||||
expect(first_heading.name).to appear_before(last_heading.name)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@ require "rails_helper"
|
||||
require "sessions_helper"
|
||||
|
||||
describe "Budget Investments" do
|
||||
|
||||
let(:author) { create(:user, :level_two, username: "Isabel") }
|
||||
let(:budget) { create(:budget, name: "Big Budget") }
|
||||
let(:other_budget) { create(:budget, name: "What a Budget!") }
|
||||
@@ -28,7 +27,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "Load" do
|
||||
|
||||
let(:investment) { create(:budget_investment, heading: heading) }
|
||||
|
||||
before do
|
||||
@@ -71,7 +69,6 @@ describe "Budget Investments" do
|
||||
visit budget_investment_path(budget, investment, heading_id: 0)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Index" do
|
||||
@@ -156,7 +153,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context("Search") do
|
||||
|
||||
scenario "Search by text" do
|
||||
investment1 = create(:budget_investment, heading: heading, title: "Get Schwifty")
|
||||
investment2 = create(:budget_investment, heading: heading, title: "Schwifty Hello")
|
||||
@@ -179,7 +175,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "Advanced search" do
|
||||
|
||||
scenario "Search by text", :js do
|
||||
bdgt_invest1 = create(:budget_investment, heading: heading, title: "Get Schwifty")
|
||||
bdgt_invest2 = create(:budget_investment, heading: heading, title: "Schwifty Hello")
|
||||
@@ -194,7 +189,6 @@ describe "Budget Investments" do
|
||||
expect(page).to have_content("There are 2 investments")
|
||||
|
||||
within("#budget-investments") do
|
||||
|
||||
expect(page).to have_content(bdgt_invest1.title)
|
||||
expect(page).to have_content(bdgt_invest2.title)
|
||||
expect(page).not_to have_content(bdgt_invest3.title)
|
||||
@@ -202,7 +196,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "Search by author type" do
|
||||
|
||||
scenario "Public employee", :js do
|
||||
ana = create :user, official_level: 1
|
||||
john = create :user, official_level: 2
|
||||
@@ -317,13 +310,10 @@ describe "Budget Investments" do
|
||||
expect(page).not_to have_content(bdgt_invest3.title)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Search by date" do
|
||||
|
||||
context "Predefined date ranges" do
|
||||
|
||||
scenario "Last day", :js do
|
||||
bdgt_invest1 = create(:budget_investment, heading: heading, created_at: 1.minute.ago)
|
||||
bdgt_invest2 = create(:budget_investment, heading: heading, created_at: 1.hour.ago)
|
||||
@@ -403,7 +393,6 @@ describe "Budget Investments" do
|
||||
expect(page).not_to have_content(bdgt_invest3.title)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Search by custom date range", :js do
|
||||
@@ -510,13 +499,11 @@ describe "Budget Investments" do
|
||||
expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime("%d/%m/%Y")}']")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context("Filters") do
|
||||
|
||||
scenario "by unfeasibility" do
|
||||
investment1 = create(:budget_investment, :unfeasible, :finished, heading: heading)
|
||||
investment2 = create(:budget_investment, :feasible, heading: heading)
|
||||
@@ -577,7 +564,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "Results Phase" do
|
||||
|
||||
before { budget.update(phase: "finished", results_enabled: true) }
|
||||
|
||||
scenario "show winners by default" do
|
||||
@@ -860,7 +846,6 @@ describe "Budget Investments" do
|
||||
def investments_order
|
||||
all(".budget-investment h3").collect { |i| i.text }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Phase I - Accepting" do
|
||||
@@ -1079,11 +1064,9 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "Show Investment's price & cost explanation" do
|
||||
|
||||
let(:investment) { create(:budget_investment, :selected_with_price, heading: heading) }
|
||||
|
||||
context "When investment with price is selected" do
|
||||
|
||||
scenario "Price & explanation is shown when Budget is on published prices phase" do
|
||||
Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase|
|
||||
budget.update!(phase: phase)
|
||||
@@ -1120,7 +1103,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "When investment with price is unselected" do
|
||||
|
||||
before do
|
||||
investment.update(selected: false)
|
||||
end
|
||||
@@ -1140,7 +1122,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Can access the community" do
|
||||
@@ -1198,7 +1179,6 @@ describe "Budget Investments" do
|
||||
expect(page).not_to have_content("Price explanation")
|
||||
expect(page).not_to have_content(investment.price_explanation)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Show (unfeasible budget investment) only when valuation finished" do
|
||||
@@ -1358,7 +1338,6 @@ describe "Budget Investments" do
|
||||
{ "budget_id": "budget_id" }
|
||||
|
||||
context "Destroy" do
|
||||
|
||||
scenario "Admin cannot destroy budget investments" do
|
||||
user = create(:user, :level_two)
|
||||
investment = create(:budget_investment, heading: heading, author: user)
|
||||
@@ -1388,13 +1367,11 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "Selecting Phase" do
|
||||
|
||||
before do
|
||||
budget.update(phase: "selecting")
|
||||
end
|
||||
|
||||
context "Popup alert to vote only in one heading per group" do
|
||||
|
||||
scenario "When supporting in the first heading group", :js do
|
||||
carabanchel = create(:budget_heading, group: group)
|
||||
salamanca = create(:budget_heading, group: group)
|
||||
@@ -1463,11 +1440,9 @@ describe "Budget Investments" do
|
||||
expect(page).to have_content "Supports"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Evaluating Phase" do
|
||||
|
||||
before do
|
||||
budget.update(phase: "valuating")
|
||||
end
|
||||
@@ -1503,11 +1478,9 @@ describe "Budget Investments" do
|
||||
expect(page).to have_content "1 support"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Publishing prices phase" do
|
||||
|
||||
before do
|
||||
budget.update(phase: "publishing_prices")
|
||||
end
|
||||
@@ -1528,7 +1501,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
context "Balloting Phase" do
|
||||
|
||||
before do
|
||||
budget.update(phase: "balloting")
|
||||
end
|
||||
@@ -1787,7 +1759,6 @@ describe "Budget Investments" do
|
||||
end
|
||||
|
||||
describe "Reclassification" do
|
||||
|
||||
scenario "Due to heading change" do
|
||||
investment = create(:budget_investment, :selected, heading: heading)
|
||||
user = create(:user, :level_two, ballot_lines: [investment])
|
||||
@@ -1823,7 +1794,6 @@ describe "Budget Investments" do
|
||||
|
||||
expect(page).to have_content("You have voted 0 investment")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1988,5 +1958,4 @@ describe "Budget Investments" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Results" do
|
||||
|
||||
let(:budget) { create(:budget, :finished) }
|
||||
let(:group) { create(:budget_group, budget: budget) }
|
||||
let(:heading) { create(:budget_heading, group: group, price: 1000) }
|
||||
@@ -122,5 +121,4 @@ describe "Results" do
|
||||
|
||||
expect(page).not_to have_content "Incompatibles"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Stats" do
|
||||
|
||||
let(:budget) { create(:budget, :finished) }
|
||||
let(:heading) { create(:budget_heading, budget: budget, price: 1000) }
|
||||
|
||||
context "Load" do
|
||||
|
||||
before { budget.update(slug: "budget_slug") }
|
||||
|
||||
scenario "finds budget by slug" do
|
||||
@@ -26,7 +24,6 @@ describe "Stats" do
|
||||
visit budget_stats_path(0)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "Show" do
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Votes" do
|
||||
|
||||
describe "Investments" do
|
||||
let(:manuela) { create(:user, verified_at: Time.current) }
|
||||
let(:budget) { create(:budget, :selecting) }
|
||||
@@ -11,7 +10,6 @@ describe "Votes" do
|
||||
before { login_as(manuela) }
|
||||
|
||||
describe "Index" do
|
||||
|
||||
scenario "Index shows user votes on proposals" do
|
||||
investment1 = create(:budget_investment, heading: heading, voters: [manuela])
|
||||
investment2 = create(:budget_investment, heading: heading)
|
||||
@@ -105,7 +103,6 @@ describe "Votes" do
|
||||
end
|
||||
|
||||
context "Voting in multiple headings of a single group" do
|
||||
|
||||
let(:new_york) { heading }
|
||||
let(:san_francisco) { create(:budget_heading, group: group) }
|
||||
let(:third_heading) { create(:budget_heading, group: group) }
|
||||
@@ -195,7 +192,6 @@ describe "Votes" do
|
||||
|
||||
expect(page.driver.send(:find_modal).text).to match "You can only support investments in 2 districts."
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,5 +36,4 @@ describe "Email campaigns" do
|
||||
|
||||
expect(page).not_to have_content campaign2.name.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "CKEditor" do
|
||||
|
||||
scenario "is present before & after turbolinks update page", :js do
|
||||
author = create(:user)
|
||||
login_as(author)
|
||||
@@ -15,5 +14,4 @@ describe "CKEditor" do
|
||||
|
||||
expect(page).to have_css ".translatable-fields[data-locale='en'] .cke_wysiwyg_frame"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -249,7 +249,6 @@ describe "Commenting Budget::Investments" do
|
||||
click_button "Publish reply"
|
||||
expect(page).to have_content "Can't be blank"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "N replies", :js do
|
||||
@@ -486,7 +485,6 @@ describe "Commenting Budget::Investments" do
|
||||
expect(page).to have_css "div.is-admin"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "can not comment as a moderator" do
|
||||
@@ -507,7 +505,6 @@ describe "Commenting Budget::Investments" do
|
||||
let!(:comment) { create(:comment, commentable: investment) }
|
||||
|
||||
before do
|
||||
|
||||
login_as(verified)
|
||||
end
|
||||
|
||||
@@ -591,5 +588,4 @@ describe "Commenting Budget::Investments" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user