Fix all Style/UnneededInterpolation rubocop issues and remove from rubocop_tod

This commit is contained in:
Bertocq
2017-07-04 22:44:08 +02:00
parent 9f38192e13
commit 28970c6701
11 changed files with 37 additions and 50 deletions

View File

@@ -524,19 +524,6 @@ Style/SymbolProc:
- 'lib/manager_authenticator.rb' - 'lib/manager_authenticator.rb'
- 'spec/factories.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 # Offense count: 13
# Configuration parameters: SupportedStyles. # Configuration parameters: SupportedStyles.
# SupportedStyles: snake_case, normalcase, non_integer # SupportedStyles: snake_case, normalcase, non_integer

View File

@@ -33,7 +33,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
if save_user if save_user
identity.update(user: @user) identity.update(user: @user)
sign_in_and_redirect @user, event: :authentication 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 else
session["devise.#{provider}_data"] = auth session["devise.#{provider}_data"] = auth
redirect_to new_user_registration_url redirect_to new_user_registration_url

View File

@@ -24,7 +24,7 @@ module Graphqlable
end end
def graphql_type_description def graphql_type_description
"#{self.model_name.human}" (self.model_name.human).to_s
end end
end end

View File

@@ -567,7 +567,7 @@ FactoryGirl.define do
factory :campaign do factory :campaign do
sequence(:name) { |n| "Campaign #{n}" } sequence(:name) { |n| "Campaign #{n}" }
sequence(:track_id) { |n| "#{n}" } sequence(:track_id) { |n| n.to_s }
end end
factory :notification do factory :notification do
@@ -577,8 +577,8 @@ FactoryGirl.define do
factory :geozone do factory :geozone do
sequence(:name) { |n| "District #{n}" } sequence(:name) { |n| "District #{n}" }
sequence(:external_code) { |n| "#{n}" } sequence(:external_code) { |n| n.to_s }
sequence(:census_code) { |n| "#{n}" } sequence(:census_code) { |n| n.to_s }
trait :in_census do trait :in_census do
census_code "01" census_code "01"

View File

@@ -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}" expect(page).to_not have_content (@campaign2.name).to_s
end end
end end

View File

@@ -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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" 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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" 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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" 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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" 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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.document_number}" 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}" 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}" 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

View File

@@ -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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" 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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" expect(page).to have_content (user.document_number).to_s
end end
within(".proposals-list") do within(".proposals-list") do

View File

@@ -23,9 +23,9 @@ feature 'Spending 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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" expect(page).to have_content (user.document_number).to_s
end end
fill_in 'spending_proposal_title', with: 'Build a park in my neighborhood' fill_in 'spending_proposal_title', with: 'Build a park in my neighborhood'
@@ -118,9 +118,9 @@ feature 'Spending 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}" expect(page).to have_content (user.username).to_s
expect(page).to have_content "#{user.email}" expect(page).to have_content (user.email).to_s
expect(page).to have_content "#{user.document_number}" expect(page).to have_content (user.document_number).to_s
end end
within("#investment-projects") do within("#investment-projects") do

View File

@@ -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}") 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

View File

@@ -25,7 +25,7 @@ describe Verification::Residence do
end end
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", "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).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

View File

@@ -136,7 +136,7 @@ describe SpendingProposal do
let(:spending_proposal) { create(:spending_proposal) } let(:spending_proposal) { create(:spending_proposal) }
it "returns the proposal id" do 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 end
it "returns the administrator id when assigned" do it "returns the administrator id when assigned" do