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 'groupdate', '~> 3.2.0'
|
||||||
gem 'initialjs-rails', '~> 0.2.0.5'
|
gem 'initialjs-rails', '~> 0.2.0.5'
|
||||||
gem 'invisible_captcha', '~> 0.9.2'
|
gem 'invisible_captcha', '~> 0.9.2'
|
||||||
|
gem 'jquery-fileupload-rails'
|
||||||
gem 'jquery-rails', '~> 4.3.1'
|
gem 'jquery-rails', '~> 4.3.1'
|
||||||
gem 'jquery-ui-rails', '~> 6.0.1'
|
gem 'jquery-ui-rails', '~> 6.0.1'
|
||||||
gem 'kaminari', '~> 1.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-google-oauth2', '~> 0.4.0'
|
||||||
gem 'omniauth-twitter', '~> 1.4.0'
|
gem 'omniauth-twitter', '~> 1.4.0'
|
||||||
gem 'paperclip', '~> 5.1.0'
|
gem 'paperclip', '~> 5.1.0'
|
||||||
gem 'jquery-fileupload-rails'
|
|
||||||
gem 'paranoia', '~> 2.3.1'
|
gem 'paranoia', '~> 2.3.1'
|
||||||
gem 'pg', '~> 0.21.0'
|
gem 'pg', '~> 0.21.0'
|
||||||
gem 'pg_search', '~> 2.0.1'
|
gem 'pg_search', '~> 2.0.1'
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class CommunitiesController < ApplicationController
|
|||||||
skip_authorization_check
|
skip_authorization_check
|
||||||
|
|
||||||
def show
|
def show
|
||||||
redirect_to root_path unless Setting['feature.community'].present?
|
redirect_to root_path if Setting['feature.community'].blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
class DocumentsController < ApplicationController
|
class DocumentsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_filter :find_documentable, except: :destroy
|
before_action :find_documentable, except: :destroy
|
||||||
before_filter :prepare_new_document, only: [:new, :new_nested]
|
before_action :prepare_new_document, only: [:new, :new_nested]
|
||||||
before_filter :prepare_document_for_creation, only: :create
|
before_action :prepare_document_for_creation, only: :create
|
||||||
|
|
||||||
load_and_authorize_resource except: :upload
|
load_and_authorize_resource except: :upload
|
||||||
skip_authorization_check only: :upload
|
skip_authorization_check only: :upload
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class ProposalsController < ApplicationController
|
|||||||
def proposal_params
|
def proposal_params
|
||||||
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url,
|
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url,
|
||||||
:responsible_name, :tag_list, :terms_of_service, :geozone_id,
|
: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
|
end
|
||||||
|
|
||||||
def retired_params
|
def retired_params
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module DocumentablesHelper
|
|||||||
|
|
||||||
def accepted_content_types_extensions(documentable_class)
|
def accepted_content_types_extensions(documentable_class)
|
||||||
documentable_class.accepted_content_types
|
documentable_class.accepted_content_types
|
||||||
.collect{ |content_type| ".#{content_type.split("/").last}" }
|
.collect{ |content_type| ".#{content_type.split('/').last}" }
|
||||||
.join(",")
|
.join(",")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Community < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def from_proposal?
|
def from_proposal?
|
||||||
self.proposal.present?
|
proposal.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ module Documentable
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def documentable(options= {})
|
def documentable(options = {})
|
||||||
@max_documents_allowed = options[:max_documents_allowed]
|
@max_documents_allowed = options[:max_documents_allowed]
|
||||||
@max_file_size = options[:max_file_size]
|
@max_file_size = options[:max_file_size]
|
||||||
@accepted_content_types = options[:accepted_content_types]
|
@accepted_content_types = options[:accepted_content_types]
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Document < ActiveRecord::Base
|
|||||||
attachment.instance.prefix(attachment, style)
|
attachment.instance.prefix(attachment, style)
|
||||||
end
|
end
|
||||||
|
|
||||||
def prefix(attachment, style)
|
def prefix(attachment, _style)
|
||||||
if !attachment.instance.persisted?
|
if !attachment.instance.persisted?
|
||||||
"cached_attachments/user/#{attachment.instance.user_id}"
|
"cached_attachments/user/#{attachment.instance.user_id}"
|
||||||
else
|
else
|
||||||
@@ -75,7 +75,7 @@ class Document < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def remove_cached_document
|
def remove_cached_document
|
||||||
File.delete(cached_attachment) if File.exists?(cached_attachment)
|
File.delete(cached_attachment) if File.exist?(cached_attachment)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ class User < ActiveRecord::Base
|
|||||||
scope :officials, -> { where("official_level > 0") }
|
scope :officials, -> { where("official_level > 0") }
|
||||||
scope :newsletter, -> { where(newsletter: true) }
|
scope :newsletter, -> { where(newsletter: true) }
|
||||||
scope :for_render, -> { includes(:organization) }
|
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 :email_digest, -> { where(email_digest: true) }
|
||||||
scope :active, -> { where(erased_at: nil) }
|
scope :active, -> { where(erased_at: nil) }
|
||||||
scope :erased, -> { where.not(erased_at: nil) }
|
scope :erased, -> { where.not(erased_at: nil) }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
scope :by_comments, -> (query, topics_ids) { joins(:comments).where(query, topics_ids).uniq }
|
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_authors, ->(author_ids) { where("users.id IN (?)", author_ids) }
|
||||||
|
|
||||||
before_validation :clean_document_number
|
before_validation :clean_document_number
|
||||||
|
|
||||||
|
|||||||
@@ -71,5 +71,4 @@ describe Topic do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ shared_examples "nested documentable" do |documentable_factory_name, path, docum
|
|||||||
before do
|
before do
|
||||||
create(:administrator, user: administrator)
|
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))
|
arguments.merge!("#{argument_name}": documentable.send(path_to_value))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
describe "at #{path}" do
|
describe "at #{path}" do
|
||||||
|
|
||||||
@@ -222,7 +220,7 @@ shared_examples "nested documentable" do |documentable_factory_name, path, docum
|
|||||||
send(fill_resource_method_name) if fill_resource_method_name
|
send(fill_resource_method_name) if fill_resource_method_name
|
||||||
|
|
||||||
documentable.class.max_documents_allowed.times.each do |index|
|
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
|
end
|
||||||
|
|
||||||
click_on submit_button
|
click_on submit_button
|
||||||
|
|||||||
Reference in New Issue
Block a user