Fix hound warnings
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
feature 'Admin dashboard actions' do
|
||||
feature "Admin dashboard actions" do
|
||||
let(:admin) { create :administrator }
|
||||
|
||||
before do
|
||||
@@ -16,99 +16,99 @@ feature 'Admin dashboard actions' do
|
||||
"Save",
|
||||
"Action created successfully"
|
||||
|
||||
context 'when visiting index' do
|
||||
context 'and no actions defined' do
|
||||
context "when visiting index" do
|
||||
context "and no actions defined" do
|
||||
before do
|
||||
visit admin_dashboard_actions_path
|
||||
end
|
||||
|
||||
scenario 'shows that there are no records available' do
|
||||
expect(page).to have_content('No records found')
|
||||
scenario "shows that there are no records available" do
|
||||
expect(page).to have_content("No records found")
|
||||
end
|
||||
end
|
||||
|
||||
context 'and actions defined' do
|
||||
context "and actions defined" do
|
||||
let!(:action) { create :dashboard_action }
|
||||
|
||||
before do
|
||||
visit admin_dashboard_actions_path
|
||||
end
|
||||
|
||||
scenario 'shows the action data' do
|
||||
scenario "shows the action data" do
|
||||
expect(page).to have_content(action.title)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when creating an action' do
|
||||
context "when creating an action" do
|
||||
let(:action) { build :dashboard_action }
|
||||
|
||||
before do
|
||||
visit admin_dashboard_actions_path
|
||||
click_link 'Create resource or action'
|
||||
click_link "Create resource or action"
|
||||
end
|
||||
|
||||
scenario 'Creates a new action' do
|
||||
fill_in 'dashboard_action_title', with: action.title
|
||||
fill_in 'dashboard_action_description', with: action.description
|
||||
scenario "Creates a new action" do
|
||||
fill_in "dashboard_action_title", with: action.title
|
||||
fill_in "dashboard_action_description", with: action.description
|
||||
|
||||
click_button 'Save'
|
||||
click_button "Save"
|
||||
|
||||
expect(page).to have_content(action.title)
|
||||
end
|
||||
|
||||
scenario 'Renders create form in case data is invalid' do
|
||||
click_button 'Save'
|
||||
expect(page).to have_content('errors prevented this Dashboard/Action from being saved.')
|
||||
scenario "Renders create form in case data is invalid" do
|
||||
click_button "Save"
|
||||
expect(page).to have_content("errors prevented this Dashboard/Action from being saved.")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when editing an action' do
|
||||
context "when editing an action" do
|
||||
let!(:action) { create :dashboard_action }
|
||||
let(:title) { Faker::Lorem.sentence }
|
||||
|
||||
before do
|
||||
visit admin_dashboard_actions_path
|
||||
click_link 'Edit'
|
||||
click_link "Edit"
|
||||
end
|
||||
|
||||
scenario 'Updates the action' do
|
||||
fill_in 'dashboard_action_title', with: title
|
||||
click_button 'Save'
|
||||
scenario "Updates the action" do
|
||||
fill_in "dashboard_action_title", with: title
|
||||
click_button "Save"
|
||||
|
||||
expect(page).to have_content(title)
|
||||
end
|
||||
|
||||
scenario 'Renders edit form in case data is invalid' do
|
||||
fill_in 'dashboard_action_title', with: 'x'
|
||||
click_button 'Save'
|
||||
expect(page).to have_content('error prevented this Dashboard/Action from being saved.')
|
||||
scenario "Renders edit form in case data is invalid" do
|
||||
fill_in "dashboard_action_title", with: "x"
|
||||
click_button "Save"
|
||||
expect(page).to have_content("error prevented this Dashboard/Action from being saved.")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when destroying an action' do
|
||||
context "when destroying an action" do
|
||||
let!(:action) { create :dashboard_action }
|
||||
|
||||
before do
|
||||
visit admin_dashboard_actions_path
|
||||
end
|
||||
|
||||
scenario 'deletes the action', js: true do
|
||||
scenario "deletes the action", js: true do
|
||||
page.accept_confirm do
|
||||
click_link 'Delete'
|
||||
click_link "Delete"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content(action.title)
|
||||
end
|
||||
|
||||
scenario 'can not delete actions that have been executed', js: true do
|
||||
scenario "can not delete actions that have been executed", js: true do
|
||||
_executed_action = create(:dashboard_executed_action, action: action)
|
||||
|
||||
page.accept_confirm do
|
||||
click_link 'Delete'
|
||||
click_link "Delete"
|
||||
end
|
||||
|
||||
expect(page).to have_content('Cannot delete record because dependent executed actions exist')
|
||||
expect(page).to have_content("Cannot delete record because dependent executed actions exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
feature 'Polls' do
|
||||
feature "Polls" do
|
||||
let!(:proposal) { create(:proposal, :draft) }
|
||||
|
||||
before do
|
||||
@@ -8,99 +8,99 @@ feature 'Polls' do
|
||||
visit proposal_dashboard_path(proposal)
|
||||
end
|
||||
|
||||
scenario 'Has a link to polls feature' do
|
||||
expect(page).to have_link('Polls')
|
||||
scenario "Has a link to polls feature" do
|
||||
expect(page).to have_link("Polls")
|
||||
end
|
||||
|
||||
scenario 'Create a poll', :js do
|
||||
click_link 'Polls'
|
||||
click_link 'Create poll'
|
||||
scenario "Create a poll", :js do
|
||||
click_link "Polls"
|
||||
click_link "Create poll"
|
||||
|
||||
start_date = 1.week.from_now
|
||||
end_date = 2.weeks.from_now
|
||||
|
||||
fill_in "poll_name", with: 'Upcoming poll'
|
||||
fill_in 'poll_starts_at', with: start_date.strftime('%d/%m/%Y')
|
||||
fill_in 'poll_ends_at', with: end_date.strftime('%d/%m/%Y')
|
||||
fill_in 'poll_description', with: "Upcomming poll's description. This poll..."
|
||||
fill_in "poll_name", with: "Proposal poll"
|
||||
fill_in "poll_starts_at", with: start_date.strftime("%d/%m/%Y")
|
||||
fill_in "poll_ends_at", with: end_date.strftime("%d/%m/%Y")
|
||||
fill_in "poll_description", with: "Proposal's poll description. This poll..."
|
||||
|
||||
expect(page).not_to have_css('#poll_results_enabled')
|
||||
expect(page).not_to have_css('#poll_stats_enabled')
|
||||
expect(page).not_to have_css("#poll_results_enabled")
|
||||
expect(page).not_to have_css("#poll_stats_enabled")
|
||||
|
||||
click_link 'Add question'
|
||||
click_link "Add question"
|
||||
|
||||
fill_in 'Question', with: 'First question'
|
||||
fill_in "Question", with: "First question"
|
||||
|
||||
click_link 'Add answer'
|
||||
fill_in 'Title', with: 'First answer'
|
||||
click_link "Add answer"
|
||||
|
||||
click_button 'Create poll'
|
||||
fill_in "Answer", with: "First answer"
|
||||
|
||||
expect(page).to have_content 'Poll created successfully'
|
||||
expect(page).to have_content 'Upcoming poll'
|
||||
click_button "Create poll"
|
||||
expect(page).to have_content "Poll created successfully"
|
||||
expect(page).to have_content "Proposal poll"
|
||||
expect(page).to have_content I18n.l(start_date.to_date)
|
||||
end
|
||||
|
||||
scenario 'Create a poll redirects back to form when invalid data', js: true do
|
||||
click_link 'Polls'
|
||||
click_link 'Create poll'
|
||||
scenario "Create a poll redirects back to form when invalid data", js: true do
|
||||
click_link "Polls"
|
||||
click_link "Create poll"
|
||||
|
||||
click_button 'Create poll'
|
||||
click_button "Create poll"
|
||||
|
||||
expect(page).to have_content('New poll')
|
||||
expect(page).to have_content("New poll")
|
||||
end
|
||||
|
||||
scenario 'Edit poll is allowed for upcoming polls' do
|
||||
poll = create(:poll, :incoming, related: proposal)
|
||||
scenario "Edit poll is allowed for upcoming polls" do
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
expect(page).to have_content('Edit survey')
|
||||
expect(page).to have_content("Edit survey")
|
||||
|
||||
click_link 'Edit survey'
|
||||
click_link "Edit survey"
|
||||
end
|
||||
|
||||
click_button 'Update poll'
|
||||
click_button "Update poll"
|
||||
|
||||
expect(page).to have_content 'Poll updated successfully'
|
||||
expect(page).to have_content "Poll updated successfully"
|
||||
end
|
||||
|
||||
scenario 'Edit poll redirects back when invalid data', js: true do
|
||||
poll = create(:poll, :incoming, related: proposal)
|
||||
scenario "Edit poll redirects back when invalid data", js: true do
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
expect(page).to have_content('Edit survey')
|
||||
expect(page).to have_content("Edit survey")
|
||||
|
||||
click_link 'Edit survey'
|
||||
click_link "Edit survey"
|
||||
end
|
||||
|
||||
fill_in "poll_name", with: ''
|
||||
fill_in "poll_name", with: ""
|
||||
|
||||
click_button 'Update poll'
|
||||
click_button "Update poll"
|
||||
|
||||
expect(page).to have_content('Edit poll')
|
||||
expect(page).to have_content("Edit poll")
|
||||
end
|
||||
|
||||
scenario 'Edit poll is not allowed for current polls' do
|
||||
scenario "Edit poll is not allowed for current polls" do
|
||||
poll = create(:poll, :current, related: proposal)
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
expect(page).not_to have_content('Edit survey')
|
||||
expect(page).not_to have_content("Edit survey")
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Edit poll is not allowed for expired polls' do
|
||||
scenario "Edit poll is not allowed for expired polls" do
|
||||
poll = create(:poll, :expired, related: proposal)
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
expect(page).not_to have_content('Edit survey')
|
||||
expect(page).not_to have_content("Edit survey")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -153,52 +153,52 @@ feature 'Polls' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'View results not available for upcoming polls' do
|
||||
poll = create(:poll, :incoming, related: proposal)
|
||||
scenario "View results not available for upcoming polls" do
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
expect(page).not_to have_content('View results')
|
||||
expect(page).not_to have_content("View results")
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'View results available for current polls' do
|
||||
scenario "View results available for current polls" do
|
||||
poll = create(:poll, :current, related: proposal)
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
expect(page).to have_content('View results')
|
||||
expect(page).to have_content("View results")
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'View results available for expired polls' do
|
||||
scenario "View results available for expired polls" do
|
||||
poll = create(:poll, :expired, related: proposal)
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
expect(page).to have_content('View results')
|
||||
expect(page).to have_content("View results")
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'View results redirects to results in public zone', js: true do
|
||||
scenario "View results redirects to results in public zone", js: true do
|
||||
poll = create(:poll, :expired, related: proposal)
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
within "div#poll_#{poll.id}" do
|
||||
click_link 'View results'
|
||||
click_link "View results"
|
||||
end
|
||||
|
||||
page.driver.browser.switch_to.window page.driver.browser.window_handles.last do
|
||||
expect(page.current_path).to eq(results_poll_path(poll))
|
||||
expect(page).to have_current_path(results_poll_path(poll))
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Poll card' do
|
||||
poll = create(:poll, :expired, related: proposal)
|
||||
scenario "Poll card" do
|
||||
poll = create(:poll, :expired, related: proposal)
|
||||
|
||||
visit proposal_dashboard_polls_path(proposal)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user