Merge pull request #1341 from consul/budgets-settings

Sets spending proposal's settings to nil
This commit is contained in:
Juanjo Bazán
2017-01-10 21:47:20 +01:00
committed by GitHub
13 changed files with 40 additions and 5 deletions

View File

@@ -25,8 +25,8 @@ Setting.create(key: 'url', value: 'http://localhost:3000')
Setting.create(key: 'org_name', value: 'Consul')
Setting.create(key: 'place_name', value: 'City')
Setting.create(key: 'feature.debates', value: "true")
Setting.create(key: 'feature.spending_proposals', value: "true")
Setting.create(key: 'feature.spending_proposal_features.voting_allowed', value: "true")
Setting.create(key: 'feature.spending_proposals', value: nil)
Setting.create(key: 'feature.spending_proposal_features.voting_allowed', value: nil)
Setting.create(key: 'feature.budgets', value: "true")
Setting.create(key: 'feature.twitter_login', value: "true")
Setting.create(key: 'feature.facebook_login', value: "true")

View File

@@ -63,7 +63,7 @@ Setting["meta_keywords"] = nil
# Feature flags
Setting['feature.debates'] = true
Setting['feature.spending_proposals'] = true
Setting['feature.spending_proposals'] = nil
Setting['feature.twitter_login'] = true
Setting['feature.facebook_login'] = true
Setting['feature.google_login'] = true
@@ -72,7 +72,7 @@ Setting['feature.budgets'] = true
Setting['feature.signature_sheets'] = true
# Spending proposals feature flags
Setting['feature.spending_proposal_features.voting_allowed'] = true
Setting['feature.spending_proposal_features.voting_allowed'] = nil
# Banner styles
Setting['banner-style.banner-style-one'] = "Banner style 1"

View File

@@ -3,6 +3,8 @@ require 'rails_helper'
feature 'Admin feature flags' do
background do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
login_as(create(:administrator).user)
end

View File

@@ -3,6 +3,8 @@ require 'rails_helper'
feature 'Admin spending proposals' do
background do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
admin = create(:administrator)
login_as(admin.user)
end

View File

@@ -55,6 +55,8 @@ feature 'Admin' do
end
scenario "Admin access links" do
Setting["feature.spending_proposals"] = true
login_as(administrator)
visit root_path

View File

@@ -123,6 +123,8 @@ feature 'Emails' do
end
scenario "Email on unfeasible spending proposal" do
Setting["feature.spending_proposals"] = true
spending_proposal = create(:spending_proposal)
administrator = create(:administrator)
valuator = create(:valuator)

View File

@@ -3,6 +3,8 @@ require 'rails_helper'
feature 'Spending Proposals' do
background do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
login_as_manager
end

View File

@@ -73,6 +73,7 @@ feature 'Official positions' do
context "Spending proposals" do
background do
Setting["feature.spending_proposals"] = true
@spending_proposal1 = create(:spending_proposal, author: @user1)
@spending_proposal2 = create(:spending_proposal, author: @user2)
end

View File

@@ -4,6 +4,11 @@ feature 'Spending proposals' do
let(:author) { create(:user, :level_two, username: 'Isabel') }
background do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
end
scenario 'Index' do
spending_proposals = [create(:spending_proposal), create(:spending_proposal), create(:spending_proposal, feasible: true)]
unfeasible_spending_proposal = create(:spending_proposal, feasible: false)

View File

@@ -3,6 +3,8 @@ require 'rails_helper'
feature 'Valuation spending proposals' do
background do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
@valuator = create(:valuator, user: create(:user, username: 'Rachel', email: 'rachel@valuators.org'))
login_as(@valuator.user)
end

View File

@@ -3,6 +3,11 @@ require 'rails_helper'
feature 'Valuation' do
let(:user) { create(:user) }
background do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
end
scenario 'Access as regular user is not authorized' do
login_as(user)
visit root_path

View File

@@ -363,7 +363,11 @@ feature 'Votes' do
end
feature 'Spending Proposals' do
background { login_as(@manuela) }
background do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
login_as(@manuela)
end
feature 'Index' do
scenario "Index shows user votes on proposals" do

View File

@@ -290,6 +290,11 @@ describe SpendingProposal do
let(:city_sp) { create(:spending_proposal) }
let(:district_sp) { create(:spending_proposal, geozone: district) }
before(:each) do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
end
describe '#reason_for_not_being_votable_by' do
it "rejects not logged in users" do
expect(city_sp.reason_for_not_being_votable_by(nil)).to eq(:not_logged_in)
@@ -344,6 +349,9 @@ describe SpendingProposal do
describe "total votes" do
it "takes into account physical votes in addition to web votes" do
Setting["feature.spending_proposals"] = true
Setting['feature.spending_proposal_features.voting_allowed'] = true
sp = create(:spending_proposal)
sp.register_vote(create(:user, :level_two), true)
expect(sp.total_votes).to eq(1)