Merge pull request #1768 from consul/rubocop/fix
Rubocop autocorrections 🤖
This commit is contained in:
@@ -440,6 +440,8 @@ Style/AccessorMethodName:
|
||||
Style/BracesAroundHashParameters:
|
||||
Exclude:
|
||||
- 'app/models/concerns/searchable.rb'
|
||||
- 'spec/features/budgets/investments_spec.rb'
|
||||
- 'spec/features/proposals_spec.rb'
|
||||
|
||||
# Offense count: 119
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
|
||||
@@ -20,7 +20,7 @@ module FollowablesHelper
|
||||
end
|
||||
|
||||
def followable_class_name(followable)
|
||||
followable.class.to_s.parameterize.gsub('-', '_')
|
||||
followable.class.to_s.parameterize('_')
|
||||
end
|
||||
|
||||
def find_or_build_follow(user, followable)
|
||||
|
||||
@@ -5,5 +5,4 @@ class Follow < ActiveRecord::Base
|
||||
validates :user_id, presence: true
|
||||
validates :followable_id, presence: true
|
||||
validates :followable_type, presence: true
|
||||
|
||||
end
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
require 'http'
|
||||
|
||||
API_ENDPOINT = 'https://decide.madrid.es/graphql'
|
||||
API_ENDPOINT = 'https://decide.madrid.es/graphql'.freeze
|
||||
|
||||
def make_request(query_string)
|
||||
HTTP.headers('User-Agent' => 'Mozilla/5.0', accept: 'application/json')
|
||||
.get(
|
||||
API_ENDPOINT,
|
||||
params: { query: query_string.gsub("\n", '').gsub(" ", '') }
|
||||
params: { query: query_string.delete("\n").delete(" ") }
|
||||
)
|
||||
end
|
||||
|
||||
query = """
|
||||
query = <<-GRAPHQL
|
||||
{
|
||||
proposal(id: 1) {
|
||||
id,
|
||||
@@ -18,7 +18,7 @@ query = """
|
||||
public_created_at
|
||||
}
|
||||
}
|
||||
"""
|
||||
GRAPHQL
|
||||
|
||||
response = make_request(query)
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
require 'http'
|
||||
|
||||
API_ENDPOINT = 'https://decide.madrid.es/graphql'
|
||||
API_ENDPOINT = 'https://decide.madrid.es/graphql'.freeze
|
||||
|
||||
def make_request(query_string)
|
||||
HTTP.headers('User-Agent' => 'Mozilla/5.0', accept: 'application/json')
|
||||
.get(
|
||||
API_ENDPOINT,
|
||||
params: { query: query_string.gsub("\n", '').gsub(" ", '') }
|
||||
params: { query: query_string.delete("\n").delete(" ") }
|
||||
)
|
||||
end
|
||||
|
||||
@@ -15,9 +15,9 @@ def build_query(options = {})
|
||||
page_size_parameter = "first: #{page_size}"
|
||||
|
||||
page_number = options[:page_number] || 0
|
||||
after_parameter = page_number > 0 ? ", after: \"#{options[:next_cursor]}\"" : ""
|
||||
after_parameter = page_number.positive? ? ", after: \"#{options[:next_cursor]}\"" : ""
|
||||
|
||||
"""
|
||||
<<-GRAPHQL
|
||||
{
|
||||
proposals(#{page_size_parameter}#{after_parameter}) {
|
||||
pageInfo {
|
||||
@@ -33,7 +33,7 @@ def build_query(options = {})
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
GRAPHQL
|
||||
end
|
||||
|
||||
page_number = 0
|
||||
@@ -61,5 +61,5 @@ loop do
|
||||
|
||||
page_number += 1
|
||||
|
||||
break if !has_next_page
|
||||
break unless has_next_page
|
||||
end
|
||||
@@ -28,7 +28,9 @@ class LocalCensus
|
||||
end
|
||||
|
||||
def district_code
|
||||
@body.district_code rescue nil
|
||||
@body.district_code
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
def gender
|
||||
@@ -43,7 +45,9 @@ class LocalCensus
|
||||
end
|
||||
|
||||
def name
|
||||
"#{@body.nombre} #{@body.apellido1}" rescue nil
|
||||
"#{@body.nombre} #{@body.apellido1}"
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,7 +5,7 @@ describe CensusCaller do
|
||||
|
||||
describe '#call' do
|
||||
it "returns data from local_census_records if census API is not available" do
|
||||
census_api_response = CensusApi::Response.new({:get_habita_datos_response=>{:get_habita_datos_return=>{:datos_habitante=>{}, :datos_vivienda=>{}}}})
|
||||
census_api_response = CensusApi::Response.new(get_habita_datos_response: {get_habita_datos_return: {datos_habitante: {}, datos_vivienda: {}}})
|
||||
local_census_response = LocalCensus::Response.new(create(:local_census_record))
|
||||
|
||||
CensusApi.any_instance.stub(:call).and_return(census_api_response)
|
||||
@@ -20,7 +20,7 @@ describe CensusCaller do
|
||||
end
|
||||
|
||||
it "returns data from census API if it's available and valid" do
|
||||
census_api_response = CensusApi::Response.new({get_habita_datos_response: {get_habita_datos_return: {datos_habitante: {item: {fecha_nacimiento_string: "1-1-1980"}}}}})
|
||||
census_api_response = CensusApi::Response.new(get_habita_datos_response: {get_habita_datos_return: {datos_habitante: {item: {fecha_nacimiento_string: "1-1-1980"}}}})
|
||||
local_census_response = LocalCensus::Response.new(create(:local_census_record))
|
||||
|
||||
CensusApi.any_instance.stub(:call).and_return(census_api_response)
|
||||
|
||||
@@ -3,7 +3,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
|
||||
let!(:arguments) { {} }
|
||||
let!(:followable) { create(followable_class_name) }
|
||||
let!(:followable_dom_name) { followable_class_name.gsub('_', '-') }
|
||||
let!(:followable_dom_name) { followable_class_name.tr('_', '-') }
|
||||
|
||||
before do
|
||||
followable_path_arguments.each do |argument_name, path_to_value|
|
||||
|
||||
Reference in New Issue
Block a user