mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
Clean and remove empty lines (#844)
## Description Clean and remove empty lines by Rubocop.
This commit is contained in:
parent
6b3e9bc5c9
commit
157eb95507
12 changed files with 1 additions and 23 deletions
|
@ -48,7 +48,6 @@ module Draper
|
|||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
# Decorates a collection of objects. Used at the end of a scope chain.
|
||||
#
|
||||
# @example
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module Draper
|
||||
# @private
|
||||
class DecoratedAssociation
|
||||
|
||||
def initialize(owner, association, options)
|
||||
options.assert_valid_keys(:with, :scope, :context)
|
||||
|
||||
|
@ -30,6 +29,5 @@ module Draper
|
|||
|
||||
@decorated = factory.decorate(associated, context_args: owner.context)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,6 @@ module Draper
|
|||
# do not have to extend this module directly; it is extended by
|
||||
# {Decorator.decorates_finders}.
|
||||
module Finders
|
||||
|
||||
def find(id, options = {})
|
||||
decorate(object_class.find(id), options)
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@ module Draper
|
|||
# Provides access to helper methods - both Rails built-in helpers, and those
|
||||
# defined in your application.
|
||||
class HelperProxy
|
||||
|
||||
# @overload initialize(view_context)
|
||||
def initialize(view_context)
|
||||
@view_context = view_context
|
||||
|
|
|
@ -3,13 +3,11 @@ module Draper
|
|||
# so that you can stop typing `h.` everywhere, at the cost of mixing in a
|
||||
# bazillion methods.
|
||||
module LazyHelpers
|
||||
|
||||
# Sends missing methods to the {HelperProxy}.
|
||||
def method_missing(method, *args, &block)
|
||||
helpers.send(method, *args, &block)
|
||||
rescue NoMethodError
|
||||
super
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ module Draper
|
|||
object
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.undecorate_chain(object)
|
||||
if object.respond_to?(:decorated?) && object.decorated?
|
||||
undecorate_chain(object.object)
|
||||
|
|
|
@ -2,7 +2,6 @@ module Draper
|
|||
module ViewContext
|
||||
# @private
|
||||
module BuildStrategy
|
||||
|
||||
def self.new(name, &block)
|
||||
const_get(name.to_s.camelize).new(&block)
|
||||
end
|
||||
|
@ -51,7 +50,6 @@ module Draper
|
|||
ActionController::TestRequest.method(:create).parameters.first == [:req, :controller_class]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,6 @@ module Draper
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
module ClassMethods
|
||||
|
||||
# Access the helpers proxy to call built-in and user-defined
|
||||
# Rails helpers from a class context.
|
||||
#
|
||||
|
@ -14,7 +13,6 @@ module Draper
|
|||
Draper::ViewContext.current
|
||||
end
|
||||
alias_method :h, :helpers
|
||||
|
||||
end
|
||||
|
||||
# Access the helpers proxy to call built-in and user-defined
|
||||
|
@ -32,6 +30,5 @@ module Draper
|
|||
helpers.localize(*args)
|
||||
end
|
||||
alias_method :l, :localize
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,6 @@ module Draper
|
|||
|
||||
describe "#initialize" do
|
||||
describe "options validation" do
|
||||
|
||||
it "does not raise error on valid options" do
|
||||
valid_options = {with: Decorator, context: {}}
|
||||
expect{CollectionDecorator.new([], valid_options)}.not_to raise_error
|
||||
|
@ -287,6 +286,5 @@ module Draper
|
|||
expect(decorator.replace([:foo, :bar])).to be decorator
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,6 @@ require 'support/shared_examples/decoratable_equality'
|
|||
|
||||
module Draper
|
||||
describe Decoratable do
|
||||
|
||||
describe "#decorate" do
|
||||
it "returns a decorator for self" do
|
||||
product = Product.new
|
||||
|
@ -232,6 +231,5 @@ module Draper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@ require 'spec_helper'
|
|||
|
||||
module Draper
|
||||
describe DecoratedAssociation do
|
||||
|
||||
describe "#initialize" do
|
||||
it "accepts valid options" do
|
||||
valid_options = {with: Decorator, scope: :foo, context: {}}
|
||||
|
@ -79,6 +78,5 @@ module Draper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@ require 'spec_helper'
|
|||
|
||||
module Draper
|
||||
describe Factory do
|
||||
|
||||
describe "#initialize" do
|
||||
it "accepts valid options" do
|
||||
valid_options = {with: Decorator, context: {foo: "bar"}}
|
||||
|
@ -88,11 +87,9 @@ module Draper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe Factory::Worker do
|
||||
|
||||
describe "#call" do
|
||||
it "calls the decorator method" do
|
||||
object = double
|
||||
|
@ -246,6 +243,5 @@ module Draper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue