Merge branch 'master' into fix-2644-split-spec-helpers

This commit is contained in:
Raimond Garcia
2018-06-12 14:26:26 +02:00
committed by GitHub
139 changed files with 1754 additions and 1064 deletions

View File

@@ -114,7 +114,7 @@ feature 'Admin banners magement' do
visit admin_root_path
within('#side_menu') do
click_link "Banners"
click_link "Site content"
click_link "Manage banners"
end

View File

@@ -1056,7 +1056,7 @@ feature 'Admin budget investments' do
visit admin_budget_budget_investments_path(budget)
expect(page).not_to have_css("#budget_investment_visible_to_valuators")
expect(page).to have_css("#budget_investment_visible_to_valuators")
within('#filter-subnav') { click_link 'Under valuation' }
@@ -1127,4 +1127,94 @@ feature 'Admin budget investments' do
end
end
context "Mark as visible to valuators" do
let(:valuator) { create(:valuator) }
let(:admin) { create(:administrator) }
let(:group) { create(:budget_group, budget: budget) }
let(:heading) { create(:budget_heading, group: group) }
let(:investment1) { create(:budget_investment, heading: heading) }
let(:investment2) { create(:budget_investment, heading: heading) }
scenario "Mark as visible to valuator", :js do
investment1.valuators << valuator
investment2.valuators << valuator
investment1.update(administrator: admin)
investment2.update(administrator: admin)
visit admin_budget_budget_investments_path(budget)
within("#budget_investment_#{investment1.id}") do
check "budget_investment_visible_to_valuators"
end
visit admin_budget_budget_investments_path(budget)
within('#filter-subnav') { click_link 'Under valuation' }
within("#budget_investment_#{investment1.id}") do
expect(find("#budget_investment_visible_to_valuators")).to be_checked
end
end
scenario "Unmark as visible to valuator", :js do
budget.update(phase: 'valuating')
valuator = create(:valuator)
admin = create(:administrator)
group = create(:budget_group, budget: budget)
heading = create(:budget_heading, group: group)
investment1 = create(:budget_investment, heading: heading, visible_to_valuators: true)
investment2 = create(:budget_investment, heading: heading, visible_to_valuators: true)
investment1.valuators << valuator
investment2.valuators << valuator
investment1.update(administrator: admin)
investment2.update(administrator: admin)
visit admin_budget_budget_investments_path(budget)
within('#filter-subnav') { click_link 'Under valuation' }
within("#budget_investment_#{investment1.id}") do
uncheck "budget_investment_visible_to_valuators"
end
visit admin_budget_budget_investments_path(budget)
within("#budget_investment_#{investment1.id}") do
expect(find("#budget_investment_visible_to_valuators")).not_to be_checked
end
end
scenario "Showing the valuating checkbox" do
investment1 = create(:budget_investment, budget: budget, visible_to_valuators: true)
investment2 = create(:budget_investment, budget: budget, visible_to_valuators: false)
investment1.valuators << create(:valuator)
investment2.valuators << create(:valuator)
investment2.valuators << create(:valuator)
investment1.update(administrator: create(:administrator))
investment2.update(administrator: create(:administrator))
visit admin_budget_budget_investments_path(budget)
expect(page).to have_css("#budget_investment_visible_to_valuators")
within('#filter-subnav') { click_link 'Under valuation' }
within("#budget_investment_#{investment1.id}") do
valuating_checkbox = find('#budget_investment_visible_to_valuators')
expect(valuating_checkbox).to be_checked
end
within("#budget_investment_#{investment2.id}") do
valuating_checkbox = find('#budget_investment_visible_to_valuators')
expect(valuating_checkbox).not_to be_checked
end
end
end
end

View File

@@ -81,7 +81,7 @@ feature 'Admin comments' do
comment = create(:comment, :hidden, body: 'SPAM')
visit admin_comments_path
click_link 'Confirm'
click_link 'Confirm moderation'
expect(page).not_to have_content(comment.body)
click_link('Confirmed')

View File

@@ -33,7 +33,7 @@ feature 'Admin debates' do
debate = create(:debate, :hidden)
visit admin_debates_path
click_link 'Confirm'
click_link 'Confirm moderation'
expect(page).not_to have_content(debate.title)
click_link('Confirmed')

View File

@@ -38,7 +38,7 @@ feature 'Admin hidden users' do
user = create(:user, :hidden)
visit admin_hidden_users_path
click_link 'Confirm'
click_link 'Confirm moderation'
expect(page).not_to have_content(user.username)
click_link('Confirmed')

View File

@@ -26,7 +26,7 @@ feature 'Admin legislation draft versions' do
visit admin_legislation_processes_path(filter: 'all')
click_link 'An example legislation process'
click_link 'Text'
click_link 'Drafting'
click_link 'Version 1'
expect(page).to have_content(draft_version.title)
@@ -49,7 +49,7 @@ feature 'Admin legislation draft versions' do
expect(page).to have_content 'An example legislation process'
click_link 'An example legislation process'
click_link 'Text'
click_link 'Drafting'
click_link 'Create version'
@@ -82,7 +82,7 @@ feature 'Admin legislation draft versions' do
expect(page).to have_content 'An example legislation process'
click_link 'An example legislation process'
click_link 'Text'
click_link 'Drafting'
click_link 'Version 1'

View File

@@ -14,7 +14,7 @@ feature 'Admin booths' do
click_link "Booths location"
end
expect(page).to have_content "There are no booths"
expect(page).to have_content "There are no active booths for any upcoming poll."
end
scenario 'Index' do

View File

@@ -83,25 +83,67 @@ feature 'Admin polls' do
expect(page).to have_css("img[alt='#{poll.image.title}']")
expect(page).to have_css("#poll_results_enabled")
expect(page).to have_css("#poll_stats_enabled")
fill_in "poll_name", with: "Next Poll"
fill_in 'poll_ends_at', with: end_date.strftime("%d/%m/%Y")
check 'poll_results_enabled'
check 'poll_stats_enabled'
click_button "Update poll"
expect(page).to have_content "Poll updated successfully"
expect(page).to have_content "Next Poll"
expect(page).to have_content I18n.l(end_date.to_date)
end
click_link "Edit poll"
scenario 'Enable stats and results' do
poll = create(:poll)
booth_assignment_1 = create(:poll_booth_assignment, poll: poll)
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
booth_assignment_3 = create(:poll_booth_assignment, poll: poll)
question_1 = create(:poll_question, poll: poll)
create(:poll_question_answer, title: 'Oui', question: question_1)
create(:poll_question_answer, title: 'Non', question: question_1)
question_2 = create(:poll_question, poll: poll)
create(:poll_question_answer, title: "Aujourd'hui", question: question_2)
create(:poll_question_answer, title: 'Demain', question: question_2)
[booth_assignment_1, booth_assignment_2, booth_assignment_3].each do |ba|
create(:poll_partial_result,
booth_assignment: ba,
question: question_1,
answer: 'Oui',
amount: 11)
create(:poll_partial_result,
booth_assignment: ba,
question: question_2,
answer: 'Demain',
amount: 5)
end
create(:poll_recount,
booth_assignment: booth_assignment_1,
white_amount: 21,
null_amount: 44,
total_amount: 66)
visit admin_poll_results_path(poll)
expect(page).to have_field('poll_stats_enabled', checked: false)
expect(page).to have_field('poll_results_enabled', checked: false)
check 'poll_stats_enabled'
check 'poll_results_enabled'
click_button 'Update poll'
expect(page).to have_content('Poll updated successfully')
click_link 'Results'
expect(page).to have_field('poll_results_enabled', checked: true)
expect(page).to have_field('poll_stats_enabled', checked: true)
expect(page).to have_field('poll_results_enabled', checked: true)
end
scenario 'Edit from index' do

View File

@@ -36,19 +36,16 @@ feature 'Admin poll questions' do
Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her
people and restore freedom to the galaxy....
}
video_url = "https://puppyvideos.com"
visit admin_questions_path
click_link "Create question"
select 'Movies', from: 'poll_question_poll_id'
fill_in 'poll_question_title', with: title
fill_in 'poll_question_video_url', with: video_url
click_button 'Save'
expect(page).to have_content(title)
expect(page).to have_content(video_url)
end
scenario 'Create from successful proposal index' do

View File

@@ -45,7 +45,7 @@ feature 'Admin proposals' do
proposal = create(:proposal, :hidden)
visit admin_proposals_path
click_link 'Confirm'
click_link 'Confirm moderation'
expect(page).not_to have_content(proposal.title)
click_link('Confirmed')

View File

@@ -261,7 +261,7 @@ feature 'Ballots' do
click_link "States"
expect(page).to have_content "California"
expect(page).to have_css("#budget_heading_#{california.id}.active")
expect(page).to have_css("#budget_heading_#{california.id}.is-active")
end
scenario 'Change my heading', :js do
@@ -283,8 +283,8 @@ feature 'Ballots' do
visit budget_path(budget)
click_link "States"
expect(page).to have_css("#budget_heading_#{new_york.id}.active")
expect(page).not_to have_css("#budget_heading_#{california.id}.active")
expect(page).to have_css("#budget_heading_#{new_york.id}.is-active")
expect(page).not_to have_css("#budget_heading_#{california.id}.is-active")
end
scenario 'View another heading' do

View File

@@ -22,7 +22,7 @@ feature 'Budgets' do
expect(page).to have_content(budget.name)
expect(page).to have_content(budget.description)
expect(page).to have_content('Actual phase')
expect(page).to have_content('Informing')
expect(page).to have_content('Information')
expect(page).to have_link('Help with participatory budgets')
expect(page).to have_link('See all phases')
end
@@ -188,7 +188,7 @@ feature 'Budgets' do
expect(page).to have_content "This is the summary for finished phase"
expect(page).to have_content "March 21, 2018 - March 29, 2018"
expect(page).to have_css(".phase.active", count: 1)
expect(page).to have_css(".phase.is-active", count: 1)
end
context "Index map" do
@@ -246,6 +246,77 @@ feature 'Budgets' do
end
end
xcontext "Index map" do
let(:group) { create(:budget_group, budget: budget) }
let(:heading) { create(:budget_heading, group: group) }
before do
Setting['feature.map'] = true
end
scenario "Display investment's map location markers" , :js do
investment1 = create(:budget_investment, heading: heading)
investment2 = create(:budget_investment, heading: heading)
investment3 = create(:budget_investment, heading: heading)
investment1.create_map_location(longitude: 40.1234, latitude: 3.1234, zoom: 10)
investment2.create_map_location(longitude: 40.1235, latitude: 3.1235, zoom: 10)
investment3.create_map_location(longitude: 40.1236, latitude: 3.1236, zoom: 10)
visit budgets_path
within ".map_location" do
expect(page).to have_css(".map-icon", count: 3)
end
end
scenario "Display selected investment's map location markers" , :js do
budget.update(phase: :valuating)
investment1 = create(:budget_investment, :selected, heading: heading)
investment2 = create(:budget_investment, :selected, heading: heading)
investment3 = create(:budget_investment, heading: heading)
investment1.create_map_location(longitude: 40.1234, latitude: 3.1234, zoom: 10)
investment2.create_map_location(longitude: 40.1235, latitude: 3.1235, zoom: 10)
investment3.create_map_location(longitude: 40.1236, latitude: 3.1236, zoom: 10)
visit budgets_path
within ".map_location" do
expect(page).to have_css(".map-icon", count: 2)
end
end
scenario "Skip invalid map markers" , :js do
map_locations = []
map_locations << { longitude: 40.123456789, latitude: 3.12345678 }
map_locations << { longitude: 40.123456789, latitude: "*******" }
map_locations << { longitude: "**********", latitude: 3.12345678 }
budget_map_locations = map_locations.map do |map_location|
{
lat: map_location[:latitude],
long: map_location[:longitude],
investment_title: "#{rand(999)}",
investment_id: "#{rand(999)}",
budget_id: budget.id
}
end
allow_any_instance_of(BudgetsHelper).
to receive(:current_budget_map_locations).and_return(budget_map_locations)
visit budgets_path
within ".map_location" do
expect(page).to have_css(".map-icon", count: 1)
end
end
end
context 'Show' do
scenario "List all groups" do

View File

@@ -580,7 +580,7 @@ feature 'Budget Investments' do
visit budget_investments_path(budget, heading_id: heading.id)
click_link 'highest rated'
expect(page).to have_selector('a.active', text: 'highest rated')
expect(page).to have_selector('a.is-active', text: 'highest rated')
within '#budget-investments' do
expect(best_proposal.title).to appear_before(medium_proposal.title)
@@ -1276,7 +1276,7 @@ feature 'Budget Investments' do
visit budget_investments_path(budget, heading_id: heading.id)
click_link 'by price'
expect(page).to have_selector('a.active', text: 'by price')
expect(page).to have_selector('a.is-active', text: 'by price')
within '#budget-investments' do
expect(high_investment.title).to appear_before(mid_investment.title)

View File

@@ -21,7 +21,7 @@ feature 'Results' do
visit budget_path(budget)
click_link "See results"
expect(page).to have_selector('a.active', text: budget.headings.first.name)
expect(page).to have_selector('a.is-active', text: budget.headings.first.name)
within("#budget-investments-compatible") do
expect(page).to have_content investment1.title

View File

@@ -365,7 +365,7 @@ feature 'Debates' do
visit debates_path
click_link 'highest rated'
expect(page).to have_selector('a.active', text: 'highest rated')
expect(page).to have_selector('a.is-active', text: 'highest rated')
within '#debates' do
expect(best_debate.title).to appear_before(medium_debate.title)
@@ -384,7 +384,7 @@ feature 'Debates' do
visit debates_path
click_link 'newest'
expect(page).to have_selector('a.active', text: 'newest')
expect(page).to have_selector('a.is-active', text: 'newest')
within '#debates' do
expect(best_debate.title).to appear_before(medium_debate.title)
@@ -447,7 +447,7 @@ feature 'Debates' do
click_link 'recommendations'
expect(page).to have_selector('a.active', text: 'recommendations')
expect(page).to have_selector('a.is-active', text: 'recommendations')
within '#debates' do
expect(best_debate.title).to appear_before(medium_debate.title)
@@ -837,7 +837,7 @@ feature 'Debates' do
fill_in "search", with: "Show you got"
click_button "Search"
expect(page).to have_selector("a.active", text: "relevance")
expect(page).to have_selector("a.is-active", text: "relevance")
within("#debates") do
expect(all(".debate")[0].text).to match "Show you got"
@@ -856,7 +856,7 @@ feature 'Debates' do
fill_in "search", with: "Show you got"
click_button "Search"
click_link 'newest'
expect(page).to have_selector("a.active", text: "newest")
expect(page).to have_selector("a.is-active", text: "newest")
within("#debates") do
expect(all(".debate")[0].text).to match "Show you got"
@@ -881,7 +881,7 @@ feature 'Debates' do
fill_in "search", with: "Show you got"
click_button "Search"
click_link 'recommendations'
expect(page).to have_selector("a.active", text: "recommendations")
expect(page).to have_selector("a.is-active", text: "recommendations")
within("#debates") do
expect(all(".debate")[0].text).to match "Show you got"

View File

@@ -336,7 +336,7 @@ feature 'Emails' do
visit new_management_user_invite_path
fill_in "emails", with: " john@example.com, ana@example.com,isable@example.com "
click_button "Send invites"
click_button "Send invitations"
expect(page).to have_content "3 invitations have been sent."

View File

@@ -77,7 +77,7 @@ feature 'Legislation' do
choose("I don't know")
click_button "Submit answer"
within(:css, "label.active") do
within(:css, "label.is-active") do
expect(page).to have_content("I don't know")
expect(page).not_to have_content("Yes")
expect(page).not_to have_content("No")

View File

@@ -688,7 +688,7 @@ feature 'Proposals' do
visit proposals_path
click_link 'highest rated'
expect(page).to have_selector('a.active', text: 'highest rated')
expect(page).to have_selector('a.is-active', text: 'highest rated')
within '#proposals' do
expect(best_proposal.title).to appear_before(medium_proposal.title)
@@ -708,7 +708,7 @@ feature 'Proposals' do
visit proposals_path
click_link 'newest'
expect(page).to have_selector('a.active', text: 'newest')
expect(page).to have_selector('a.is-active', text: 'newest')
within '#proposals' do
expect(best_proposal.title).to appear_before(medium_proposal.title)
@@ -771,7 +771,7 @@ feature 'Proposals' do
click_link 'recommendations'
expect(page).to have_selector('a.active', text: 'recommendations')
expect(page).to have_selector('a.is-active', text: 'recommendations')
within '#proposals-list' do
expect(best_proposal.title).to appear_before(medium_proposal.title)
@@ -1288,7 +1288,7 @@ feature 'Proposals' do
fill_in "search", with: "Show what you got"
click_button "Search"
expect(page).to have_selector("a.active", text: "relevance")
expect(page).to have_selector("a.is-active", text: "relevance")
within("#proposals") do
expect(all(".proposal")[0].text).to match "Show what you got"
@@ -1307,7 +1307,7 @@ feature 'Proposals' do
fill_in "search", with: "Show what you got"
click_button "Search"
click_link 'newest'
expect(page).to have_selector("a.active", text: "newest")
expect(page).to have_selector("a.is-active", text: "newest")
within("#proposals") do
expect(all(".proposal")[0].text).to match "Show you got"
@@ -1332,7 +1332,7 @@ feature 'Proposals' do
fill_in "search", with: "Show you got"
click_button "Search"
click_link 'recommendations'
expect(page).to have_selector("a.active", text: "recommendations")
expect(page).to have_selector("a.is-active", text: "recommendations")
within("#proposals") do
expect(all(".proposal")[0].text).to match "Show you got"

View File

@@ -10,7 +10,7 @@ feature 'User invites' do
visit new_management_user_invite_path
fill_in "emails", with: "john@example.com, ana@example.com, isable@example.com"
click_button "Send invites"
click_button "Send invitations"
expect(page).to have_content "3 invitations have been sent."
end

View File

@@ -440,7 +440,7 @@ feature 'Users' do
visit user_path(@user, filter: "follows")
expect(page).to have_selector(".activity li.active", text: "1 Following")
expect(page).to have_selector(".activity li.is-active", text: "1 Following")
end
describe 'Proposals' do

View File

@@ -51,7 +51,7 @@ describe SignatureSheet do
spending_proposal = create(:spending_proposal)
signature_sheet.signable = spending_proposal
expect(signature_sheet.name).to eq("Spending proposal #{spending_proposal.id}")
expect(signature_sheet.name).to eq("Investment project #{spending_proposal.id}")
end
it "returns name for budget investment signature sheets" do
@@ -92,4 +92,4 @@ describe SignatureSheet do
end
end
end
end