Fixed some failing specs

This commit is contained in:
Juan Salvador Pérez García
2018-06-28 17:30:55 +02:00
parent 59eb1a4f47
commit 084e9855e4
5 changed files with 20 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
module ProposalsDashboardHelper module ProposalsDashboardHelper
def resources_menu_visible?(proposal, resources) def resources_menu_visible?(proposal, resources)
can?(:manage_polls, proposal) && resources.any? can?(:manage_polls, proposal) || resources.any?
end end
def progress_menu(&block) def progress_menu(&block)

View File

@@ -1,10 +1,11 @@
<% content_for :action_title, t("admin.polls.index.title") %> <% content_for :action_title, t("admin.polls.index.title") %>
<%= link_to t("admin.polls.index.create"),
new_proposal_dashboard_poll_path(proposal),
class: "button success float-right" %>
<% if @polls.any? %> <% if @polls.any? %>
<%= link_to t("admin.polls.index.create"),
new_proposal_dashboard_poll_path(proposal),
class: "button success float-right" %>
<table> <table>
<thead> <thead>
<th class="medium-6"><%= t("admin.polls.index.name") %></th> <th class="medium-6"><%= t("admin.polls.index.name") %></th>
@@ -19,4 +20,8 @@
<div class="callout primary"> <div class="callout primary">
<%= t("admin.polls.index.no_polls") %> <%= t("admin.polls.index.no_polls") %>
</div> </div>
<%= link_to t("admin.polls.index.create"),
new_proposal_dashboard_poll_path(proposal),
class: "button success float-right" %>
<% end %> <% end %>

View File

@@ -31,7 +31,6 @@
<div class="off-canvas-wrapper"> <div class="off-canvas-wrapper">
<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper> <div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
<div class="off-canvas position-left" id="offCanvas" data-off-canvas> <div class="off-canvas position-left" id="offCanvas" data-off-canvas>
<div class="show-for-small-only"> <div class="show-for-small-only">
<div class="dashboard-sidebar" data-equalizer-watch> <div class="dashboard-sidebar" data-equalizer-watch>
<%= render partial: 'proposals_dashboard/menu' %> <%= render partial: 'proposals_dashboard/menu' %>

View File

@@ -13,7 +13,10 @@ feature 'Polls' do
end end
scenario 'Initially there are no polls' do scenario 'Initially there are no polls' do
click_link 'Polls' within('#side_menu') do
click_link 'Polls'
end
expect(page).to have_content('There are no polls coming up.') expect(page).to have_content('There are no polls coming up.')
end end

View File

@@ -442,7 +442,9 @@ feature 'Proposals' do
expect(page.html).not_to include "<script>alert('hey')</script>" expect(page.html).not_to include "<script>alert('hey')</script>"
click_link 'Dashboard' click_link 'Dashboard'
click_link 'Edit' within('#side_menu') do
click_link 'Edit'
end
expect(page).to have_current_path(edit_proposal_path(Proposal.last)) expect(page).to have_current_path(edit_proposal_path(Proposal.last))
expect(page).not_to have_link('click me') expect(page).not_to have_link('click me')
@@ -518,7 +520,10 @@ feature 'Proposals' do
click_link 'Dashboard' click_link 'Dashboard'
end end
click_link 'Retire' within('#side_menu') do
click_link 'Retire'
end
expect(page).to have_current_path(retire_form_proposal_path(proposal)) expect(page).to have_current_path(retire_form_proposal_path(proposal))
select 'Duplicated', from: 'proposal_retired_reason' select 'Duplicated', from: 'proposal_retired_reason'