Rubocop autocorrections

This commit is contained in:
Bertocq
2017-09-14 13:18:37 +02:00
parent 93323cb917
commit e4e78c8f16
25 changed files with 53 additions and 56 deletions

View File

@@ -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'

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -71,5 +71,4 @@ describe Topic do
end end
end end

View File

@@ -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