Merge branch 'master' into dashboard

This commit is contained in:
decabeza
2019-03-26 16:45:48 +01:00
2476 changed files with 62613 additions and 84405 deletions

View File

@@ -1,5 +1,5 @@
require 'rails_helper'
require 'cancan/matchers'
require "rails_helper"
require "cancan/matchers"
describe Abilities::Common do
subject(:ability) { Ability.new(user) }
@@ -15,10 +15,10 @@ describe Abilities::Common do
let(:own_comment) { create(:comment, author: user) }
let(:own_proposal) { create(:proposal, author: user) }
let(:accepting_budget) { create(:budget, phase: 'accepting') }
let(:reviewing_budget) { create(:budget, phase: 'reviewing') }
let(:selecting_budget) { create(:budget, phase: 'selecting') }
let(:balloting_budget) { create(:budget, phase: 'balloting') }
let(:accepting_budget) { create(:budget, phase: "accepting") }
let(:reviewing_budget) { create(:budget, phase: "reviewing") }
let(:selecting_budget) { create(:budget, phase: "selecting") }
let(:balloting_budget) { create(:budget, phase: "balloting") }
let(:investment_in_accepting_budget) { create(:budget_investment, budget: accepting_budget) }
let(:investment_in_reviewing_budget) { create(:budget_investment, budget: reviewing_budget) }
@@ -33,9 +33,6 @@ describe Abilities::Common do
let(:ballot_in_balloting_budget) { create(:budget_ballot, budget: balloting_budget) }
let(:current_poll) { create(:poll) }
let(:incoming_poll) { create(:poll, :incoming) }
let(:incoming_poll_from_own_geozone) { create(:poll, :incoming, geozone_restricted: true, geozones: [geozone]) }
let(:incoming_poll_from_other_geozone) { create(:poll, :incoming, geozone_restricted: true, geozones: [create(:geozone)]) }
let(:expired_poll) { create(:poll, :expired) }
let(:expired_poll_from_own_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [geozone]) }
let(:expired_poll_from_other_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [create(:geozone)]) }
@@ -51,10 +48,6 @@ describe Abilities::Common do
let(:expired_poll_question_from_other_geozone) { create(:poll_question, poll: expired_poll_from_other_geozone) }
let(:expired_poll_question_from_all_geozones) { create(:poll_question, poll: expired_poll) }
let(:incoming_poll_question_from_own_geozone) { create(:poll_question, poll: incoming_poll_from_own_geozone) }
let(:incoming_poll_question_from_other_geozone) { create(:poll_question, poll: incoming_poll_from_other_geozone) }
let(:incoming_poll_question_from_all_geozones) { create(:poll_question, poll: incoming_poll) }
let(:own_proposal_document) { build(:document, documentable: own_proposal) }
let(:proposal_document) { build(:document, documentable: proposal) }
let(:own_budget_investment_document) { build(:document, documentable: own_investment_in_accepting_budget) }
@@ -106,7 +99,7 @@ describe Abilities::Common do
it { should_not be_able_to(:destroy, budget_investment_image) }
it { should_not be_able_to(:manage, Dashboard::Action) }
describe 'flagging content' do
describe "flagging content" do
it { should be_able_to(:flag, debate) }
it { should be_able_to(:unflag, debate) }
@@ -223,7 +216,6 @@ describe Abilities::Common do
describe "Poll" do
it { should be_able_to(:answer, current_poll) }
it { should_not be_able_to(:answer, expired_poll) }
it { should_not be_able_to(:answer, incoming_poll) }
it { should be_able_to(:answer, poll_question_from_own_geozone) }
it { should be_able_to(:answer, poll_question_from_all_geozones) }
@@ -233,10 +225,6 @@ describe Abilities::Common do
it { should_not be_able_to(:answer, expired_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, expired_poll_question_from_other_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_own_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, incoming_poll_question_from_other_geozone) }
context "without geozone" do
before { user.geozone = nil }
@@ -247,10 +235,6 @@ describe Abilities::Common do
it { should_not be_able_to(:answer, expired_poll_question_from_own_geozone) }
it { should_not be_able_to(:answer, expired_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, expired_poll_question_from_other_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_own_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, incoming_poll_question_from_other_geozone) }
end
end
@@ -305,7 +289,6 @@ describe Abilities::Common do
it { should be_able_to(:answer, current_poll) }
it { should_not be_able_to(:answer, expired_poll) }
it { should_not be_able_to(:answer, incoming_poll) }
it { should be_able_to(:answer, poll_question_from_own_geozone) }
it { should be_able_to(:answer, poll_question_from_all_geozones) }
@@ -315,10 +298,6 @@ describe Abilities::Common do
it { should_not be_able_to(:answer, expired_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, expired_poll_question_from_other_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_own_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, incoming_poll_question_from_other_geozone) }
context "without geozone" do
before { user.geozone = nil }
it { should_not be_able_to(:answer, poll_question_from_own_geozone) }
@@ -328,10 +307,6 @@ describe Abilities::Common do
it { should_not be_able_to(:answer, expired_poll_question_from_own_geozone) }
it { should_not be_able_to(:answer, expired_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, expired_poll_question_from_other_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_own_geozone) }
it { should_not be_able_to(:answer, incoming_poll_question_from_all_geozones) }
it { should_not be_able_to(:answer, incoming_poll_question_from_other_geozone) }
end
end