draper 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.codeclimate.yml +16 -0
 - data/.github/PULL_REQUEST_TEMPLATE.md +24 -0
 - data/.gitignore +3 -1
 - data/.rubocop.yml +11 -0
 - data/.travis.yml +3 -7
 - data/CHANGELOG.md +26 -0
 - data/Gemfile +4 -5
 - data/Guardfile +5 -5
 - data/README.md +61 -11
 - data/Rakefile +1 -1
 - data/draper.gemspec +12 -10
 - data/lib/draper.rb +8 -3
 - data/lib/draper/automatic_delegation.rb +5 -3
 - data/lib/draper/collection_decorator.rb +1 -11
 - data/lib/draper/compatibility/api_only.rb +23 -0
 - data/lib/draper/configuration.rb +15 -0
 - data/lib/draper/decoratable.rb +3 -4
 - data/lib/draper/decorator.rb +4 -24
 - data/lib/draper/finders.rb +0 -0
 - data/lib/draper/helper_proxy.rb +1 -8
 - data/lib/draper/railtie.rb +12 -21
 - data/lib/draper/tasks/test.rake +2 -15
 - data/lib/draper/test/devise_helper.rb +1 -8
 - data/lib/draper/test/minitest_integration.rb +0 -0
 - data/lib/draper/test/rspec_integration.rb +1 -5
 - data/lib/draper/test_case.rb +4 -8
 - data/lib/draper/undecorate.rb +8 -0
 - data/lib/draper/version.rb +1 -1
 - data/lib/draper/view_context.rb +3 -19
 - data/lib/draper/view_context/build_strategy.rb +11 -2
 - data/lib/generators/controller_override.rb +2 -2
 - data/lib/generators/draper/install_generator.rb +14 -0
 - data/lib/generators/draper/templates/application_decorator.rb +8 -0
 - data/lib/generators/mini_test/decorator_generator.rb +1 -1
 - data/lib/generators/rails/decorator_generator.rb +1 -8
 - data/lib/generators/rspec/templates/decorator_spec.rb +2 -2
 - data/spec/draper/collection_decorator_spec.rb +11 -26
 - data/spec/draper/configuration_spec.rb +25 -0
 - data/spec/draper/decoratable_spec.rb +29 -16
 - data/spec/draper/decorated_association_spec.rb +9 -9
 - data/spec/draper/decorates_assigned_spec.rb +6 -6
 - data/spec/draper/decorator_spec.rb +112 -89
 - data/spec/draper/draper_spec.rb +24 -0
 - data/spec/draper/factory_spec.rb +26 -26
 - data/spec/draper/finders_spec.rb +21 -21
 - data/spec/draper/helper_proxy_spec.rb +3 -3
 - data/spec/draper/lazy_helpers_spec.rb +2 -2
 - data/spec/draper/undecorate_chain_spec.rb +20 -0
 - data/spec/draper/view_context/build_strategy_spec.rb +26 -10
 - data/spec/draper/view_context_spec.rb +49 -21
 - data/spec/dummy/app/controllers/base_controller.rb +4 -0
 - data/spec/dummy/app/controllers/posts_controller.rb +2 -2
 - data/spec/dummy/app/decorators/post_decorator.rb +0 -0
 - data/spec/dummy/app/views/posts/_post.html.erb +8 -6
 - data/spec/dummy/config/boot.rb +1 -1
 - data/spec/dummy/config/initializers/draper.rb +3 -0
 - data/spec/dummy/config/mongoid.yml +104 -41
 - data/spec/dummy/db/schema.rb +4 -4
 - data/spec/dummy/fast_spec/post_decorator_spec.rb +1 -1
 - data/spec/dummy/lib/tasks/test.rake +1 -1
 - data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +4 -8
 - data/spec/dummy/spec/decorators/devise_spec.rb +0 -9
 - data/spec/dummy/spec/decorators/post_decorator_spec.rb +2 -4
 - data/spec/dummy/spec/mailers/post_mailer_spec.rb +0 -8
 - data/spec/dummy/spec/shared_examples/decoratable.rb +0 -2
 - data/spec/dummy/test/decorators/minitest/devise_test.rb +0 -9
 - data/spec/dummy/test/decorators/minitest/view_context_test.rb +3 -3
 - data/spec/dummy/test/decorators/test_unit/devise_test.rb +0 -9
 - data/spec/dummy/test/decorators/test_unit/view_context_test.rb +1 -1
 - data/spec/generators/controller/controller_generator_spec.rb +3 -3
 - data/spec/generators/decorator/decorator_generator_spec.rb +14 -12
 - data/spec/generators/install/install_generator_spec.rb +19 -0
 - data/spec/integration/integration_spec.rb +11 -8
 - data/spec/performance/benchmark.rb +1 -1
 - data/spec/spec_helper.rb +4 -4
 - data/spec/support/matchers/have_text.rb +2 -2
 - data/spec/support/shared_examples/view_helpers.rb +8 -8
 - metadata +71 -29
 - data/gemfiles/4.0.gemfile +0 -3
 - data/gemfiles/4.1.gemfile +0 -3
 - data/gemfiles/4.2.gemfile +0 -3
 - data/spec/dummy/app/controllers/application_controller.rb +0 -4
 
| 
         @@ -51,14 +51,5 @@ if defined?(Devise) 
     | 
|
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                  expect(helper.current_user).to be_nil
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                it "is backwards-compatible" do
         
     | 
| 
       56 
     | 
    
         
            -
                  user = double("User")
         
     | 
| 
       57 
     | 
    
         
            -
                  ActiveSupport::Deprecation.silence do
         
     | 
| 
       58 
     | 
    
         
            -
                    sign_in user
         
     | 
| 
       59 
     | 
    
         
            -
                  end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                  expect(helper.current_user).to be user
         
     | 
| 
       62 
     | 
    
         
            -
                end
         
     | 
| 
       63 
54 
     | 
    
         
             
              end
         
     | 
| 
       64 
55 
     | 
    
         
             
            end
         
     | 
| 
         @@ -54,13 +54,11 @@ describe PostDecorator do 
     | 
|
| 
       54 
54 
     | 
    
         
             
              end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
              it "serializes to XML" do
         
     | 
| 
       57 
     | 
    
         
            -
                pending("Rails < 3.2 does not use `serializable_hash` in `to_xml`") if Rails.version.to_f < 3.2
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
57 
     | 
    
         
             
                xml = Capybara.string(decorator.to_xml)
         
     | 
| 
       60 
58 
     | 
    
         
             
                expect(xml).to have_css "post > updated-at", text: "overridden"
         
     | 
| 
       61 
59 
     | 
    
         
             
              end
         
     | 
| 
       62 
60 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
              it "uses a test view context from  
     | 
| 
       64 
     | 
    
         
            -
                expect(Draper::ViewContext.current.controller).to be_an  
     | 
| 
      
 61 
     | 
    
         
            +
              it "uses a test view context from BaseController" do
         
     | 
| 
      
 62 
     | 
    
         
            +
                expect(Draper::ViewContext.current.controller).to be_an BaseController
         
     | 
| 
       65 
63 
     | 
    
         
             
              end
         
     | 
| 
       66 
64 
     | 
    
         
             
            end
         
     | 
| 
         @@ -10,14 +10,6 @@ describe PostMailer do 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  expect(email_body).to have_content "Today"
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                it "can use path helpers with a model" do
         
     | 
| 
       14 
     | 
    
         
            -
                  expect(email_body).to have_css "#path_with_model", text: "/en/posts/#{post.id}"
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                it "can use path helpers with an id" do
         
     | 
| 
       18 
     | 
    
         
            -
                  expect(email_body).to have_css "#path_with_id", text: "/en/posts/#{post.id}"
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
13 
     | 
    
         
             
                it "can use url helpers with a model" do
         
     | 
| 
       22 
14 
     | 
    
         
             
                  expect(email_body).to have_css "#url_with_model", text: "http://www.example.com:12345/en/posts/#{post.id}"
         
     | 
| 
       23 
15 
     | 
    
         
             
                end
         
     | 
| 
         @@ -11,8 +11,6 @@ shared_examples_for "a decoratable model" do 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              describe "#==" do
         
     | 
| 
       13 
13 
     | 
    
         
             
                it "is true for other instances' decorators" do
         
     | 
| 
       14 
     | 
    
         
            -
                  pending "Mongoid < 3.1 overrides `#==`" if defined?(Mongoid) && Mongoid::VERSION.to_f < 3.1 && described_class < Mongoid::Document
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
14 
     | 
    
         
             
                  described_class.create
         
     | 
| 
       17 
15 
     | 
    
         
             
                  one = described_class.first
         
     | 
| 
       18 
16 
     | 
    
         
             
                  other = described_class.first
         
     | 
| 
         @@ -51,14 +51,5 @@ if defined?(Devise) 
     | 
|
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                  assert helper.current_user.nil?
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                it "is backwards-compatible" do
         
     | 
| 
       56 
     | 
    
         
            -
                  user = Object.new
         
     | 
| 
       57 
     | 
    
         
            -
                  ActiveSupport::Deprecation.silence do
         
     | 
| 
       58 
     | 
    
         
            -
                    sign_in user
         
     | 
| 
       59 
     | 
    
         
            -
                  end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                  assert_same user, helper.current_user
         
     | 
| 
       62 
     | 
    
         
            -
                end
         
     | 
| 
       63 
54 
     | 
    
         
             
              end
         
     | 
| 
       64 
55 
     | 
    
         
             
            end
         
     | 
| 
         @@ -13,12 +13,12 @@ describe "A decorator test" do 
     | 
|
| 
       13 
13 
     | 
    
         
             
              it_does_not_leak_view_context
         
     | 
| 
       14 
14 
     | 
    
         
             
            end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
            describe "A controller test" do
         
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
      
 16 
     | 
    
         
            +
            describe "A controller decorator test" do
         
     | 
| 
      
 17 
     | 
    
         
            +
              subject { Class.new(ActionController::Base) }
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              it_does_not_leak_view_context
         
     | 
| 
       20 
20 
     | 
    
         
             
            end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
            describe "A mailer test" do
         
     | 
| 
      
 22 
     | 
    
         
            +
            describe "A mailer decorator test" do
         
     | 
| 
       23 
23 
     | 
    
         
             
              it_does_not_leak_view_context
         
     | 
| 
       24 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -51,14 +51,5 @@ if defined?(Devise) 
     | 
|
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                  assert helper.current_user.nil?
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                def test_backwards_compatibility
         
     | 
| 
       56 
     | 
    
         
            -
                  user = Object.new
         
     | 
| 
       57 
     | 
    
         
            -
                  ActiveSupport::Deprecation.silence do
         
     | 
| 
       58 
     | 
    
         
            -
                    sign_in user
         
     | 
| 
       59 
     | 
    
         
            -
                  end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                  assert_same user, helper.current_user
         
     | 
| 
       62 
     | 
    
         
            -
                end
         
     | 
| 
       63 
54 
     | 
    
         
             
              end
         
     | 
| 
       64 
55 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            require ' 
     | 
| 
      
 2 
     | 
    
         
            +
            require 'dummy/config/environment'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'ammeter/init'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'generators/controller_override'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'generators/rails/decorator_generator'
         
     | 
| 
         @@ -16,7 +16,7 @@ describe Rails::Generators::ControllerGenerator do 
     | 
|
| 
       16 
16 
     | 
    
         
             
                describe "naming" do
         
     | 
| 
       17 
17 
     | 
    
         
             
                  before { run_generator %w(YourModels) }
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                  it {  
     | 
| 
      
 19 
     | 
    
         
            +
                  it { is_expected.to contain "class YourModelDecorator" }
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
     | 
    
         
            -
            end
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            require ' 
     | 
| 
      
 2 
     | 
    
         
            +
            require 'dummy/config/environment'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'ammeter/init'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'generators/rails/decorator_generator'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
         @@ -15,38 +15,40 @@ describe Rails::Generators::DecoratorGenerator do 
     | 
|
| 
       15 
15 
     | 
    
         
             
                describe "naming" do
         
     | 
| 
       16 
16 
     | 
    
         
             
                  before { run_generator %w(YourModel) }
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                  it {  
     | 
| 
      
 18 
     | 
    
         
            +
                  it { is_expected.to contain "class YourModelDecorator" }
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                describe "namespacing" do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  subject { file("app/decorators/namespace/your_model_decorator.rb") }
         
     | 
| 
       23 
23 
     | 
    
         
             
                  before { run_generator %w(Namespace::YourModel) }
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                  it {  
     | 
| 
      
 25 
     | 
    
         
            +
                  it { is_expected.to contain "class Namespace::YourModelDecorator" }
         
     | 
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                describe "inheritance" do
         
     | 
| 
       29 
29 
     | 
    
         
             
                  context "by default" do
         
     | 
| 
       30 
30 
     | 
    
         
             
                    before { run_generator %w(YourModel) }
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                    it {  
     | 
| 
      
 32 
     | 
    
         
            +
                    it { is_expected.to contain "class YourModelDecorator < Draper::Decorator" }
         
     | 
| 
       33 
33 
     | 
    
         
             
                  end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                  context "with the --parent option" do
         
     | 
| 
       36 
36 
     | 
    
         
             
                    before { run_generator %w(YourModel --parent=FooDecorator) }
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                    it {  
     | 
| 
      
 38 
     | 
    
         
            +
                    it { is_expected.to contain "class YourModelDecorator < FooDecorator" }
         
     | 
| 
       39 
39 
     | 
    
         
             
                  end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                  context "with an ApplicationDecorator" do
         
     | 
| 
       42 
42 
     | 
    
         
             
                    before do
         
     | 
| 
       43 
     | 
    
         
            -
                      Object. 
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 43 
     | 
    
         
            +
                      allow_any_instance_of(Object).to receive(:require)
         
     | 
| 
      
 44 
     | 
    
         
            +
                      allow_any_instance_of(Object).to receive(:require).with("application_decorator").and_return(
         
     | 
| 
      
 45 
     | 
    
         
            +
                        stub_const "ApplicationDecorator", Class.new
         
     | 
| 
      
 46 
     | 
    
         
            +
                      )
         
     | 
| 
       45 
47 
     | 
    
         
             
                    end
         
     | 
| 
       46 
48 
     | 
    
         | 
| 
       47 
49 
     | 
    
         
             
                    before { run_generator %w(YourModel) }
         
     | 
| 
       48 
50 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                    it {  
     | 
| 
      
 51 
     | 
    
         
            +
                    it { is_expected.to contain "class YourModelDecorator < ApplicationDecorator" }
         
     | 
| 
       50 
52 
     | 
    
         
             
                  end
         
     | 
| 
       51 
53 
     | 
    
         
             
                end
         
     | 
| 
       52 
54 
     | 
    
         
             
              end
         
     | 
| 
         @@ -58,14 +60,14 @@ describe Rails::Generators::DecoratorGenerator do 
     | 
|
| 
       58 
60 
     | 
    
         
             
                  describe "naming" do
         
     | 
| 
       59 
61 
     | 
    
         
             
                    before { run_generator %w(YourModel -t=rspec) }
         
     | 
| 
       60 
62 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                    it {  
     | 
| 
      
 63 
     | 
    
         
            +
                    it { is_expected.to contain "describe YourModelDecorator" }
         
     | 
| 
       62 
64 
     | 
    
         
             
                  end
         
     | 
| 
       63 
65 
     | 
    
         | 
| 
       64 
66 
     | 
    
         
             
                  describe "namespacing" do
         
     | 
| 
       65 
67 
     | 
    
         
             
                    subject { file("spec/decorators/namespace/your_model_decorator_spec.rb") }
         
     | 
| 
       66 
68 
     | 
    
         
             
                    before { run_generator %w(Namespace::YourModel -t=rspec) }
         
     | 
| 
       67 
69 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                    it {  
     | 
| 
      
 70 
     | 
    
         
            +
                    it { is_expected.to contain "describe Namespace::YourModelDecorator" }
         
     | 
| 
       69 
71 
     | 
    
         
             
                  end
         
     | 
| 
       70 
72 
     | 
    
         
             
                end
         
     | 
| 
       71 
73 
     | 
    
         
             
              end
         
     | 
| 
         @@ -77,14 +79,14 @@ describe Rails::Generators::DecoratorGenerator do 
     | 
|
| 
       77 
79 
     | 
    
         
             
                  describe "naming" do
         
     | 
| 
       78 
80 
     | 
    
         
             
                    before { run_generator %w(YourModel -t=test_unit) }
         
     | 
| 
       79 
81 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
                    it {  
     | 
| 
      
 82 
     | 
    
         
            +
                    it { is_expected.to contain "class YourModelDecoratorTest < Draper::TestCase" }
         
     | 
| 
       81 
83 
     | 
    
         
             
                  end
         
     | 
| 
       82 
84 
     | 
    
         | 
| 
       83 
85 
     | 
    
         
             
                  describe "namespacing" do
         
     | 
| 
       84 
86 
     | 
    
         
             
                    subject { file("test/decorators/namespace/your_model_decorator_test.rb") }
         
     | 
| 
       85 
87 
     | 
    
         
             
                    before { run_generator %w(Namespace::YourModel -t=test_unit) }
         
     | 
| 
       86 
88 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
                    it {  
     | 
| 
      
 89 
     | 
    
         
            +
                    it { is_expected.to contain "class Namespace::YourModelDecoratorTest < Draper::TestCase" }
         
     | 
| 
       88 
90 
     | 
    
         
             
                  end
         
     | 
| 
       89 
91 
     | 
    
         
             
                end
         
     | 
| 
       90 
92 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'dummy/config/environment'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'ammeter/init'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'generators/draper/install_generator'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            describe Draper::Generators::InstallGenerator do
         
     | 
| 
      
 7 
     | 
    
         
            +
              destination File.expand_path('../tmp', __FILE__)
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              before { prepare_destination }
         
     | 
| 
      
 10 
     | 
    
         
            +
              after(:all) { FileUtils.rm_rf destination_root }
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              describe 'the application decorator' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                subject { file('app/decorators/application_decorator.rb') }
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                before { run_generator }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                it { is_expected.to contain 'class ApplicationDecorator' }
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -38,16 +38,19 @@ app.start_server do 
     | 
|
| 
       38 
38 
     | 
    
         
             
                    expect(page).to have_text("Goodnight, moon!").in("#goodnight_moon")
         
     | 
| 
       39 
39 
     | 
    
         
             
                  end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                   
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
                  # _path helpers aren't available in mailers
         
     | 
| 
      
 42 
     | 
    
         
            +
                  if type == :view
         
     | 
| 
      
 43 
     | 
    
         
            +
                    it "can be passed to path helpers" do
         
     | 
| 
      
 44 
     | 
    
         
            +
                      expect(page).to have_text("/en/posts/1").in("#path_with_decorator")
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
       44 
46 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
                    it "can use path helpers with a model" do
         
     | 
| 
      
 48 
     | 
    
         
            +
                      expect(page).to have_text("/en/posts/1").in("#path_with_model")
         
     | 
| 
      
 49 
     | 
    
         
            +
                    end
         
     | 
| 
       48 
50 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
                    it "can use path helpers with an id" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                      expect(page).to have_text("/en/posts/1").in("#path_with_id")
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
       51 
54 
     | 
    
         
             
                  end
         
     | 
| 
       52 
55 
     | 
    
         | 
| 
       53 
56 
     | 
    
         
             
                  it "can be passed to url helpers" do
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'rubygems'
         
     | 
| 
       2 
2 
     | 
    
         
             
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
         
     | 
| 
       4 
     | 
    
         
            -
            Bundler.require 
     | 
| 
      
 4 
     | 
    
         
            +
            Bundler.require :default
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            require "benchmark"
         
     | 
| 
       7 
7 
     | 
    
         
             
            require "draper"
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -1,6 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'bundler/setup'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'draper'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'rails/version'
         
     | 
| 
       4 
3 
     | 
    
         
             
            require 'action_controller'
         
     | 
| 
       5 
4 
     | 
    
         
             
            require 'action_controller/test_case'
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
         @@ -20,17 +19,18 @@ class Other < Model; end 
     | 
|
| 
       20 
19 
     | 
    
         
             
            class ProductDecorator < Draper::Decorator; end
         
     | 
| 
       21 
20 
     | 
    
         
             
            class ProductsDecorator < Draper::CollectionDecorator; end
         
     | 
| 
       22 
21 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
            class ProductPresenter < Draper::Decorator; end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
22 
     | 
    
         
             
            class OtherDecorator < Draper::Decorator; end
         
     | 
| 
       26 
23 
     | 
    
         | 
| 
       27 
24 
     | 
    
         
             
            module Namespaced
         
     | 
| 
       28 
25 
     | 
    
         
             
              class Product < Model; end
         
     | 
| 
       29 
26 
     | 
    
         
             
              class ProductDecorator < Draper::Decorator; end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 27 
     | 
    
         
            +
              ProductsDecorator = Class.new(Draper::CollectionDecorator)
         
     | 
| 
       31 
28 
     | 
    
         
             
              class OtherDecorator < Draper::Decorator; end
         
     | 
| 
       32 
29 
     | 
    
         
             
            end
         
     | 
| 
       33 
30 
     | 
    
         | 
| 
      
 31 
     | 
    
         
            +
            ApplicationController = Class.new(ActionController::Base)
         
     | 
| 
      
 32 
     | 
    
         
            +
            CustomController = Class.new(ActionController::Base)
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       34 
34 
     | 
    
         
             
            # After each example, revert changes made to the class
         
     | 
| 
       35 
35 
     | 
    
         
             
            def protect_class(klass)
         
     | 
| 
       36 
36 
     | 
    
         
             
              before { stub_const klass.name, Class.new(klass) }
         
     | 
| 
         @@ -21,11 +21,11 @@ module HaveTextMatcher 
     | 
|
| 
       21 
21 
     | 
    
         
             
                  @subject.has_css?(@css || "*", text: @text)
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                def  
     | 
| 
      
 24 
     | 
    
         
            +
                def failure_message
         
     | 
| 
       25 
25 
     | 
    
         
             
                  "expected to find #{@text.inspect} #{within}"
         
     | 
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                def  
     | 
| 
      
 28 
     | 
    
         
            +
                def failure_message_when_negated
         
     | 
| 
       29 
29 
     | 
    
         
             
                  "expected not to find #{@text.inspect} #{within}"
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
         @@ -1,38 +1,38 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            shared_examples_for "view helpers" do |subject|
         
     | 
| 
       2 
2 
     | 
    
         
             
              describe "#helpers" do
         
     | 
| 
       3 
3 
     | 
    
         
             
                it "returns the current view context" do
         
     | 
| 
       4 
     | 
    
         
            -
                  Draper::ViewContext. 
     | 
| 
      
 4 
     | 
    
         
            +
                  allow(Draper::ViewContext).to receive_messages current: :current_view_context
         
     | 
| 
       5 
5 
     | 
    
         
             
                  expect(subject.helpers).to be :current_view_context
         
     | 
| 
       6 
6 
     | 
    
         
             
                end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                it "is aliased to #h" do
         
     | 
| 
       9 
     | 
    
         
            -
                  Draper::ViewContext. 
     | 
| 
      
 9 
     | 
    
         
            +
                  allow(Draper::ViewContext).to receive_messages current: :current_view_context
         
     | 
| 
       10 
10 
     | 
    
         
             
                  expect(subject.h).to be :current_view_context
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              describe "#localize" do
         
     | 
| 
       15 
15 
     | 
    
         
             
                it "delegates to #helpers" do
         
     | 
| 
       16 
     | 
    
         
            -
                  subject. 
     | 
| 
       17 
     | 
    
         
            -
                  subject.helpers. 
     | 
| 
      
 16 
     | 
    
         
            +
                  allow(subject).to receive(:helpers).and_return(double)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect(subject.helpers).to receive(:localize).with(:an_object, some: "parameter")
         
     | 
| 
       18 
18 
     | 
    
         
             
                  subject.localize(:an_object, some: "parameter")
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                it "is aliased to #l" do
         
     | 
| 
       22 
     | 
    
         
            -
                  subject. 
     | 
| 
       23 
     | 
    
         
            -
                  subject.helpers. 
     | 
| 
      
 22 
     | 
    
         
            +
                  allow(subject).to receive_messages helpers: double
         
     | 
| 
      
 23 
     | 
    
         
            +
                  expect(subject.helpers).to receive(:localize).with(:an_object, some: "parameter")
         
     | 
| 
       24 
24 
     | 
    
         
             
                  subject.l(:an_object, some: "parameter")
         
     | 
| 
       25 
25 
     | 
    
         
             
                end
         
     | 
| 
       26 
26 
     | 
    
         
             
              end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
              describe ".helpers" do
         
     | 
| 
       29 
29 
     | 
    
         
             
                it "returns the current view context" do
         
     | 
| 
       30 
     | 
    
         
            -
                  Draper::ViewContext. 
     | 
| 
      
 30 
     | 
    
         
            +
                  allow(Draper::ViewContext).to receive_messages current: :current_view_context
         
     | 
| 
       31 
31 
     | 
    
         
             
                  expect(subject.class.helpers).to be :current_view_context
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                it "is aliased to .h" do
         
     | 
| 
       35 
     | 
    
         
            -
                  Draper::ViewContext. 
     | 
| 
      
 35 
     | 
    
         
            +
                  allow(Draper::ViewContext).to receive(:current).and_return(:current_view_context)
         
     | 
| 
       36 
36 
     | 
    
         
             
                  expect(subject.class.h).to be :current_view_context
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
38 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: draper
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jeff Casimir
         
     | 
| 
         @@ -9,36 +9,36 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2017-05-08 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: activesupport
         
     | 
| 
       16 
16 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                requirements:
         
     | 
| 
       18 
     | 
    
         
            -
                - - " 
     | 
| 
      
 18 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       19 
19 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       20 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 20 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
       21 
21 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       22 
22 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       23 
23 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       24 
24 
     | 
    
         
             
                requirements:
         
     | 
| 
       25 
     | 
    
         
            -
                - - " 
     | 
| 
      
 25 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       26 
26 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       27 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 27 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
       28 
28 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       29 
29 
     | 
    
         
             
              name: actionpack
         
     | 
| 
       30 
30 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       31 
31 
     | 
    
         
             
                requirements:
         
     | 
| 
       32 
     | 
    
         
            -
                - - " 
     | 
| 
      
 32 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       33 
33 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       34 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 34 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
       35 
35 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       36 
36 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       37 
37 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       38 
38 
     | 
    
         
             
                requirements:
         
     | 
| 
       39 
     | 
    
         
            -
                - - " 
     | 
| 
      
 39 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       40 
40 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       41 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 41 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
       42 
42 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       43 
43 
     | 
    
         
             
              name: request_store
         
     | 
| 
       44 
44 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -57,16 +57,30 @@ dependencies: 
     | 
|
| 
       57 
57 
     | 
    
         
             
              name: activemodel
         
     | 
| 
       58 
58 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       59 
59 
     | 
    
         
             
                requirements:
         
     | 
| 
       60 
     | 
    
         
            -
                - - " 
     | 
| 
      
 60 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       61 
61 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       62 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 62 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
       63 
63 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       64 
64 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       65 
65 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       66 
66 
     | 
    
         
             
                requirements:
         
     | 
| 
       67 
     | 
    
         
            -
                - - " 
     | 
| 
      
 67 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       68 
68 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       69 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 69 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
      
 70 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 71 
     | 
    
         
            +
              name: activemodel-serializers-xml
         
     | 
| 
      
 72 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 73 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 74 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 75 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 76 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 77 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 78 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 79 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 80 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 81 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 82 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 83 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
       70 
84 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       71 
85 
     | 
    
         
             
              name: ammeter
         
     | 
| 
       72 
86 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -87,42 +101,42 @@ dependencies: 
     | 
|
| 
       87 
101 
     | 
    
         
             
                requirements:
         
     | 
| 
       88 
102 
     | 
    
         
             
                - - ">="
         
     | 
| 
       89 
103 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       90 
     | 
    
         
            -
                    version: 0 
     | 
| 
      
 104 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       91 
105 
     | 
    
         
             
              type: :development
         
     | 
| 
       92 
106 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       93 
107 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       94 
108 
     | 
    
         
             
                requirements:
         
     | 
| 
       95 
109 
     | 
    
         
             
                - - ">="
         
     | 
| 
       96 
110 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       97 
     | 
    
         
            -
                    version: 0 
     | 
| 
      
 111 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       98 
112 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       99 
113 
     | 
    
         
             
              name: rspec-rails
         
     | 
| 
       100 
114 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       101 
115 
     | 
    
         
             
                requirements:
         
     | 
| 
       102 
     | 
    
         
            -
                - - " 
     | 
| 
      
 116 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       103 
117 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       104 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 118 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       105 
119 
     | 
    
         
             
              type: :development
         
     | 
| 
       106 
120 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       107 
121 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       108 
122 
     | 
    
         
             
                requirements:
         
     | 
| 
       109 
     | 
    
         
            -
                - - " 
     | 
| 
      
 123 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       110 
124 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       111 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 125 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       112 
126 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       113 
127 
     | 
    
         
             
              name: minitest-rails
         
     | 
| 
       114 
128 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       115 
129 
     | 
    
         
             
                requirements:
         
     | 
| 
       116 
130 
     | 
    
         
             
                - - ">="
         
     | 
| 
       117 
131 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       118 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 132 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       119 
133 
     | 
    
         
             
              type: :development
         
     | 
| 
       120 
134 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       121 
135 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       122 
136 
     | 
    
         
             
                requirements:
         
     | 
| 
       123 
137 
     | 
    
         
             
                - - ">="
         
     | 
| 
       124 
138 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       125 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 139 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       126 
140 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       127 
141 
     | 
    
         
             
              name: capybara
         
     | 
| 
       128 
142 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -139,6 +153,20 @@ dependencies: 
     | 
|
| 
       139 
153 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       140 
154 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       141 
155 
     | 
    
         
             
              name: active_model_serializers
         
     | 
| 
      
 156 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 157 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 158 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 159 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 160 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
      
 161 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 162 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 163 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 164 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 165 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 166 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 167 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
      
 168 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 169 
     | 
    
         
            +
              name: rubocop
         
     | 
| 
       142 
170 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       143 
171 
     | 
    
         
             
                requirements:
         
     | 
| 
       144 
172 
     | 
    
         
             
                - - ">="
         
     | 
| 
         @@ -160,8 +188,11 @@ executables: [] 
     | 
|
| 
       160 
188 
     | 
    
         
             
            extensions: []
         
     | 
| 
       161 
189 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       162 
190 
     | 
    
         
             
            files:
         
     | 
| 
      
 191 
     | 
    
         
            +
            - ".codeclimate.yml"
         
     | 
| 
      
 192 
     | 
    
         
            +
            - ".github/PULL_REQUEST_TEMPLATE.md"
         
     | 
| 
       163 
193 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       164 
194 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
      
 195 
     | 
    
         
            +
            - ".rubocop.yml"
         
     | 
| 
       165 
196 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
       166 
197 
     | 
    
         
             
            - ".yardopts"
         
     | 
| 
       167 
198 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
         @@ -172,12 +203,11 @@ files: 
     | 
|
| 
       172 
203 
     | 
    
         
             
            - README.md
         
     | 
| 
       173 
204 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       174 
205 
     | 
    
         
             
            - draper.gemspec
         
     | 
| 
       175 
     | 
    
         
            -
            - gemfiles/4.0.gemfile
         
     | 
| 
       176 
     | 
    
         
            -
            - gemfiles/4.1.gemfile
         
     | 
| 
       177 
     | 
    
         
            -
            - gemfiles/4.2.gemfile
         
     | 
| 
       178 
206 
     | 
    
         
             
            - lib/draper.rb
         
     | 
| 
       179 
207 
     | 
    
         
             
            - lib/draper/automatic_delegation.rb
         
     | 
| 
       180 
208 
     | 
    
         
             
            - lib/draper/collection_decorator.rb
         
     | 
| 
      
 209 
     | 
    
         
            +
            - lib/draper/compatibility/api_only.rb
         
     | 
| 
      
 210 
     | 
    
         
            +
            - lib/draper/configuration.rb
         
     | 
| 
       181 
211 
     | 
    
         
             
            - lib/draper/decoratable.rb
         
     | 
| 
       182 
212 
     | 
    
         
             
            - lib/draper/decoratable/equality.rb
         
     | 
| 
       183 
213 
     | 
    
         
             
            - lib/draper/decorated_association.rb
         
     | 
| 
         @@ -201,6 +231,8 @@ files: 
     | 
|
| 
       201 
231 
     | 
    
         
             
            - lib/draper/view_context/build_strategy.rb
         
     | 
| 
       202 
232 
     | 
    
         
             
            - lib/draper/view_helpers.rb
         
     | 
| 
       203 
233 
     | 
    
         
             
            - lib/generators/controller_override.rb
         
     | 
| 
      
 234 
     | 
    
         
            +
            - lib/generators/draper/install_generator.rb
         
     | 
| 
      
 235 
     | 
    
         
            +
            - lib/generators/draper/templates/application_decorator.rb
         
     | 
| 
       204 
236 
     | 
    
         
             
            - lib/generators/mini_test/decorator_generator.rb
         
     | 
| 
       205 
237 
     | 
    
         
             
            - lib/generators/mini_test/templates/decorator_spec.rb
         
     | 
| 
       206 
238 
     | 
    
         
             
            - lib/generators/mini_test/templates/decorator_test.rb
         
     | 
| 
         @@ -211,22 +243,25 @@ files: 
     | 
|
| 
       211 
243 
     | 
    
         
             
            - lib/generators/test_unit/decorator_generator.rb
         
     | 
| 
       212 
244 
     | 
    
         
             
            - lib/generators/test_unit/templates/decorator_test.rb
         
     | 
| 
       213 
245 
     | 
    
         
             
            - spec/draper/collection_decorator_spec.rb
         
     | 
| 
      
 246 
     | 
    
         
            +
            - spec/draper/configuration_spec.rb
         
     | 
| 
       214 
247 
     | 
    
         
             
            - spec/draper/decoratable/equality_spec.rb
         
     | 
| 
       215 
248 
     | 
    
         
             
            - spec/draper/decoratable_spec.rb
         
     | 
| 
       216 
249 
     | 
    
         
             
            - spec/draper/decorated_association_spec.rb
         
     | 
| 
       217 
250 
     | 
    
         
             
            - spec/draper/decorates_assigned_spec.rb
         
     | 
| 
       218 
251 
     | 
    
         
             
            - spec/draper/decorator_spec.rb
         
     | 
| 
      
 252 
     | 
    
         
            +
            - spec/draper/draper_spec.rb
         
     | 
| 
       219 
253 
     | 
    
         
             
            - spec/draper/factory_spec.rb
         
     | 
| 
       220 
254 
     | 
    
         
             
            - spec/draper/finders_spec.rb
         
     | 
| 
       221 
255 
     | 
    
         
             
            - spec/draper/helper_proxy_spec.rb
         
     | 
| 
       222 
256 
     | 
    
         
             
            - spec/draper/lazy_helpers_spec.rb
         
     | 
| 
      
 257 
     | 
    
         
            +
            - spec/draper/undecorate_chain_spec.rb
         
     | 
| 
       223 
258 
     | 
    
         
             
            - spec/draper/undecorate_spec.rb
         
     | 
| 
       224 
259 
     | 
    
         
             
            - spec/draper/view_context/build_strategy_spec.rb
         
     | 
| 
       225 
260 
     | 
    
         
             
            - spec/draper/view_context_spec.rb
         
     | 
| 
       226 
261 
     | 
    
         
             
            - spec/draper/view_helpers_spec.rb
         
     | 
| 
       227 
262 
     | 
    
         
             
            - spec/dummy/.rspec
         
     | 
| 
       228 
263 
     | 
    
         
             
            - spec/dummy/Rakefile
         
     | 
| 
       229 
     | 
    
         
            -
            - spec/dummy/app/controllers/ 
     | 
| 
      
 264 
     | 
    
         
            +
            - spec/dummy/app/controllers/base_controller.rb
         
     | 
| 
       230 
265 
     | 
    
         
             
            - spec/dummy/app/controllers/localized_urls.rb
         
     | 
| 
       231 
266 
     | 
    
         
             
            - spec/dummy/app/controllers/posts_controller.rb
         
     | 
| 
       232 
267 
     | 
    
         
             
            - spec/dummy/app/decorators/mongoid_post_decorator.rb
         
     | 
| 
         @@ -252,6 +287,7 @@ files: 
     | 
|
| 
       252 
287 
     | 
    
         
             
            - spec/dummy/config/environments/production.rb
         
     | 
| 
       253 
288 
     | 
    
         
             
            - spec/dummy/config/environments/test.rb
         
     | 
| 
       254 
289 
     | 
    
         
             
            - spec/dummy/config/initializers/backtrace_silencers.rb
         
     | 
| 
      
 290 
     | 
    
         
            +
            - spec/dummy/config/initializers/draper.rb
         
     | 
| 
       255 
291 
     | 
    
         
             
            - spec/dummy/config/initializers/inflections.rb
         
     | 
| 
       256 
292 
     | 
    
         
             
            - spec/dummy/config/initializers/mime_types.rb
         
     | 
| 
       257 
293 
     | 
    
         
             
            - spec/dummy/config/initializers/secret_token.rb
         
     | 
| 
         @@ -292,6 +328,7 @@ files: 
     | 
|
| 
       292 
328 
     | 
    
         
             
            - spec/dummy/test/test_helper.rb
         
     | 
| 
       293 
329 
     | 
    
         
             
            - spec/generators/controller/controller_generator_spec.rb
         
     | 
| 
       294 
330 
     | 
    
         
             
            - spec/generators/decorator/decorator_generator_spec.rb
         
     | 
| 
      
 331 
     | 
    
         
            +
            - spec/generators/install/install_generator_spec.rb
         
     | 
| 
       295 
332 
     | 
    
         
             
            - spec/integration/integration_spec.rb
         
     | 
| 
       296 
333 
     | 
    
         
             
            - spec/performance/active_record.rb
         
     | 
| 
       297 
334 
     | 
    
         
             
            - spec/performance/benchmark.rb
         
     | 
| 
         @@ -314,7 +351,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       314 
351 
     | 
    
         
             
              requirements:
         
     | 
| 
       315 
352 
     | 
    
         
             
              - - ">="
         
     | 
| 
       316 
353 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       317 
     | 
    
         
            -
                  version:  
     | 
| 
      
 354 
     | 
    
         
            +
                  version: 2.2.2
         
     | 
| 
       318 
355 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       319 
356 
     | 
    
         
             
              requirements:
         
     | 
| 
       320 
357 
     | 
    
         
             
              - - ">="
         
     | 
| 
         @@ -322,28 +359,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       322 
359 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       323 
360 
     | 
    
         
             
            requirements: []
         
     | 
| 
       324 
361 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       325 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 362 
     | 
    
         
            +
            rubygems_version: 2.6.11
         
     | 
| 
       326 
363 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       327 
364 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       328 
365 
     | 
    
         
             
            summary: View Models for Rails
         
     | 
| 
       329 
366 
     | 
    
         
             
            test_files:
         
     | 
| 
       330 
367 
     | 
    
         
             
            - spec/draper/collection_decorator_spec.rb
         
     | 
| 
      
 368 
     | 
    
         
            +
            - spec/draper/configuration_spec.rb
         
     | 
| 
       331 
369 
     | 
    
         
             
            - spec/draper/decoratable/equality_spec.rb
         
     | 
| 
       332 
370 
     | 
    
         
             
            - spec/draper/decoratable_spec.rb
         
     | 
| 
       333 
371 
     | 
    
         
             
            - spec/draper/decorated_association_spec.rb
         
     | 
| 
       334 
372 
     | 
    
         
             
            - spec/draper/decorates_assigned_spec.rb
         
     | 
| 
       335 
373 
     | 
    
         
             
            - spec/draper/decorator_spec.rb
         
     | 
| 
      
 374 
     | 
    
         
            +
            - spec/draper/draper_spec.rb
         
     | 
| 
       336 
375 
     | 
    
         
             
            - spec/draper/factory_spec.rb
         
     | 
| 
       337 
376 
     | 
    
         
             
            - spec/draper/finders_spec.rb
         
     | 
| 
       338 
377 
     | 
    
         
             
            - spec/draper/helper_proxy_spec.rb
         
     | 
| 
       339 
378 
     | 
    
         
             
            - spec/draper/lazy_helpers_spec.rb
         
     | 
| 
      
 379 
     | 
    
         
            +
            - spec/draper/undecorate_chain_spec.rb
         
     | 
| 
       340 
380 
     | 
    
         
             
            - spec/draper/undecorate_spec.rb
         
     | 
| 
       341 
381 
     | 
    
         
             
            - spec/draper/view_context/build_strategy_spec.rb
         
     | 
| 
       342 
382 
     | 
    
         
             
            - spec/draper/view_context_spec.rb
         
     | 
| 
       343 
383 
     | 
    
         
             
            - spec/draper/view_helpers_spec.rb
         
     | 
| 
       344 
384 
     | 
    
         
             
            - spec/dummy/.rspec
         
     | 
| 
       345 
385 
     | 
    
         
             
            - spec/dummy/Rakefile
         
     | 
| 
       346 
     | 
    
         
            -
            - spec/dummy/app/controllers/ 
     | 
| 
      
 386 
     | 
    
         
            +
            - spec/dummy/app/controllers/base_controller.rb
         
     | 
| 
       347 
387 
     | 
    
         
             
            - spec/dummy/app/controllers/localized_urls.rb
         
     | 
| 
       348 
388 
     | 
    
         
             
            - spec/dummy/app/controllers/posts_controller.rb
         
     | 
| 
       349 
389 
     | 
    
         
             
            - spec/dummy/app/decorators/mongoid_post_decorator.rb
         
     | 
| 
         @@ -369,6 +409,7 @@ test_files: 
     | 
|
| 
       369 
409 
     | 
    
         
             
            - spec/dummy/config/environments/production.rb
         
     | 
| 
       370 
410 
     | 
    
         
             
            - spec/dummy/config/environments/test.rb
         
     | 
| 
       371 
411 
     | 
    
         
             
            - spec/dummy/config/initializers/backtrace_silencers.rb
         
     | 
| 
      
 412 
     | 
    
         
            +
            - spec/dummy/config/initializers/draper.rb
         
     | 
| 
       372 
413 
     | 
    
         
             
            - spec/dummy/config/initializers/inflections.rb
         
     | 
| 
       373 
414 
     | 
    
         
             
            - spec/dummy/config/initializers/mime_types.rb
         
     | 
| 
       374 
415 
     | 
    
         
             
            - spec/dummy/config/initializers/secret_token.rb
         
     | 
| 
         @@ -409,6 +450,7 @@ test_files: 
     | 
|
| 
       409 
450 
     | 
    
         
             
            - spec/dummy/test/test_helper.rb
         
     | 
| 
       410 
451 
     | 
    
         
             
            - spec/generators/controller/controller_generator_spec.rb
         
     | 
| 
       411 
452 
     | 
    
         
             
            - spec/generators/decorator/decorator_generator_spec.rb
         
     | 
| 
      
 453 
     | 
    
         
            +
            - spec/generators/install/install_generator_spec.rb
         
     | 
| 
       412 
454 
     | 
    
         
             
            - spec/integration/integration_spec.rb
         
     | 
| 
       413 
455 
     | 
    
         
             
            - spec/performance/active_record.rb
         
     | 
| 
       414 
456 
     | 
    
         
             
            - spec/performance/benchmark.rb
         
     |