draper/lib/draper
Bruno Castro d44c86f1e5 fix: Don't delegate public methods overridden by a private in the decorator (#849)
Public methods defined on the object was being delegated to the decorator even though it was overridden by a private method.

## Testing
1. Create a simple PORO with a public method
```ruby
class Job
  def location
    Struct.new(:id) { }
  end
end
```

1. Create a decorator and override the public method with a private
```ruby
class JobDecorator < Draper::Decorator
  delegate_all

  private

  def location
    LocationDecorator.new(object.location)
  end
end
```

3. It should raise an exception when calling `.location` from the decorator
```ruby
[9] pry(main)> JobDecorator.decorate(Job.new).location
NoMethodError: private method `location' called for #<JobDecorator:0x0000559f113ba118>
```

## References
* Issue #771
2019-03-18 11:35:29 -05:00
..
compatibility Feature: ActiveJob Integration and Documentation (#817) 2017-09-11 09:35:14 -07:00
decoratable Rename `source` to `object` 2013-04-30 14:10:52 +01:00
query_methods feat: Include ORM associations in CollectionDecorator (#845) 2019-02-25 10:44:19 -06:00
tasks Replace hash rockets with new syntax (#802) 2017-05-08 09:28:07 -05:00
test Remove previously deprecated functionality. (#785) 2017-03-29 10:26:07 -05:00
view_context Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00
automatic_delegation.rb fix: Don't delegate public methods overridden by a private in the decorator (#849) 2019-03-18 11:35:29 -05:00
collection_decorator.rb feat: Include ORM associations in CollectionDecorator (#845) 2019-02-25 10:44:19 -06:00
configuration.rb feat: Include ORM associations in CollectionDecorator (#845) 2019-02-25 10:44:19 -06:00
decoratable.rb Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00
decorated_association.rb Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00
decorates_assigned.rb Revert "Merge pull request #480 from urbanautomaton/decorator-namespace-option" 2013-03-10 09:27:12 +01:00
decorator.rb Let decorator_class infer anonymous class' decorator from superclass (#820) 2017-09-14 07:48:01 -07:00
delegation.rb Rename `source` to `object` 2013-04-30 14:10:52 +01:00
factory.rb Decorate structs as singular objects (and not as collections) 2014-06-03 16:46:22 -04:00
finders.rb Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00
helper_proxy.rb Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00
helper_support.rb add new lines 😓 2012-04-25 23:12:30 +03:00
lazy_helpers.rb Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00
query_methods.rb fix: Make CollectionDecorator respond_to? to ORM methods (#850) 2019-03-16 14:15:16 -05:00
railtie.rb Add support for custom default controller configuration (#788) 2017-03-31 09:05:15 -05:00
test_case.rb Move view context clear to before_setup (minitest) (#839) 2019-01-07 08:27:05 -06:00
undecorate.rb Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00
version.rb Release v3.1.0 (#848) 2019-03-14 12:42:09 -05:00
view_context.rb Clean view context when controller changes (#799) 2017-05-08 09:23:13 -05:00
view_helpers.rb Clean and remove empty lines (#844) 2019-02-25 12:22:28 -06:00