Fix Style/RedundantParentheses rubocop issues
This commit is contained in:
@@ -668,11 +668,6 @@ Style/RedundantBegin:
|
|||||||
- 'app/controllers/graphql_controller.rb'
|
- 'app/controllers/graphql_controller.rb'
|
||||||
- 'app/models/legislation/annotation.rb'
|
- 'app/models/legislation/annotation.rb'
|
||||||
|
|
||||||
# Offense count: 55
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/RedundantParentheses:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
|
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class Admin::SettingsController < Admin::BaseController
|
class Admin::SettingsController < Admin::BaseController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
all_settings = (Setting.all).group_by { |s| s.type }
|
all_settings = Setting.all.group_by { |s| s.type }
|
||||||
@settings = all_settings['common']
|
@settings = all_settings['common']
|
||||||
@feature_flags = all_settings['feature']
|
@feature_flags = all_settings['feature']
|
||||||
@banner_styles = all_settings['banner-style']
|
@banner_styles = all_settings['banner-style']
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Legislation::AnnotationsController < ApplicationController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
if !@process.allegations_phase.open? || @draft_version.final_version?
|
if !@process.allegations_phase.open? || @draft_version.final_version?
|
||||||
render(json: {}, status: :not_found) && (return)
|
render(json: {}, status: :not_found) && return
|
||||||
end
|
end
|
||||||
|
|
||||||
existing_annotation = @draft_version.annotations.where(
|
existing_annotation = @draft_version.annotations.where(
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ module ProposalsHelper
|
|||||||
percentage = (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success)
|
percentage = (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success)
|
||||||
case percentage
|
case percentage
|
||||||
when 0 then "0%"
|
when 0 then "0%"
|
||||||
when 0..(0.1) then "0.1%"
|
when 0..0.1 then "0.1%"
|
||||||
when (0.1)..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1)
|
when 0.1..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1)
|
||||||
else "100%"
|
else "100%"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module Graphqlable
|
|||||||
end
|
end
|
||||||
|
|
||||||
def graphql_type_description
|
def graphql_type_description
|
||||||
(model_name.human).to_s
|
model_name.human.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ feature 'Admin::Organizations' do
|
|||||||
click_on 'Verify'
|
click_on 'Verify'
|
||||||
end
|
end
|
||||||
expect(current_path).to eq(admin_organizations_path)
|
expect(current_path).to eq(admin_organizations_path)
|
||||||
expect(page).to have_content ('Verified')
|
expect(page).to have_content 'Verified'
|
||||||
|
|
||||||
expect(organization.reload.verified?).to eq(true)
|
expect(organization.reload.verified?).to eq(true)
|
||||||
end
|
end
|
||||||
@@ -108,18 +108,18 @@ feature 'Admin::Organizations' do
|
|||||||
click_on "Verified"
|
click_on "Verified"
|
||||||
|
|
||||||
within("#organization_#{organization.id}") do
|
within("#organization_#{organization.id}") do
|
||||||
expect(page).to have_content ('Verified')
|
expect(page).to have_content 'Verified'
|
||||||
expect(page).to_not have_link('Verify')
|
expect(page).to_not have_link('Verify')
|
||||||
expect(page).to have_link('Reject')
|
expect(page).to have_link('Reject')
|
||||||
|
|
||||||
click_on 'Reject'
|
click_on 'Reject'
|
||||||
end
|
end
|
||||||
expect(current_path).to eq(admin_organizations_path)
|
expect(current_path).to eq(admin_organizations_path)
|
||||||
expect(page).to_not have_content (organization.name)
|
expect(page).to_not have_content organization.name
|
||||||
|
|
||||||
click_on 'Rejected'
|
click_on 'Rejected'
|
||||||
expect(page).to have_content ('Rejected')
|
expect(page).to have_content 'Rejected'
|
||||||
expect(page).to have_content (organization.name)
|
expect(page).to have_content organization.name
|
||||||
|
|
||||||
expect(organization.reload.rejected?).to eq(true)
|
expect(organization.reload.rejected?).to eq(true)
|
||||||
end
|
end
|
||||||
@@ -137,10 +137,10 @@ feature 'Admin::Organizations' do
|
|||||||
click_on 'Verify'
|
click_on 'Verify'
|
||||||
end
|
end
|
||||||
expect(current_path).to eq(admin_organizations_path)
|
expect(current_path).to eq(admin_organizations_path)
|
||||||
expect(page).to_not have_content (organization.name)
|
expect(page).to_not have_content organization.name
|
||||||
click_on('Verified')
|
click_on('Verified')
|
||||||
|
|
||||||
expect(page).to have_content (organization.name)
|
expect(page).to have_content organization.name
|
||||||
|
|
||||||
expect(organization.reload.verified?).to eq(true)
|
expect(organization.reload.verified?).to eq(true)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ feature 'Budget Investments' do
|
|||||||
fill_in "budget_investment_title", with: "search"
|
fill_in "budget_investment_title", with: "search"
|
||||||
|
|
||||||
within("div#js-suggest") do
|
within("div#js-suggest") do
|
||||||
expect(page).to have_content ("You are seeing 5 of 6 investments containing the term 'search'")
|
expect(page).to have_content "You are seeing 5 of 6 investments containing the term 'search'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ feature 'Budget Investments' do
|
|||||||
fill_in "budget_investment_title", with: "item"
|
fill_in "budget_investment_title", with: "item"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within('div#js-suggest') do
|
||||||
expect(page).to_not have_content ('You are seeing')
|
expect(page).to_not have_content 'You are seeing'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ feature 'Budget Investments' do
|
|||||||
fill_in "budget_investment_title", with: "search"
|
fill_in "budget_investment_title", with: "search"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within('div#js-suggest') do
|
||||||
expect(page).to_not have_content ('You are seeing')
|
expect(page).to_not have_content 'You are seeing'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ feature 'Email campaigns' do
|
|||||||
visit admin_stats_path
|
visit admin_stats_path
|
||||||
|
|
||||||
expect(page).to have_content "#{@campaign1.name} (1)"
|
expect(page).to have_content "#{@campaign1.name} (1)"
|
||||||
expect(page).to_not have_content (@campaign2.name).to_s
|
expect(page).to_not have_content @campaign2.name.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -879,7 +879,7 @@ feature 'Debates' do
|
|||||||
check "debate_terms_of_service"
|
check "debate_terms_of_service"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within('div#js-suggest') do
|
||||||
expect(page).to have_content ("You are seeing 5 of 6 debates containing the term 'debate'")
|
expect(page).to have_content "You are seeing 5 of 6 debates containing the term 'debate'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -895,7 +895,7 @@ feature 'Debates' do
|
|||||||
check "debate_terms_of_service"
|
check "debate_terms_of_service"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within('div#js-suggest') do
|
||||||
expect(page).to_not have_content ('You are seeing')
|
expect(page).to_not have_content 'You are seeing'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ feature 'Managed User' do
|
|||||||
|
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
expect(page).to have_content (user.email).to_s
|
expect(page).to have_content user.email.to_s
|
||||||
expect(page).to have_content (user.document_number).to_s
|
expect(page).to have_content user.document_number.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -45,9 +45,9 @@ feature 'Managed User' do
|
|||||||
|
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
expect(page).to have_content (user.email).to_s
|
expect(page).to have_content user.email.to_s
|
||||||
expect(page).to have_content (user.document_number).to_s
|
expect(page).to have_content user.document_number.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -78,9 +78,9 @@ feature 'Managed User' do
|
|||||||
|
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
expect(page).to have_content (user.email).to_s
|
expect(page).to have_content user.email.to_s
|
||||||
expect(page).to have_content (user.document_number).to_s
|
expect(page).to have_content user.document_number.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -106,9 +106,9 @@ feature 'Managed User' do
|
|||||||
user = User.last
|
user = User.last
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
expect(page).to have_content (user.email).to_s
|
expect(page).to have_content user.email.to_s
|
||||||
expect(page).to have_content (user.document_number).to_s
|
expect(page).to have_content user.document_number.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -134,8 +134,8 @@ feature 'Managed User' do
|
|||||||
user = User.last
|
user = User.last
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
expect(page).to have_content (user.document_number).to_s
|
expect(page).to have_content user.document_number.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -151,14 +151,14 @@ feature 'Managed User' do
|
|||||||
|
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
|
|
||||||
click_link "Change user"
|
click_link "Change user"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content "User session signed out successfully."
|
expect(page).to have_content "User session signed out successfully."
|
||||||
expect(page).to_not have_content "Identified as"
|
expect(page).to_not have_content "Identified as"
|
||||||
expect(page).to_not have_content (user.username).to_s
|
expect(page).to_not have_content user.username.to_s
|
||||||
expect(current_path).to eq(management_root_path)
|
expect(current_path).to eq(management_root_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ feature 'Proposals' do
|
|||||||
|
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
expect(page).to have_content (user.email).to_s
|
expect(page).to have_content user.email.to_s
|
||||||
expect(page).to have_content (user.document_number).to_s
|
expect(page).to have_content user.document_number.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
fill_in 'proposal_title', with: 'Help refugees'
|
fill_in 'proposal_title', with: 'Help refugees'
|
||||||
@@ -119,9 +119,9 @@ feature 'Proposals' do
|
|||||||
|
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
expect(page).to have_content (user.username).to_s
|
expect(page).to have_content user.username.to_s
|
||||||
expect(page).to have_content (user.email).to_s
|
expect(page).to have_content user.email.to_s
|
||||||
expect(page).to have_content (user.document_number).to_s
|
expect(page).to have_content user.document_number.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
within(".proposals-list") do
|
within(".proposals-list") do
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ feature 'Users' do
|
|||||||
expect(user).to be_level_three_verified
|
expect(user).to be_level_three_verified
|
||||||
expect(user).to be_residence_verified
|
expect(user).to be_residence_verified
|
||||||
expect(user).to_not be_confirmed
|
expect(user).to_not be_confirmed
|
||||||
expect(user.date_of_birth).to have_content (Date.new(1980, 12, 31))
|
expect(user.date_of_birth).to have_content Date.new(1980, 12, 31)
|
||||||
|
|
||||||
sent_token = /.*confirmation_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
|
sent_token = /.*confirmation_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
|
||||||
visit user_confirmation_path(confirmation_token: sent_token)
|
visit user_confirmation_path(confirmation_token: sent_token)
|
||||||
@@ -69,7 +69,7 @@ feature 'Users' do
|
|||||||
expect(user).to be_level_three_verified
|
expect(user).to be_level_three_verified
|
||||||
expect(user).to be_residence_verified
|
expect(user).to be_residence_verified
|
||||||
expect(user).to be_confirmed
|
expect(user).to be_confirmed
|
||||||
expect(user.date_of_birth).to have_content (Date.new(1980, 12, 31))
|
expect(user.date_of_birth).to have_content Date.new(1980, 12, 31)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Delete a level 2 user account from document verification page', :js do
|
scenario 'Delete a level 2 user account from document verification page', :js do
|
||||||
|
|||||||
@@ -1390,7 +1390,7 @@ feature 'Proposals' do
|
|||||||
check "proposal_terms_of_service"
|
check "proposal_terms_of_service"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within('div#js-suggest') do
|
||||||
expect(page).to have_content ("You are seeing 5 of 6 proposals containing the term 'search'")
|
expect(page).to have_content "You are seeing 5 of 6 proposals containing the term 'search'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1406,7 +1406,7 @@ feature 'Proposals' do
|
|||||||
check "proposal_terms_of_service"
|
check "proposal_terms_of_service"
|
||||||
|
|
||||||
within('div#js-suggest') do
|
within('div#js-suggest') do
|
||||||
expect(page).to_not have_content ('You are seeing')
|
expect(page).to_not have_content 'You are seeing'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ describe Budget::Investment do
|
|||||||
let(:investment) { create(:budget_investment) }
|
let(:investment) { create(:budget_investment) }
|
||||||
|
|
||||||
it "returns the proposal id" do
|
it "returns the proposal id" do
|
||||||
expect(investment.code).to include((investment.id).to_s)
|
expect(investment.code).to include(investment.id.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the administrator id when assigned" do
|
it "returns the administrator id when assigned" do
|
||||||
|
|||||||
@@ -687,12 +687,12 @@ describe Debate do
|
|||||||
describe "#last_week" do
|
describe "#last_week" do
|
||||||
it "should return debates created this week" do
|
it "should return debates created this week" do
|
||||||
debate = create(:debate)
|
debate = create(:debate)
|
||||||
expect(Debate.last_week.all).to include (debate)
|
expect(Debate.last_week.all).to include debate
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not show debates created more than a week ago" do
|
it "should not show debates created more than a week ago" do
|
||||||
debate = create(:debate, created_at: 8.days.ago)
|
debate = create(:debate, created_at: 8.days.ago)
|
||||||
expect(Debate.last_week.all).to_not include (debate)
|
expect(Debate.last_week.all).to_not include debate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ describe Verification::Residence do
|
|||||||
it "should validate user has allowed age" do
|
it "should validate user has allowed age" do
|
||||||
residence = Verification::Residence.new("date_of_birth(3i)" => "1",
|
residence = Verification::Residence.new("date_of_birth(3i)" => "1",
|
||||||
"date_of_birth(2i)" => "1",
|
"date_of_birth(2i)" => "1",
|
||||||
"date_of_birth(1i)" => (5.years.ago.year).to_s)
|
"date_of_birth(1i)" => 5.years.ago.year.to_s)
|
||||||
expect(residence).to_not be_valid
|
expect(residence).to_not be_valid
|
||||||
expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate")
|
expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user