Merge branch 'master' into content_blocks_for_headings
This commit is contained in:
@@ -53,7 +53,7 @@ feature 'Admin activity' do
|
||||
scenario "Shows admin restores" do
|
||||
proposal = create(:proposal, :hidden)
|
||||
|
||||
visit admin_proposals_path
|
||||
visit admin_hidden_proposals_path
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
click_on "Restore"
|
||||
|
||||
@@ -5,22 +5,22 @@ feature 'Admin budget investment milestones' do
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
@investment = create(:budget_investment)
|
||||
end
|
||||
|
||||
let!(:investment) { create(:budget_investment) }
|
||||
|
||||
it_behaves_like "translatable",
|
||||
"budget_investment_milestone",
|
||||
"edit_admin_budget_budget_investment_budget_investment_milestone_path",
|
||||
"milestone",
|
||||
"edit_admin_budget_budget_investment_milestone_path",
|
||||
%w[description]
|
||||
|
||||
context "Index" do
|
||||
scenario 'Displaying milestones' do
|
||||
milestone = create(:budget_investment_milestone, investment: @investment)
|
||||
milestone = create(:milestone, milestoneable: investment)
|
||||
create(:image, imageable: milestone)
|
||||
document = create(:document, documentable: milestone)
|
||||
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
expect(page).to have_content("Milestone")
|
||||
expect(page).to have_content(milestone.title)
|
||||
@@ -32,7 +32,7 @@ feature 'Admin budget investment milestones' do
|
||||
end
|
||||
|
||||
scenario 'Displaying no_milestones text' do
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
expect(page).to have_content("Milestone")
|
||||
expect(page).to have_content("Don't have defined milestones")
|
||||
@@ -41,14 +41,14 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
context "New" do
|
||||
scenario "Add milestone" do
|
||||
status = create(:budget_investment_status)
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
status = create(:milestone_status)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link 'Create new milestone'
|
||||
|
||||
select status.name, from: 'budget_investment_milestone_status_id'
|
||||
select status.name, from: 'milestone_status_id'
|
||||
fill_in 'Description', with: 'New description milestone'
|
||||
fill_in 'budget_investment_milestone_publication_date', with: Date.current
|
||||
fill_in 'milestone_publication_date', with: Date.current
|
||||
|
||||
click_button 'Create milestone'
|
||||
|
||||
@@ -58,14 +58,14 @@ feature 'Admin budget investment milestones' do
|
||||
end
|
||||
|
||||
scenario "Status select is disabled if there are no statuses available" do
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link 'Create new milestone'
|
||||
expect(find("#budget_investment_milestone_status_id").disabled?).to be true
|
||||
expect(find("#milestone_status_id").disabled?).to be true
|
||||
end
|
||||
|
||||
scenario "Show validation errors on milestone form" do
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link 'Create new milestone'
|
||||
|
||||
@@ -73,7 +73,7 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
click_button 'Create milestone'
|
||||
|
||||
within "#new_budget_investment_milestone" do
|
||||
within "#new_milestone" do
|
||||
expect(page).to have_content "can't be blank", count: 1
|
||||
expect(page).to have_content 'New description milestone'
|
||||
end
|
||||
@@ -82,11 +82,11 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
context "Edit" do
|
||||
scenario "Change title, description and document names" do
|
||||
milestone = create(:budget_investment_milestone, investment: @investment)
|
||||
milestone = create(:milestone, milestoneable: investment)
|
||||
create(:image, imageable: milestone)
|
||||
document = create(:document, documentable: milestone)
|
||||
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
expect(page).to have_link document.title
|
||||
|
||||
click_link milestone.title
|
||||
@@ -94,8 +94,8 @@ feature 'Admin budget investment milestones' do
|
||||
expect(page).to have_css("img[alt='#{milestone.image.title}']")
|
||||
|
||||
fill_in 'Description', with: 'Changed description'
|
||||
fill_in 'budget_investment_milestone_publication_date', with: Date.current
|
||||
fill_in 'budget_investment_milestone_documents_attributes_0_title', with: 'New document title'
|
||||
fill_in 'milestone_publication_date', with: Date.current
|
||||
fill_in 'milestone_documents_attributes_0_title', with: 'New document title'
|
||||
|
||||
click_button 'Update milestone'
|
||||
|
||||
@@ -108,9 +108,9 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
context "Delete" do
|
||||
scenario "Remove milestone" do
|
||||
milestone = create(:budget_investment_milestone, investment: @investment, title: "Title will it remove")
|
||||
milestone = create(:milestone, milestoneable: investment, title: "Title will it remove")
|
||||
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link "Delete milestone"
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Admin budget investment statuses' do
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
scenario 'Displaying only not hidden statuses' do
|
||||
status1 = create(:budget_investment_status)
|
||||
status2 = create(:budget_investment_status)
|
||||
|
||||
status1.destroy
|
||||
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
expect(page).not_to have_content status1.name
|
||||
expect(page).not_to have_content status1.description
|
||||
|
||||
expect(page).to have_content status2.name
|
||||
expect(page).to have_content status2.description
|
||||
end
|
||||
|
||||
scenario 'Displaying no statuses text' do
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
expect(page).to have_content("There are no investment statuses created")
|
||||
end
|
||||
end
|
||||
|
||||
context "New" do
|
||||
scenario "Create status" do
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
click_link 'Create new investment status'
|
||||
|
||||
fill_in 'budget_investment_status_name', with: 'New status name'
|
||||
fill_in 'budget_investment_status_description', with: 'This status description'
|
||||
click_button 'Create Investment status'
|
||||
|
||||
expect(page).to have_content 'New status name'
|
||||
expect(page).to have_content 'This status description'
|
||||
end
|
||||
|
||||
scenario "Show validation errors in status form" do
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
click_link 'Create new investment status'
|
||||
|
||||
fill_in 'budget_investment_status_description', with: 'This status description'
|
||||
click_button 'Create Investment status'
|
||||
|
||||
within "#new_budget_investment_status" do
|
||||
expect(page).to have_content "can't be blank", count: 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
scenario "Change name and description" do
|
||||
status = create(:budget_investment_status)
|
||||
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
within("#budget_investment_status_#{status.id}") do
|
||||
click_link "Edit"
|
||||
end
|
||||
|
||||
fill_in 'budget_investment_status_name', with: 'Other status name'
|
||||
fill_in 'budget_investment_status_description', with: 'Other status description'
|
||||
click_button 'Update Investment status'
|
||||
|
||||
expect(page).to have_content 'Other status name'
|
||||
expect(page).to have_content 'Other status description'
|
||||
end
|
||||
end
|
||||
|
||||
context "Delete" do
|
||||
scenario "Hides status" do
|
||||
status = create(:budget_investment_status)
|
||||
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
within("#budget_investment_status_#{status.id}") do
|
||||
click_link "Delete"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content status.name
|
||||
expect(page).not_to have_content status.description
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -802,7 +802,28 @@ feature 'Admin budget investments' do
|
||||
end
|
||||
end
|
||||
|
||||
pending "Do not display valuators of an assigned group"
|
||||
scenario "Do not display valuators of an assigned group" do
|
||||
budget_investment = create(:budget_investment)
|
||||
|
||||
health_group = create(:valuator_group, name: "Health")
|
||||
user = create(:user, username: 'Valentina', email: 'v1@valuators.org')
|
||||
create(:valuator, user: user, valuator_group: health_group)
|
||||
|
||||
visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment)
|
||||
click_link 'Edit classification'
|
||||
|
||||
check "budget_investment_valuator_group_ids_#{health_group.id}"
|
||||
|
||||
click_button 'Update'
|
||||
|
||||
expect(page).to have_content 'Investment project updated succesfully.'
|
||||
|
||||
within('#assigned_valuator_groups') { expect(page).to have_content('Health') }
|
||||
within('#assigned_valuators') do
|
||||
expect(page).to have_content('Undefined')
|
||||
expect(page).not_to have_content('Valentina (v1@valuators.org)')
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Adds existing valuation tags", :js do
|
||||
budget_investment1 = create(:budget_investment)
|
||||
|
||||
@@ -276,6 +276,8 @@ feature 'Admin budgets' do
|
||||
fill_in 'budget_heading_name', with: 'District 9 reconstruction'
|
||||
fill_in 'budget_heading_price', with: '6785'
|
||||
fill_in 'budget_heading_population', with: '100500'
|
||||
fill_in 'budget_heading_latitude', with: '40.416775'
|
||||
fill_in 'budget_heading_longitude', with: '-3.703790'
|
||||
click_button 'Save heading'
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Admin proposals' do
|
||||
feature 'Admin hidden proposals' do
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
@@ -12,14 +12,14 @@ feature 'Admin proposals' do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
expect{ visit admin_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
expect{ visit admin_hidden_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting['feature.proposals'] = true
|
||||
end
|
||||
|
||||
scenario 'List shows all relevant info' do
|
||||
proposal = create(:proposal, :hidden)
|
||||
visit admin_proposals_path
|
||||
visit admin_hidden_proposals_path
|
||||
|
||||
expect(page).to have_content(proposal.title)
|
||||
expect(page).to have_content(proposal.summary)
|
||||
@@ -31,7 +31,7 @@ feature 'Admin proposals' do
|
||||
|
||||
scenario 'Restore' do
|
||||
proposal = create(:proposal, :hidden)
|
||||
visit admin_proposals_path
|
||||
visit admin_hidden_proposals_path
|
||||
|
||||
click_link 'Restore'
|
||||
|
||||
@@ -43,7 +43,7 @@ feature 'Admin proposals' do
|
||||
|
||||
scenario 'Confirm hide' do
|
||||
proposal = create(:proposal, :hidden)
|
||||
visit admin_proposals_path
|
||||
visit admin_hidden_proposals_path
|
||||
|
||||
click_link 'Confirm moderation'
|
||||
|
||||
@@ -55,22 +55,22 @@ feature 'Admin proposals' do
|
||||
end
|
||||
|
||||
scenario "Current filter is properly highlighted" do
|
||||
visit admin_proposals_path
|
||||
visit admin_hidden_proposals_path
|
||||
expect(page).not_to have_link('Pending')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Confirmed')
|
||||
|
||||
visit admin_proposals_path(filter: 'Pending')
|
||||
visit admin_hidden_proposals_path(filter: 'Pending')
|
||||
expect(page).not_to have_link('Pending')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Confirmed')
|
||||
|
||||
visit admin_proposals_path(filter: 'all')
|
||||
visit admin_hidden_proposals_path(filter: 'all')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).not_to have_link('All')
|
||||
expect(page).to have_link('Confirmed')
|
||||
|
||||
visit admin_proposals_path(filter: 'with_confirmed_hide')
|
||||
visit admin_hidden_proposals_path(filter: 'with_confirmed_hide')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).not_to have_link('Confirmed')
|
||||
@@ -80,15 +80,15 @@ feature 'Admin proposals' do
|
||||
create(:proposal, :hidden, title: "Unconfirmed proposal")
|
||||
create(:proposal, :hidden, :with_confirmed_hide, title: "Confirmed proposal")
|
||||
|
||||
visit admin_proposals_path(filter: 'pending')
|
||||
visit admin_hidden_proposals_path(filter: 'pending')
|
||||
expect(page).to have_content('Unconfirmed proposal')
|
||||
expect(page).not_to have_content('Confirmed proposal')
|
||||
|
||||
visit admin_proposals_path(filter: 'all')
|
||||
visit admin_hidden_proposals_path(filter: 'all')
|
||||
expect(page).to have_content('Unconfirmed proposal')
|
||||
expect(page).to have_content('Confirmed proposal')
|
||||
|
||||
visit admin_proposals_path(filter: 'with_confirmed_hide')
|
||||
visit admin_hidden_proposals_path(filter: 'with_confirmed_hide')
|
||||
expect(page).not_to have_content('Unconfirmed proposal')
|
||||
expect(page).to have_content('Confirmed proposal')
|
||||
end
|
||||
@@ -97,7 +97,7 @@ feature 'Admin proposals' do
|
||||
per_page = Kaminari.config.default_per_page
|
||||
(per_page + 2).times { create(:proposal, :hidden, :with_confirmed_hide) }
|
||||
|
||||
visit admin_proposals_path(filter: 'with_confirmed_hide', page: 2)
|
||||
visit admin_hidden_proposals_path(filter: 'with_confirmed_hide', page: 2)
|
||||
|
||||
click_on('Restore', match: :first, exact: true)
|
||||
|
||||
95
spec/features/admin/milestone_statuses_spec.rb
Normal file
95
spec/features/admin/milestone_statuses_spec.rb
Normal file
@@ -0,0 +1,95 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Admin milestone statuses' do
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
scenario 'Displaying only not hidden statuses' do
|
||||
status1 = create(:milestone_status)
|
||||
status2 = create(:milestone_status)
|
||||
|
||||
status1.destroy
|
||||
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
expect(page).not_to have_content status1.name
|
||||
expect(page).not_to have_content status1.description
|
||||
|
||||
expect(page).to have_content status2.name
|
||||
expect(page).to have_content status2.description
|
||||
end
|
||||
|
||||
scenario 'Displaying no statuses text' do
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
expect(page).to have_content("There are no milestone statuses created")
|
||||
end
|
||||
end
|
||||
|
||||
context "New" do
|
||||
scenario "Create status" do
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
click_link 'Create new milestone status'
|
||||
|
||||
fill_in 'milestone_status_name', with: 'New status name'
|
||||
fill_in 'milestone_status_description', with: 'This status description'
|
||||
click_button 'Create Milestone Status'
|
||||
|
||||
expect(page).to have_content 'New status name'
|
||||
expect(page).to have_content 'This status description'
|
||||
end
|
||||
|
||||
scenario "Show validation errors in status form" do
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
click_link 'Create new milestone status'
|
||||
|
||||
fill_in 'milestone_status_description', with: 'This status description'
|
||||
click_button 'Create Milestone Status'
|
||||
|
||||
within "#new_milestone_status" do
|
||||
expect(page).to have_content "can't be blank", count: 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
scenario "Change name and description" do
|
||||
status = create(:milestone_status)
|
||||
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
within("#milestone_status_#{status.id}") do
|
||||
click_link "Edit"
|
||||
end
|
||||
|
||||
fill_in 'milestone_status_name', with: 'Other status name'
|
||||
fill_in 'milestone_status_description', with: 'Other status description'
|
||||
click_button 'Update Milestone Status'
|
||||
|
||||
expect(page).to have_content 'Other status name'
|
||||
expect(page).to have_content 'Other status description'
|
||||
end
|
||||
end
|
||||
|
||||
context "Delete" do
|
||||
scenario "Hides status" do
|
||||
status = create(:milestone_status)
|
||||
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
within("#milestone_status_#{status.id}") do
|
||||
click_link "Delete"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content status.name
|
||||
expect(page).not_to have_content status.description
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -72,7 +72,16 @@ feature 'Admin poll questions' do
|
||||
expect(page).to have_link(proposal.author.name, href: user_path(proposal.author))
|
||||
end
|
||||
|
||||
pending "Create from successul proposal show"
|
||||
scenario "Create from successful proposal show" do
|
||||
poll = create(:poll, name: 'Proposals')
|
||||
proposal = create(:proposal, :successful)
|
||||
|
||||
visit proposal_path(proposal)
|
||||
click_link "Create question"
|
||||
|
||||
expect(page).to have_current_path(new_admin_question_path, ignore_query: true)
|
||||
expect(page).to have_field('Question', with: proposal.title)
|
||||
end
|
||||
|
||||
scenario 'Update' do
|
||||
question1 = create(:poll_question)
|
||||
|
||||
@@ -12,7 +12,7 @@ feature 'Executions' do
|
||||
let!(:investment3) { create(:budget_investment, :incompatible, heading: heading) }
|
||||
|
||||
scenario 'only displays investments with milestones' do
|
||||
create(:budget_investment_milestone, investment: investment1)
|
||||
create(:milestone, milestoneable: investment1)
|
||||
|
||||
visit budget_path(budget)
|
||||
click_link 'See results'
|
||||
@@ -28,7 +28,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario "Do not display headings with no winning investments for selected status" do
|
||||
create(:budget_investment_milestone, investment: investment1)
|
||||
create(:milestone, milestoneable: investment1)
|
||||
|
||||
empty_group = create(:budget_group, budget: budget)
|
||||
empty_heading = create(:budget_heading, group: empty_group, price: 1000)
|
||||
@@ -46,7 +46,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario "Show message when there are no winning investments with the selected status", :js do
|
||||
create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.executed'))
|
||||
create(:milestone_status, name: I18n.t('seeds.budgets.statuses.executed'))
|
||||
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -63,7 +63,7 @@ feature 'Executions' do
|
||||
context 'Images' do
|
||||
|
||||
scenario 'renders milestone image if available' do
|
||||
milestone1 = create(:budget_investment_milestone, investment: investment1)
|
||||
milestone1 = create(:milestone, milestoneable: investment1)
|
||||
create(:image, imageable: milestone1)
|
||||
|
||||
visit budget_path(budget)
|
||||
@@ -76,7 +76,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'renders investment image if no milestone image is available' do
|
||||
create(:budget_investment_milestone, investment: investment2)
|
||||
create(:milestone, milestoneable: investment2)
|
||||
create(:image, imageable: investment2)
|
||||
|
||||
visit budget_path(budget)
|
||||
@@ -89,7 +89,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'renders default image if no milestone nor investment images are available' do
|
||||
create(:budget_investment_milestone, investment: investment4)
|
||||
create(:milestone, milestoneable: investment4)
|
||||
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -101,17 +101,17 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario "renders last milestone's image if investment has multiple milestones with images associated" do
|
||||
milestone1 = create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
milestone1 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
milestone2 = create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
milestone2 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
milestone3 = create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
milestone3 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
milestone4 = create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
milestone4 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
create(:image, imageable: milestone2, title: 'Image for first milestone with image')
|
||||
create(:image, imageable: milestone3, title: 'Image for second milestone with image')
|
||||
@@ -129,17 +129,17 @@ feature 'Executions' do
|
||||
|
||||
context 'Filters' do
|
||||
|
||||
let!(:status1) { create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.studying_project')) }
|
||||
let!(:status2) { create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.bidding')) }
|
||||
let!(:status1) { create(:milestone_status, name: "Studying the project") }
|
||||
let!(:status2) { create(:milestone_status, name: "Bidding") }
|
||||
|
||||
scenario 'Filters select with counter are shown' do
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status1)
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status1)
|
||||
|
||||
create(:budget_investment_milestone, investment: investment2,
|
||||
publication_date: Date.yesterday,
|
||||
status: status2)
|
||||
create(:milestone, milestoneable: investment2,
|
||||
publication_date: Date.yesterday,
|
||||
status: status2)
|
||||
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -152,9 +152,9 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'by milestone status', :js do
|
||||
create(:budget_investment_milestone, investment: investment1, status: status1)
|
||||
create(:budget_investment_milestone, investment: investment2, status: status2)
|
||||
create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.executing_project'))
|
||||
create(:milestone, milestoneable: investment1, status: status1)
|
||||
create(:milestone, milestoneable: investment2, status: status2)
|
||||
create(:milestone_status, name: I18n.t('seeds.budgets.statuses.executing_project'))
|
||||
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -181,13 +181,13 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'are based on latest milestone status', :js do
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: 1.month.ago,
|
||||
status: status1)
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: 1.month.ago,
|
||||
status: status1)
|
||||
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status2)
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status2)
|
||||
|
||||
visit budget_path(budget)
|
||||
click_link 'See results'
|
||||
@@ -201,13 +201,13 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'milestones with future dates are not shown', :js do
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status1)
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status1)
|
||||
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
publication_date: Date.tomorrow,
|
||||
status: status2)
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.tomorrow,
|
||||
status: status2)
|
||||
|
||||
visit budget_path(budget)
|
||||
click_link 'See results'
|
||||
@@ -226,7 +226,7 @@ feature 'Executions' do
|
||||
def create_heading_with_investment_with_milestone(group:, name:)
|
||||
heading = create(:budget_heading, group: group, name: name)
|
||||
investment = create(:budget_investment, :winner, heading: heading)
|
||||
milestone = create(:budget_investment_milestone, investment: investment)
|
||||
milestone = create(:milestone, milestoneable: investment)
|
||||
heading
|
||||
end
|
||||
|
||||
@@ -260,8 +260,8 @@ feature 'Executions' do
|
||||
context 'No milestones' do
|
||||
|
||||
scenario 'Milestone not yet published' do
|
||||
status = create(:budget_investment_status)
|
||||
unpublished_milestone = create(:budget_investment_milestone, investment: investment1,
|
||||
status = create(:milestone_status)
|
||||
unpublished_milestone = create(:milestone, milestoneable: investment1,
|
||||
status: status, publication_date: Date.tomorrow)
|
||||
|
||||
visit budget_executions_path(budget, status: status.id)
|
||||
|
||||
@@ -1121,13 +1121,13 @@ feature 'Budget Investments' do
|
||||
scenario "Show milestones", :js do
|
||||
user = create(:user)
|
||||
investment = create(:budget_investment)
|
||||
create(:budget_investment_milestone, investment: investment,
|
||||
description_en: "Last milestone with a link to https://consul.dev",
|
||||
description_es: "Último hito con el link https://consul.dev",
|
||||
publication_date: Date.tomorrow)
|
||||
first_milestone = create(:budget_investment_milestone, investment: investment,
|
||||
description: "First milestone",
|
||||
publication_date: Date.yesterday)
|
||||
create(:milestone, milestoneable: investment,
|
||||
description_en: "Last milestone with a link to https://consul.dev",
|
||||
description_es: "Último hito con el link https://consul.dev",
|
||||
publication_date: Date.tomorrow)
|
||||
first_milestone = create(:milestone, milestoneable: investment,
|
||||
description: "First milestone",
|
||||
publication_date: Date.yesterday)
|
||||
image = create(:image, imageable: first_milestone)
|
||||
document = create(:document, documentable: first_milestone)
|
||||
|
||||
@@ -1455,10 +1455,10 @@ feature 'Budget Investments' do
|
||||
user = create(:user, :level_two)
|
||||
|
||||
global_group = create(:budget_group, budget: budget, name: 'Global Group')
|
||||
global_heading = create(:budget_heading, group: global_group, name: 'Global Heading')
|
||||
global_heading = create(:budget_heading, group: global_group, name: 'Global Heading', latitude: -43.145412, longitude: 12.009423)
|
||||
|
||||
carabanchel_heading = create(:budget_heading, group: group, name: "Carabanchel")
|
||||
new_york_heading = create(:budget_heading, group: group, name: "New York")
|
||||
new_york_heading = create(:budget_heading, group: group, name: "New York", latitude: -43.223412, longitude: 12.009423)
|
||||
|
||||
sp1 = create(:budget_investment, :selected, price: 1, heading: global_heading)
|
||||
sp2 = create(:budget_investment, :selected, price: 10, heading: global_heading)
|
||||
@@ -1701,4 +1701,84 @@ feature 'Budget Investments' do
|
||||
expect(Flag.flagged?(user, investment)).not_to be
|
||||
end
|
||||
|
||||
context 'sidebar map' do
|
||||
scenario "Display 6 investment's markers on sidebar map", :js do
|
||||
investment1 = create(:budget_investment, heading: heading)
|
||||
investment2 = create(:budget_investment, heading: heading)
|
||||
investment3 = create(:budget_investment, heading: heading)
|
||||
investment4 = create(:budget_investment, heading: heading)
|
||||
investment5 = create(:budget_investment, heading: heading)
|
||||
investment6 = create(:budget_investment, heading: heading)
|
||||
|
||||
create(:map_location, longitude: 40.1231, latitude: -3.636, investment: investment1)
|
||||
create(:map_location, longitude: 40.1232, latitude: -3.635, investment: investment2)
|
||||
create(:map_location, longitude: 40.1233, latitude: -3.634, investment: investment3)
|
||||
create(:map_location, longitude: 40.1234, latitude: -3.633, investment: investment4)
|
||||
create(:map_location, longitude: 40.1235, latitude: -3.632, investment: investment5)
|
||||
create(:map_location, longitude: 40.1236, latitude: -3.631, investment: investment6)
|
||||
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
within ".map_location" do
|
||||
expect(page).to have_css(".map-icon", count: 6, visible: false)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Display 2 investment's markers on sidebar map", :js do
|
||||
investment1 = create(:budget_investment, heading: heading)
|
||||
investment2 = create(:budget_investment, heading: heading)
|
||||
|
||||
create(:map_location, longitude: 40.1281, latitude: -3.656, investment: investment1)
|
||||
create(:map_location, longitude: 40.1292, latitude: -3.665, investment: investment2)
|
||||
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
within ".map_location" do
|
||||
expect(page).to have_css(".map-icon", count: 2, visible: false)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Display only investment's related to the current heading", :js do
|
||||
heading_2 = create(:budget_heading, name: "Madrid", group: group)
|
||||
|
||||
investment1 = create(:budget_investment, heading: heading)
|
||||
investment2 = create(:budget_investment, heading: heading)
|
||||
investment3 = create(:budget_investment, heading: heading)
|
||||
investment4 = create(:budget_investment, heading: heading)
|
||||
investment5 = create(:budget_investment, heading: heading_2)
|
||||
investment6 = create(:budget_investment, heading: heading_2)
|
||||
|
||||
create(:map_location, longitude: 40.1231, latitude: -3.636, investment: investment1)
|
||||
create(:map_location, longitude: 40.1232, latitude: -3.685, investment: investment2)
|
||||
create(:map_location, longitude: 40.1233, latitude: -3.664, investment: investment3)
|
||||
create(:map_location, longitude: 40.1234, latitude: -3.673, investment: investment4)
|
||||
create(:map_location, longitude: 40.1235, latitude: -3.672, investment: investment5)
|
||||
create(:map_location, longitude: 40.1236, latitude: -3.621, investment: investment6)
|
||||
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
within ".map_location" do
|
||||
expect(page).to have_css(".map-icon", count: 4, visible: false)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Do not display investment's, since they're all related to other heading", :js do
|
||||
heading_2 = create(:budget_heading, name: "Madrid", group: group)
|
||||
|
||||
investment1 = create(:budget_investment, heading: heading_2)
|
||||
investment2 = create(:budget_investment, heading: heading_2)
|
||||
investment3 = create(:budget_investment, heading: heading_2)
|
||||
|
||||
create(:map_location, longitude: 40.1255, latitude: -3.644, investment: investment1)
|
||||
create(:map_location, longitude: 40.1258, latitude: -3.637, investment: investment2)
|
||||
create(:map_location, longitude: 40.1251, latitude: -3.649, investment: investment3)
|
||||
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
within ".map_location" do
|
||||
expect(page).to have_css(".map-icon", count: 0, visible: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -112,7 +112,7 @@ feature "Home" do
|
||||
end
|
||||
|
||||
feature 'IE alert' do
|
||||
scenario 'IE visitors are presented with an alert until they close it' do
|
||||
scenario 'IE visitors are presented with an alert until they close it', :page_driver do
|
||||
# Selenium API does not include page request/response inspection methods
|
||||
# so we must use Capybara::RackTest driver to set the browser's headers
|
||||
Capybara.current_session.driver.header(
|
||||
@@ -133,7 +133,7 @@ feature "Home" do
|
||||
expect(page.driver.request.cookies['ie_alert_closed']).to eq('true')
|
||||
end
|
||||
|
||||
scenario 'non-IE visitors are not bothered with IE alerts' do
|
||||
scenario 'non-IE visitors are not bothered with IE alerts', :page_driver do
|
||||
visit root_path
|
||||
expect(page).not_to have_xpath(ie_alert_box_xpath, visible: false)
|
||||
expect(page.driver.request.cookies['ie_alert_closed']).to be_nil
|
||||
@@ -143,4 +143,23 @@ feature "Home" do
|
||||
"/html/body/div[@class='wrapper ']/comment()[contains(.,'ie-callout')]"
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'if there are cards, the "featured" title will render' do
|
||||
card = create(:widget_card,
|
||||
title: "Card text",
|
||||
description: "Card description",
|
||||
link_text: "Link text",
|
||||
link_url: "consul.dev"
|
||||
)
|
||||
|
||||
visit root_path
|
||||
|
||||
expect(page).to have_css(".title", text: "Featured")
|
||||
end
|
||||
|
||||
scenario 'if there are no cards, the "featured" title will not render' do
|
||||
visit root_path
|
||||
|
||||
expect(page).not_to have_css(".title", text: "Featured")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -264,7 +264,7 @@ feature 'Legislation' do
|
||||
end
|
||||
|
||||
context 'proposals phase' do
|
||||
scenario 'not open' do
|
||||
scenario 'not open', :with_frozen_time do
|
||||
process = create(:legislation_process, :upcoming_proposals_phase)
|
||||
|
||||
visit legislation_process_proposals_path(process)
|
||||
|
||||
@@ -20,48 +20,65 @@ feature 'Legislation Proposals' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Each user as a different and consistent random proposals order', :js do
|
||||
create_list(:legislation_proposal, 10, process: process)
|
||||
feature "Random pagination" do
|
||||
before do
|
||||
allow(Legislation::Proposal).to receive(:default_per_page).and_return(12)
|
||||
|
||||
in_browser(:one) do
|
||||
create_list(
|
||||
:legislation_proposal,
|
||||
(Legislation::Proposal.default_per_page + 2),
|
||||
process: process
|
||||
)
|
||||
end
|
||||
|
||||
scenario "Each user has a different and consistent random proposals order", :js do
|
||||
in_browser(:one) do
|
||||
login_as user
|
||||
visit legislation_process_proposals_path(process)
|
||||
@first_user_proposals_order = legislation_proposals_order
|
||||
end
|
||||
|
||||
in_browser(:two) do
|
||||
login_as user2
|
||||
visit legislation_process_proposals_path(process)
|
||||
@second_user_proposals_order = legislation_proposals_order
|
||||
end
|
||||
|
||||
expect(@first_user_proposals_order).not_to eq(@second_user_proposals_order)
|
||||
|
||||
in_browser(:one) do
|
||||
visit legislation_process_proposals_path(process)
|
||||
expect(legislation_proposals_order).to eq(@first_user_proposals_order)
|
||||
end
|
||||
|
||||
in_browser(:two) do
|
||||
visit legislation_process_proposals_path(process)
|
||||
expect(legislation_proposals_order).to eq(@second_user_proposals_order)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Random order maintained with pagination", :js do
|
||||
login_as user
|
||||
visit legislation_process_proposals_path(process)
|
||||
@first_user_proposals_order = legislation_proposals_order
|
||||
first_page_proposals_order = legislation_proposals_order
|
||||
|
||||
click_link "Next"
|
||||
|
||||
expect(page).to have_content "You're on page 2"
|
||||
expect(first_page_proposals_order & legislation_proposals_order).to eq([])
|
||||
|
||||
click_link "Previous"
|
||||
|
||||
expect(page).to have_content "You're on page 1"
|
||||
expect(legislation_proposals_order).to eq(first_page_proposals_order)
|
||||
end
|
||||
|
||||
in_browser(:two) do
|
||||
login_as user2
|
||||
visit legislation_process_proposals_path(process)
|
||||
@second_user_proposals_order = legislation_proposals_order
|
||||
scenario "Does not crash when the seed is not a number" do
|
||||
login_as user
|
||||
visit legislation_process_proposals_path(process, random_seed: "Spoof")
|
||||
|
||||
expect(page).to have_content "You're on page 1"
|
||||
end
|
||||
|
||||
expect(@first_user_proposals_order).not_to eq(@second_user_proposals_order)
|
||||
|
||||
in_browser(:one) do
|
||||
visit legislation_process_proposals_path(process)
|
||||
expect(legislation_proposals_order).to eq(@first_user_proposals_order)
|
||||
end
|
||||
|
||||
in_browser(:two) do
|
||||
visit legislation_process_proposals_path(process)
|
||||
expect(legislation_proposals_order).to eq(@second_user_proposals_order)
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Random order maintained with pagination', :js do
|
||||
create_list(:legislation_proposal, (Kaminari.config.default_per_page + 2), process: process)
|
||||
|
||||
login_as user
|
||||
visit legislation_process_proposals_path(process)
|
||||
first_page_proposals_order = legislation_proposals_order
|
||||
|
||||
click_link 'Next'
|
||||
expect(page).to have_content "You're on page 2"
|
||||
|
||||
click_link 'Previous'
|
||||
expect(page).to have_content "You're on page 1"
|
||||
|
||||
expect(legislation_proposals_order).to eq(first_page_proposals_order)
|
||||
end
|
||||
|
||||
context 'Selected filter' do
|
||||
|
||||
@@ -179,12 +179,9 @@ feature 'Polls' do
|
||||
|
||||
visit poll_path(poll)
|
||||
|
||||
expect(page).to have_content('Han Solo')
|
||||
expect(page).to have_content('Chewbacca')
|
||||
expect(page).to have_content('You must Sign in or Sign up to participate')
|
||||
|
||||
expect(page).not_to have_link('Han Solo')
|
||||
expect(page).not_to have_link('Chewbacca')
|
||||
expect(page).to have_link('Han Solo', href: new_user_session_path)
|
||||
expect(page).to have_link('Chewbacca', href: new_user_session_path)
|
||||
end
|
||||
|
||||
scenario 'Level 1 users' do
|
||||
@@ -203,11 +200,8 @@ feature 'Polls' do
|
||||
|
||||
expect(page).to have_content('You must verify your account in order to answer')
|
||||
|
||||
expect(page).to have_content('Han Solo')
|
||||
expect(page).to have_content('Chewbacca')
|
||||
|
||||
expect(page).not_to have_link('Han Solo')
|
||||
expect(page).not_to have_link('Chewbacca')
|
||||
expect(page).to have_link('Han Solo', href: verification_path)
|
||||
expect(page).to have_link('Chewbacca', href: verification_path)
|
||||
end
|
||||
|
||||
scenario 'Level 2 users in an incoming poll' do
|
||||
|
||||
@@ -364,7 +364,48 @@ feature 'Proposal Notifications' do
|
||||
visit new_proposal_notification_path(proposal_id: proposal.id)
|
||||
end
|
||||
|
||||
pending "group notifications for the same proposal"
|
||||
context "Group notifications" do
|
||||
|
||||
background do
|
||||
Setting[:proposal_notification_minimum_interval_in_days] = 0
|
||||
end
|
||||
|
||||
after do
|
||||
Setting[:proposal_notification_minimum_interval_in_days] = 3
|
||||
end
|
||||
|
||||
scenario "for the same proposal", :js do
|
||||
author = create(:user)
|
||||
user = create(:user)
|
||||
|
||||
proposal = create(:proposal, author: author)
|
||||
|
||||
create(:follow, :followed_proposal, user: user, followable: proposal)
|
||||
|
||||
login_as author.reload
|
||||
|
||||
3.times do
|
||||
visit new_proposal_notification_path(proposal_id: proposal.id)
|
||||
|
||||
fill_in "Title", with: "Thank you for supporting my proposal"
|
||||
fill_in "Message", with: "Please share it with others so we can make it happen!"
|
||||
click_button "Send message"
|
||||
|
||||
expect(page).to have_content "Your message has been sent correctly."
|
||||
end
|
||||
|
||||
logout
|
||||
login_as user.reload
|
||||
visit root_path
|
||||
|
||||
within("#notifications") { expect(page).to have_content :all, "You have 3 new notifications" }
|
||||
find(".icon-notification").click
|
||||
|
||||
expect(page).to have_css ".notification", count: 3
|
||||
expect(page).to have_content "There is one new notification on #{proposal.title}", count: 3
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Error messages" do
|
||||
|
||||
@@ -18,6 +18,8 @@ feature 'Proposals' do
|
||||
|
||||
before do
|
||||
Setting['feature.allow_images'] = true
|
||||
Setting['feature.featured_proposals'] = true
|
||||
Setting['featured_proposals_number'] = 3
|
||||
end
|
||||
|
||||
after do
|
||||
@@ -92,6 +94,7 @@ feature 'Proposals' do
|
||||
click_link "Next", exact: false
|
||||
end
|
||||
|
||||
expect(page).to have_selector('#proposals .proposal-featured', count: 3)
|
||||
expect(page).to have_selector('#proposals .proposal', count: 2)
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ feature 'Tags' do
|
||||
let(:author) { create(:user, :level_two, username: 'Isabel') }
|
||||
let(:budget) { create(:budget, name: "Big Budget") }
|
||||
let(:group) { create(:budget_group, name: "Health", budget: budget) }
|
||||
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
|
||||
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group, latitude: '40.416775', longitude: '-3.703790') }
|
||||
let!(:tag_medio_ambiente) { create(:tag, :category, name: 'Medio Ambiente') }
|
||||
let!(:tag_economia) { create(:tag, :category, name: 'Economía') }
|
||||
let(:admin) { create(:administrator).user }
|
||||
|
||||
Reference in New Issue
Block a user