diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a29c06239..5f0279b73 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -524,19 +524,6 @@ Style/SymbolProc: - 'lib/manager_authenticator.rb' - 'spec/factories.rb' -# Offense count: 31 -# Cop supports --auto-correct. -Style/UnneededInterpolation: - Exclude: - - 'app/controllers/users/omniauth_callbacks_controller.rb' - - 'spec/factories.rb' - - 'spec/features/campaigns_spec.rb' - - 'spec/features/management/managed_users_spec.rb' - - 'spec/features/management/proposals_spec.rb' - - 'spec/features/management/spending_proposals_spec.rb' - - 'spec/models/residence_spec.rb' - - 'spec/models/spending_proposal_spec.rb' - # Offense count: 13 # Configuration parameters: SupportedStyles. # SupportedStyles: snake_case, normalcase, non_integer diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index ef1ef31de..c83eecbcb 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -33,7 +33,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController if save_user identity.update(user: @user) sign_in_and_redirect @user, event: :authentication - set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format? + set_flash_message(:notice, :success, kind: provider.to_s.capitalize) if is_navigational_format? else session["devise.#{provider}_data"] = auth redirect_to new_user_registration_url diff --git a/app/models/concerns/graphqlable.rb b/app/models/concerns/graphqlable.rb index 651a285b9..5b88dfc59 100644 --- a/app/models/concerns/graphqlable.rb +++ b/app/models/concerns/graphqlable.rb @@ -24,7 +24,7 @@ module Graphqlable end def graphql_type_description - "#{self.model_name.human}" + (self.model_name.human).to_s end end diff --git a/spec/factories.rb b/spec/factories.rb index 31ba2cec0..9a3c292b3 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -567,7 +567,7 @@ FactoryGirl.define do factory :campaign do sequence(:name) { |n| "Campaign #{n}" } - sequence(:track_id) { |n| "#{n}" } + sequence(:track_id) { |n| n.to_s } end factory :notification do @@ -577,8 +577,8 @@ FactoryGirl.define do factory :geozone do sequence(:name) { |n| "District #{n}" } - sequence(:external_code) { |n| "#{n}" } - sequence(:census_code) { |n| "#{n}" } + sequence(:external_code) { |n| n.to_s } + sequence(:census_code) { |n| n.to_s } trait :in_census do census_code "01" diff --git a/spec/features/campaigns_spec.rb b/spec/features/campaigns_spec.rb index 525c292f6..6dba2ff09 100644 --- a/spec/features/campaigns_spec.rb +++ b/spec/features/campaigns_spec.rb @@ -27,7 +27,7 @@ feature 'Email campaigns' do visit admin_stats_path expect(page).to have_content "#{@campaign1.name} (1)" - expect(page).to_not have_content "#{@campaign2.name}" + expect(page).to_not have_content (@campaign2.name).to_s end end \ No newline at end of file diff --git a/spec/features/management/managed_users_spec.rb b/spec/features/management/managed_users_spec.rb index d35dc35e1..ef3c539d9 100644 --- a/spec/features/management/managed_users_spec.rb +++ b/spec/features/management/managed_users_spec.rb @@ -24,9 +24,9 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end end @@ -45,9 +45,9 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end end @@ -78,9 +78,9 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end end @@ -106,9 +106,9 @@ feature 'Managed User' do user = User.last within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end end @@ -134,8 +134,8 @@ feature 'Managed User' do user = User.last within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.document_number).to_s end end end @@ -151,14 +151,14 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" + expect(page).to have_content (user.username).to_s click_link "Change user" end expect(page).to have_content "User session signed out successfully." expect(page).to_not have_content "Identified as" - expect(page).to_not have_content "#{user.username}" + expect(page).to_not have_content (user.username).to_s expect(current_path).to eq(management_root_path) end diff --git a/spec/features/management/proposals_spec.rb b/spec/features/management/proposals_spec.rb index 1bf32eeb3..8f63146e9 100644 --- a/spec/features/management/proposals_spec.rb +++ b/spec/features/management/proposals_spec.rb @@ -16,9 +16,9 @@ feature 'Proposals' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end fill_in 'proposal_title', with: 'Help refugees' @@ -119,9 +119,9 @@ feature 'Proposals' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end within(".proposals-list") do diff --git a/spec/features/management/spending_proposals_spec.rb b/spec/features/management/spending_proposals_spec.rb index 23e8383e6..8a6d17964 100644 --- a/spec/features/management/spending_proposals_spec.rb +++ b/spec/features/management/spending_proposals_spec.rb @@ -23,9 +23,9 @@ feature 'Spending Proposals' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end fill_in 'spending_proposal_title', with: 'Build a park in my neighborhood' @@ -118,9 +118,9 @@ feature 'Spending Proposals' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content "#{user.username}" - expect(page).to have_content "#{user.email}" - expect(page).to have_content "#{user.document_number}" + expect(page).to have_content (user.username).to_s + expect(page).to have_content (user.email).to_s + expect(page).to have_content (user.document_number).to_s end within("#investment-projects") do diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index 827ca9d21..c363f3bdc 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -103,7 +103,7 @@ describe Budget::Investment do let(:investment) { create(:budget_investment) } it "returns the proposal id" do - expect(investment.code).to include("#{investment.id}") + expect(investment.code).to include((investment.id).to_s) end it "returns the administrator id when assigned" do diff --git a/spec/models/residence_spec.rb b/spec/models/residence_spec.rb index 072782508..954394d1c 100644 --- a/spec/models/residence_spec.rb +++ b/spec/models/residence_spec.rb @@ -25,7 +25,7 @@ describe Verification::Residence do end it "should validate user has allowed age" do - residence = Verification::Residence.new("date_of_birth(3i)" => "1", "date_of_birth(2i)" => "1", "date_of_birth(1i)" => "#{5.years.ago.year}") + residence = Verification::Residence.new("date_of_birth(3i)" => "1", "date_of_birth(2i)" => "1", "date_of_birth(1i)" => (5.years.ago.year).to_s) expect(residence).to_not be_valid expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate") end diff --git a/spec/models/spending_proposal_spec.rb b/spec/models/spending_proposal_spec.rb index 8eae58f8b..14d9950b9 100644 --- a/spec/models/spending_proposal_spec.rb +++ b/spec/models/spending_proposal_spec.rb @@ -136,7 +136,7 @@ describe SpendingProposal do let(:spending_proposal) { create(:spending_proposal) } it "returns the proposal id" do - expect(spending_proposal.code).to include("#{spending_proposal.id}") + expect(spending_proposal.code).to include((spending_proposal.id).to_s) end it "returns the administrator id when assigned" do