Rubocop autocorrections
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -24,6 +24,7 @@ gem 'graphql', '~> 1.6.3'
|
||||
gem 'groupdate', '~> 3.2.0'
|
||||
gem 'initialjs-rails', '~> 0.2.0.5'
|
||||
gem 'invisible_captcha', '~> 0.9.2'
|
||||
gem 'jquery-fileupload-rails'
|
||||
gem 'jquery-rails', '~> 4.3.1'
|
||||
gem 'jquery-ui-rails', '~> 6.0.1'
|
||||
gem 'kaminari', '~> 1.0.1'
|
||||
@@ -33,7 +34,6 @@ gem 'omniauth-facebook', '~> 4.0.0'
|
||||
gem 'omniauth-google-oauth2', '~> 0.4.0'
|
||||
gem 'omniauth-twitter', '~> 1.4.0'
|
||||
gem 'paperclip', '~> 5.1.0'
|
||||
gem 'jquery-fileupload-rails'
|
||||
gem 'paranoia', '~> 2.3.1'
|
||||
gem 'pg', '~> 0.21.0'
|
||||
gem 'pg_search', '~> 2.0.1'
|
||||
|
||||
@@ -7,7 +7,7 @@ class CommunitiesController < ApplicationController
|
||||
skip_authorization_check
|
||||
|
||||
def show
|
||||
redirect_to root_path unless Setting['feature.community'].present?
|
||||
redirect_to root_path if Setting['feature.community'].blank?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class DocumentsController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_filter :find_documentable, except: :destroy
|
||||
before_filter :prepare_new_document, only: [:new, :new_nested]
|
||||
before_filter :prepare_document_for_creation, only: :create
|
||||
before_action :find_documentable, except: :destroy
|
||||
before_action :prepare_new_document, only: [:new, :new_nested]
|
||||
before_action :prepare_document_for_creation, only: :create
|
||||
|
||||
load_and_authorize_resource except: :upload
|
||||
skip_authorization_check only: :upload
|
||||
|
||||
@@ -78,7 +78,7 @@ class ProposalsController < ApplicationController
|
||||
def proposal_params
|
||||
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url,
|
||||
:responsible_name, :tag_list, :terms_of_service, :geozone_id,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id] )
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id])
|
||||
end
|
||||
|
||||
def retired_params
|
||||
|
||||
@@ -18,8 +18,8 @@ module DocumentablesHelper
|
||||
|
||||
def accepted_content_types_extensions(documentable_class)
|
||||
documentable_class.accepted_content_types
|
||||
.collect{ |content_type| ".#{content_type.split("/").last}" }
|
||||
.join(",")
|
||||
.collect{ |content_type| ".#{content_type.split('/').last}" }
|
||||
.join(",")
|
||||
end
|
||||
|
||||
def humanized_accepted_content_types(documentable)
|
||||
|
||||
@@ -80,10 +80,10 @@ module DocumentsHelper
|
||||
|
||||
def document_direct_upload_url(document)
|
||||
upload_documents_url(
|
||||
documentable_type: document.documentable_type,
|
||||
documentable_id: document.documentable_id,
|
||||
format: :js
|
||||
)
|
||||
documentable_type: document.documentable_type,
|
||||
documentable_id: document.documentable_id,
|
||||
format: :js
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@ class Community < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def from_proposal?
|
||||
self.proposal.present?
|
||||
proposal.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -10,7 +10,7 @@ module Documentable
|
||||
|
||||
private
|
||||
|
||||
def documentable(options= {})
|
||||
def documentable(options = {})
|
||||
@max_documents_allowed = options[:max_documents_allowed]
|
||||
@max_file_size = options[:max_file_size]
|
||||
@accepted_content_types = options[:accepted_content_types]
|
||||
|
||||
@@ -40,7 +40,7 @@ class Document < ActiveRecord::Base
|
||||
attachment.instance.prefix(attachment, style)
|
||||
end
|
||||
|
||||
def prefix(attachment, style)
|
||||
def prefix(attachment, _style)
|
||||
if !attachment.instance.persisted?
|
||||
"cached_attachments/user/#{attachment.instance.user_id}"
|
||||
else
|
||||
@@ -75,7 +75,7 @@ class Document < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def remove_cached_document
|
||||
File.delete(cached_attachment) if File.exists?(cached_attachment)
|
||||
File.delete(cached_attachment) if File.exist?(cached_attachment)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Poll
|
||||
class Shift < ActiveRecord::Base
|
||||
belongs_to :booth
|
||||
belongs_to :officer
|
||||
belongs_to :booth
|
||||
belongs_to :officer
|
||||
|
||||
validates :booth_id, presence: true
|
||||
validates :officer_id, presence: true
|
||||
|
||||
@@ -13,6 +13,6 @@ class Topic < ActiveRecord::Base
|
||||
|
||||
scope :sort_by_newest, -> { order(created_at: :desc) }
|
||||
scope :sort_by_oldest, -> { order(created_at: :asc) }
|
||||
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }
|
||||
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }
|
||||
|
||||
end
|
||||
|
||||
@@ -57,13 +57,13 @@ class User < ActiveRecord::Base
|
||||
scope :officials, -> { where("official_level > 0") }
|
||||
scope :newsletter, -> { where(newsletter: true) }
|
||||
scope :for_render, -> { includes(:organization) }
|
||||
scope :by_document, -> (document_type, document_number) { where(document_type: document_type, document_number: document_number) }
|
||||
scope :by_document, ->(document_type, document_number) { where(document_type: document_type, document_number: document_number) }
|
||||
scope :email_digest, -> { where(email_digest: true) }
|
||||
scope :active, -> { where(erased_at: nil) }
|
||||
scope :erased, -> { where.not(erased_at: nil) }
|
||||
scope :public_for_api, -> { all }
|
||||
scope :by_comments, -> (query, topics_ids) { joins(:comments).where(query, topics_ids).uniq }
|
||||
scope :by_authors, -> (author_ids) { where("users.id IN (?)", author_ids) }
|
||||
scope :by_comments, ->(query, topics_ids) { joins(:comments).where(query, topics_ids).uniq }
|
||||
scope :by_authors, ->(author_ids) { where("users.id IN (?)", author_ids) }
|
||||
|
||||
before_validation :clean_document_number
|
||||
|
||||
|
||||
@@ -71,5 +71,4 @@ describe Topic do
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -60,7 +60,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
|
||||
login_as(user)
|
||||
|
||||
visit send(documentable_path, arguments)
|
||||
click_link "Upload document"
|
||||
click_link "Upload document"
|
||||
|
||||
expect(page).to have_selector("h1", text: "Upload document")
|
||||
end
|
||||
|
||||
@@ -11,10 +11,8 @@ shared_examples "nested documentable" do |documentable_factory_name, path, docum
|
||||
before do
|
||||
create(:administrator, user: administrator)
|
||||
|
||||
if documentable_path_arguments
|
||||
documentable_path_arguments.each do |argument_name, path_to_value|
|
||||
documentable_path_arguments&.each do |argument_name, path_to_value|
|
||||
arguments.merge!("#{argument_name}": documentable.send(path_to_value))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -222,7 +220,7 @@ shared_examples "nested documentable" do |documentable_factory_name, path, docum
|
||||
send(fill_resource_method_name) if fill_resource_method_name
|
||||
|
||||
documentable.class.max_documents_allowed.times.each do |index|
|
||||
attach_new_file(documentable_factory_name, index , "spec/fixtures/files/empty.pdf")
|
||||
attach_new_file(documentable_factory_name, index, "spec/fixtures/files/empty.pdf")
|
||||
end
|
||||
|
||||
click_on submit_button
|
||||
|
||||
Reference in New Issue
Block a user