Merge branch 'master' into feature/2275#destroy_budgets
This commit is contained in:
@@ -20,7 +20,7 @@ Rails:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Max: 140
|
Max: 100
|
||||||
|
|
||||||
Layout/IndentationConsistency:
|
Layout/IndentationConsistency:
|
||||||
EnforcedStyle: rails
|
EnforcedStyle: rails
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Admin::BudgetsController < Admin::BaseController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @budget.update(budget_params)
|
if @budget.update(budget_params)
|
||||||
redirect_to admin_budget_path(@budget), notice: t('admin.budgets.update.notice')
|
redirect_to admin_budgets_path, notice: t('admin.budgets.update.notice')
|
||||||
else
|
else
|
||||||
render :edit
|
render :edit
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class BudgetsController < ApplicationController
|
class BudgetsController < ApplicationController
|
||||||
include FeatureFlags
|
include FeatureFlags
|
||||||
|
include BudgetsHelper
|
||||||
feature_flag :budgets
|
feature_flag :budgets
|
||||||
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
@@ -9,6 +10,7 @@ class BudgetsController < ApplicationController
|
|||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
raise ActionController::RoutingError, 'Not Found' unless budget_published?(@budget)
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|||||||
@@ -42,4 +42,9 @@ module BudgetsHelper
|
|||||||
def investment_tags_select_options
|
def investment_tags_select_options
|
||||||
Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct
|
Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def budget_published?(budget)
|
||||||
|
!budget.drafting? || current_user&.administrator?
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ class Budget < ActiveRecord::Base
|
|||||||
include Measurable
|
include Measurable
|
||||||
include Sluggable
|
include Sluggable
|
||||||
|
|
||||||
PHASES = %w(accepting reviewing selecting valuating balloting reviewing_ballots finished).freeze
|
PHASES = %w(drafting accepting reviewing selecting valuating balloting
|
||||||
|
reviewing_ballots finished).freeze
|
||||||
CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze
|
CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze
|
||||||
|
|
||||||
validates :name, presence: true, uniqueness: true
|
validates :name, presence: true, uniqueness: true
|
||||||
@@ -19,6 +20,7 @@ class Budget < ActiveRecord::Base
|
|||||||
before_validation :sanitize_descriptions
|
before_validation :sanitize_descriptions
|
||||||
|
|
||||||
scope :on_hold, -> { where(phase: %w(reviewing valuating reviewing_ballots")) }
|
scope :on_hold, -> { where(phase: %w(reviewing valuating reviewing_ballots")) }
|
||||||
|
scope :drafting, -> { where(phase: "drafting") }
|
||||||
scope :accepting, -> { where(phase: "accepting") }
|
scope :accepting, -> { where(phase: "accepting") }
|
||||||
scope :reviewing, -> { where(phase: "reviewing") }
|
scope :reviewing, -> { where(phase: "reviewing") }
|
||||||
scope :selecting, -> { where(phase: "selecting") }
|
scope :selecting, -> { where(phase: "selecting") }
|
||||||
@@ -41,6 +43,10 @@ class Budget < ActiveRecord::Base
|
|||||||
80
|
80
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def drafting?
|
||||||
|
phase == "drafting"
|
||||||
|
end
|
||||||
|
|
||||||
def accepting?
|
def accepting?
|
||||||
phase == "accepting"
|
phase == "accepting"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,14 +16,16 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @budgets.each do |budget| %>
|
<% @budgets.each do |budget| %>
|
||||||
<tr>
|
<% if budget_published?(budget) %>
|
||||||
<td>
|
<tr>
|
||||||
<%= link_to budget.name, budget %>
|
<td>
|
||||||
</td>
|
<%= link_to budget.name, budget %>
|
||||||
<td>
|
</td>
|
||||||
<%= budget.translated_phase %>
|
<td>
|
||||||
</td>
|
<%= budget.translated_phase %>
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
<% provide :social_media_meta_tags do %>
|
||||||
|
<%= render "shared/social_media_meta_tags",
|
||||||
|
social_url: budget_investments_path(investment),
|
||||||
|
social_title: investment.title,
|
||||||
|
social_description: investment.description,
|
||||||
|
twitter_image_url: (investment.image.present? ? investment.image_url(:thumb) : nil),
|
||||||
|
og_image_url: (investment.image.present? ? investment.image_url(:thumb) : nil) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<section class="budget-investment-show" id="<%= dom_id(investment) %>">
|
<section class="budget-investment-show" id="<%= dom_id(investment) %>">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
<%= render "shared/social_media_meta_tags",
|
<%= render "shared/social_media_meta_tags",
|
||||||
social_url: proposal_url(@proposal),
|
social_url: proposal_url(@proposal),
|
||||||
social_title: @proposal.title,
|
social_title: @proposal.title,
|
||||||
social_description: @proposal.summary %>
|
social_description: @proposal.summary,
|
||||||
|
twitter_image_url: (@proposal.image.present? ? @proposal.image_url(:thumb) : nil),
|
||||||
|
og_image_url: (@proposal.image.present? ? @proposal.image_url(:thumb) : nil) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% content_for :canonical do %>
|
<% content_for :canonical do %>
|
||||||
<%= render "shared/canonical", href: proposal_url(@proposal) %>
|
<%= render "shared/canonical", href: proposal_url(@proposal) %>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ en:
|
|||||||
unselected_title: Investments not selected for balloting phase
|
unselected_title: Investments not selected for balloting phase
|
||||||
unselected: See investments not selected for balloting phase
|
unselected: See investments not selected for balloting phase
|
||||||
phase:
|
phase:
|
||||||
|
drafting: Draft (Not visible to the public)
|
||||||
accepting: Accepting projects
|
accepting: Accepting projects
|
||||||
reviewing: Reviewing projects
|
reviewing: Reviewing projects
|
||||||
selecting: Selecting projects
|
selecting: Selecting projects
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ es:
|
|||||||
unselected_title: Propuestas no seleccionadas para la votación final
|
unselected_title: Propuestas no seleccionadas para la votación final
|
||||||
unselected: Ver las propuestas no seleccionadas para la votación final
|
unselected: Ver las propuestas no seleccionadas para la votación final
|
||||||
phase:
|
phase:
|
||||||
|
drafting: Borrador (No visible para el público)
|
||||||
accepting: Presentación de proyectos
|
accepting: Presentación de proyectos
|
||||||
reviewing: Revisión interna de proyectos
|
reviewing: Revisión interna de proyectos
|
||||||
selecting: Fase de apoyos
|
selecting: Fase de apoyos
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddDraftingPhaseToBudget < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :budgets, :description_drafting, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20171220010000) do
|
ActiveRecord::Schema.define(version: 20180108182839) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -201,6 +201,7 @@ ActiveRecord::Schema.define(version: 20171220010000) do
|
|||||||
t.text "description_reviewing_ballots"
|
t.text "description_reviewing_ballots"
|
||||||
t.text "description_finished"
|
t.text "description_finished"
|
||||||
t.string "slug"
|
t.string "slug"
|
||||||
|
t.text "description_drafting"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "campaigns", force: :cascade do |t|
|
create_table "campaigns", force: :cascade do |t|
|
||||||
|
|||||||
@@ -8,21 +8,33 @@ describe 'Customization Engine' do
|
|||||||
let(:test_key) { I18n.t('account.show.change_credentials_link') }
|
let(:test_key) { I18n.t('account.show.change_credentials_link') }
|
||||||
let!(:default_path) { I18n.load_path }
|
let!(:default_path) { I18n.load_path }
|
||||||
|
|
||||||
|
before do
|
||||||
|
reset_load_path_and_reload(default_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
reset_load_path_and_reload(default_path)
|
||||||
|
end
|
||||||
|
|
||||||
it "loads custom and override original locales" do
|
it "loads custom and override original locales" do
|
||||||
I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', 'custom', '*.{rb,yml}')]
|
increase_load_path_and_reload(Dir[Rails.root.join('spec', 'support',
|
||||||
I18n.reload!
|
'locales', 'custom', '*.{rb,yml}')])
|
||||||
expect(test_key).to eq 'Overriden string with custom locales'
|
expect(test_key).to eq 'Overriden string with custom locales'
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not override original locales" do
|
it "does not override original locales" do
|
||||||
I18n.load_path.delete_if {|item| item =~ /spec\/support\/locales\/custom/ }
|
increase_load_path_and_reload(Dir[Rails.root.join('spec', 'support',
|
||||||
I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', '**', '*.{rb,yml}')]
|
'locales', '**', '*.{rb,yml}')])
|
||||||
I18n.reload!
|
|
||||||
expect(test_key).to eq 'Not overriden string with custom locales'
|
expect(test_key).to eq 'Not overriden string with custom locales'
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
def reset_load_path_and_reload(path)
|
||||||
I18n.load_path = default_path
|
I18n.load_path = path
|
||||||
|
I18n.reload!
|
||||||
|
end
|
||||||
|
|
||||||
|
def increase_load_path_and_reload(path)
|
||||||
|
I18n.load_path += path
|
||||||
I18n.reload!
|
I18n.reload!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ FactoryBot.define do
|
|||||||
sequence(:name) { |n| "Budget #{n}" }
|
sequence(:name) { |n| "Budget #{n}" }
|
||||||
currency_symbol "€"
|
currency_symbol "€"
|
||||||
phase 'accepting'
|
phase 'accepting'
|
||||||
|
description_drafting "This budget is drafting"
|
||||||
description_accepting "This budget is accepting"
|
description_accepting "This budget is accepting"
|
||||||
description_reviewing "This budget is reviewing"
|
description_reviewing "This budget is reviewing"
|
||||||
description_selecting "This budget is selecting"
|
description_selecting "This budget is selecting"
|
||||||
@@ -231,6 +232,10 @@ FactoryBot.define do
|
|||||||
description_reviewing_ballots "This budget is reviewing ballots"
|
description_reviewing_ballots "This budget is reviewing ballots"
|
||||||
description_finished "This budget is finished"
|
description_finished "This budget is finished"
|
||||||
|
|
||||||
|
trait :drafting do
|
||||||
|
phase 'drafting'
|
||||||
|
end
|
||||||
|
|
||||||
trait :accepting do
|
trait :accepting do
|
||||||
phase 'accepting'
|
phase 'accepting'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,32 +34,32 @@ feature 'Admin budgets' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Filters by phase' do
|
scenario 'Filters by phase' do
|
||||||
budget1 = create(:budget)
|
drafting_budget = create(:budget, :drafting)
|
||||||
budget2 = create(:budget, :accepting)
|
accepting_budget = create(:budget, :accepting)
|
||||||
budget3 = create(:budget, :selecting)
|
selecting_budget = create(:budget, :selecting)
|
||||||
budget4 = create(:budget, :balloting)
|
balloting_budget = create(:budget, :balloting)
|
||||||
budget5 = create(:budget, :finished)
|
finished_budget = create(:budget, :finished)
|
||||||
|
|
||||||
visit admin_budgets_path
|
visit admin_budgets_path
|
||||||
expect(page).to have_content(budget1.name)
|
expect(page).to have_content(drafting_budget.name)
|
||||||
expect(page).to have_content(budget2.name)
|
expect(page).to have_content(accepting_budget.name)
|
||||||
expect(page).to have_content(budget3.name)
|
expect(page).to have_content(selecting_budget.name)
|
||||||
expect(page).to have_content(budget4.name)
|
expect(page).to have_content(balloting_budget.name)
|
||||||
expect(page).not_to have_content(budget5.name)
|
expect(page).not_to have_content(finished_budget.name)
|
||||||
|
|
||||||
click_link 'Finished'
|
click_link 'Finished'
|
||||||
expect(page).not_to have_content(budget1.name)
|
expect(page).not_to have_content(drafting_budget.name)
|
||||||
expect(page).not_to have_content(budget2.name)
|
expect(page).not_to have_content(accepting_budget.name)
|
||||||
expect(page).not_to have_content(budget3.name)
|
expect(page).not_to have_content(selecting_budget.name)
|
||||||
expect(page).not_to have_content(budget4.name)
|
expect(page).not_to have_content(balloting_budget.name)
|
||||||
expect(page).to have_content(budget5.name)
|
expect(page).to have_content(finished_budget.name)
|
||||||
|
|
||||||
click_link 'Open'
|
click_link 'Open'
|
||||||
expect(page).to have_content(budget1.name)
|
expect(page).to have_content(drafting_budget.name)
|
||||||
expect(page).to have_content(budget2.name)
|
expect(page).to have_content(accepting_budget.name)
|
||||||
expect(page).to have_content(budget3.name)
|
expect(page).to have_content(selecting_budget.name)
|
||||||
expect(page).to have_content(budget4.name)
|
expect(page).to have_content(balloting_budget.name)
|
||||||
expect(page).not_to have_content(budget5.name)
|
expect(page).not_to have_content(finished_budget.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Open filter is properly highlighted' do
|
scenario 'Open filter is properly highlighted' do
|
||||||
@@ -133,6 +133,24 @@ feature 'Admin budgets' do
|
|||||||
expect(page).to have_content('You cannot destroy a Budget that has associated investments')
|
expect(page).to have_content('You cannot destroy a Budget that has associated investments')
|
||||||
expect(page).to have_content('There is 1 participatory budget')
|
expect(page).to have_content('There is 1 participatory budget')
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'Update' do
|
||||||
|
|
||||||
|
background do
|
||||||
|
create(:budget)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'Update budget' do
|
||||||
|
visit admin_budgets_path
|
||||||
|
click_link 'Edit budget'
|
||||||
|
|
||||||
|
fill_in 'budget_name', with: 'More trees on the streets'
|
||||||
|
click_button 'Update Participatory budget'
|
||||||
|
|
||||||
|
expect(page).to have_content('More trees on the streets')
|
||||||
|
expect(page).to have_current_path(admin_budgets_path)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ require 'rails_helper'
|
|||||||
|
|
||||||
feature 'Budgets' do
|
feature 'Budgets' do
|
||||||
|
|
||||||
|
let(:budget) { create(:budget) }
|
||||||
|
let(:level_two_user) { create(:user, :level_two) }
|
||||||
|
|
||||||
scenario 'Index' do
|
scenario 'Index' do
|
||||||
budgets = create_list(:budget, 3)
|
budgets = create_list(:budget, 3)
|
||||||
visit budgets_path
|
visit budgets_path
|
||||||
@@ -11,7 +14,6 @@ feature 'Budgets' do
|
|||||||
context 'Show' do
|
context 'Show' do
|
||||||
|
|
||||||
scenario "List all groups" do
|
scenario "List all groups" do
|
||||||
budget = create(:budget)
|
|
||||||
group1 = create(:budget_group, budget: budget)
|
group1 = create(:budget_group, budget: budget)
|
||||||
group2 = create(:budget_group, budget: budget)
|
group2 = create(:budget_group, budget: budget)
|
||||||
|
|
||||||
@@ -61,9 +63,59 @@ feature 'Budgets' do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Accepting' do
|
context "In Drafting phase" do
|
||||||
|
|
||||||
let(:budget) { create(:budget) }
|
let(:admin) { create(:administrator).user }
|
||||||
|
|
||||||
|
background do
|
||||||
|
logout
|
||||||
|
budget.update(phase: 'drafting')
|
||||||
|
end
|
||||||
|
|
||||||
|
context "Listed" do
|
||||||
|
scenario "Not listed to guest users at the public budgets list" do
|
||||||
|
visit budgets_path
|
||||||
|
|
||||||
|
expect(page).not_to have_content(budget.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Not listed to logged users at the public budgets list" do
|
||||||
|
login_as(level_two_user)
|
||||||
|
visit budgets_path
|
||||||
|
|
||||||
|
expect(page).not_to have_content(budget.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Is listed to admins at the public budgets list" do
|
||||||
|
login_as(admin)
|
||||||
|
visit budgets_path
|
||||||
|
|
||||||
|
expect(page).to have_content(budget.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "Shown" do
|
||||||
|
scenario "Not accesible to guest users" do
|
||||||
|
expect { visit budget_path(budget) }.to raise_error(ActionController::RoutingError)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Not accesible to logged users" do
|
||||||
|
login_as(level_two_user)
|
||||||
|
|
||||||
|
expect { visit budget_path(budget) }.to raise_error(ActionController::RoutingError)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Is accesible to admin users" do
|
||||||
|
login_as(admin)
|
||||||
|
visit budget_path(budget)
|
||||||
|
|
||||||
|
expect(page.status_code).to eq(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'Accepting' do
|
||||||
|
|
||||||
background do
|
background do
|
||||||
budget.update(phase: 'accepting')
|
budget.update(phase: 'accepting')
|
||||||
@@ -72,8 +124,7 @@ feature 'Budgets' do
|
|||||||
context "Permissions" do
|
context "Permissions" do
|
||||||
|
|
||||||
scenario "Verified user" do
|
scenario "Verified user" do
|
||||||
user = create(:user, :level_two)
|
login_as(level_two_user)
|
||||||
login_as(user)
|
|
||||||
|
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ feature 'Results' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "If budget is in a phase different from finished results can't be accessed" do
|
scenario "If budget is in a phase different from finished results can't be accessed" do
|
||||||
budget.update phase: (Budget::PHASES - ["finished"]).sample
|
budget.update(phase: (Budget::PHASES - ['drafting', 'finished']).sample)
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
expect(page).not_to have_link "See results"
|
expect(page).not_to have_link "See results"
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ feature 'Tags' do
|
|||||||
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
|
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
|
||||||
let!(:tag_medio_ambiente) { create(:tag, :category, name: 'Medio Ambiente') }
|
let!(:tag_medio_ambiente) { create(:tag, :category, name: 'Medio Ambiente') }
|
||||||
let!(:tag_economia) { create(:tag, :category, name: 'Economía') }
|
let!(:tag_economia) { create(:tag, :category, name: 'Economía') }
|
||||||
|
let(:admin) { create(:administrator).user }
|
||||||
|
|
||||||
scenario 'Index' do
|
scenario 'Index' do
|
||||||
earth = create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name)
|
earth = create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name)
|
||||||
@@ -185,6 +186,7 @@ feature 'Tags' do
|
|||||||
Budget::PHASES.each do |phase|
|
Budget::PHASES.each do |phase|
|
||||||
budget.update(phase: phase)
|
budget.update(phase: phase)
|
||||||
|
|
||||||
|
login_as(admin) if budget.drafting?
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within "#tag-cloud" do
|
within "#tag-cloud" do
|
||||||
@@ -204,6 +206,7 @@ feature 'Tags' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
login_as(admin) if budget.drafting?
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
click_link group.name
|
click_link group.name
|
||||||
|
|
||||||
@@ -230,6 +233,7 @@ feature 'Tags' do
|
|||||||
Budget::PHASES.each do |phase|
|
Budget::PHASES.each do |phase|
|
||||||
budget.update(phase: phase)
|
budget.update(phase: phase)
|
||||||
|
|
||||||
|
login_as(admin) if budget.drafting?
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within "#categories" do
|
within "#categories" do
|
||||||
@@ -249,6 +253,7 @@ feature 'Tags' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
login_as(admin) if budget.drafting?
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
click_link group.name
|
click_link group.name
|
||||||
|
|
||||||
@@ -282,8 +287,7 @@ feature 'Tags' do
|
|||||||
investment.set_tag_list_on(:valuation, 'Education')
|
investment.set_tag_list_on(:valuation, 'Education')
|
||||||
investment.save
|
investment.save
|
||||||
|
|
||||||
admin = create(:administrator)
|
login_as(admin)
|
||||||
login_as(admin.user)
|
|
||||||
|
|
||||||
visit admin_budget_budget_investment_path(budget, investment)
|
visit admin_budget_budget_investment_path(budget, investment)
|
||||||
click_link 'Edit classification'
|
click_link 'Edit classification'
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ describe Budget do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "produces auxiliary methods" do
|
it "produces auxiliary methods" do
|
||||||
|
budget.phase = "drafting"
|
||||||
|
expect(budget).to be_drafting
|
||||||
|
|
||||||
budget.phase = "accepting"
|
budget.phase = "accepting"
|
||||||
expect(budget).to be_accepting
|
expect(budget).to be_accepting
|
||||||
|
|
||||||
@@ -63,6 +66,9 @@ describe Budget do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "on_hold?" do
|
it "on_hold?" do
|
||||||
|
budget.phase = "drafting"
|
||||||
|
expect(budget).not_to be_on_hold
|
||||||
|
|
||||||
budget.phase = "accepting"
|
budget.phase = "accepting"
|
||||||
expect(budget).not_to be_on_hold
|
expect(budget).not_to be_on_hold
|
||||||
|
|
||||||
@@ -86,6 +92,9 @@ describe Budget do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "balloting_or_later?" do
|
it "balloting_or_later?" do
|
||||||
|
budget.phase = "drafting"
|
||||||
|
expect(budget).not_to be_balloting_or_later
|
||||||
|
|
||||||
budget.phase = "accepting"
|
budget.phase = "accepting"
|
||||||
expect(budget).not_to be_balloting_or_later
|
expect(budget).not_to be_balloting_or_later
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user