draper_new 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +15 -0
  5. data/.yardopts +1 -0
  6. data/CHANGELOG.md +230 -0
  7. data/CONTRIBUTING.md +20 -0
  8. data/Gemfile +16 -0
  9. data/Guardfile +26 -0
  10. data/LICENSE +7 -0
  11. data/README.md +587 -0
  12. data/Rakefile +69 -0
  13. data/draper_new.gemspec +31 -0
  14. data/gemfiles/4.0.gemfile +3 -0
  15. data/gemfiles/4.1.gemfile +3 -0
  16. data/gemfiles/4.2.6.gemfile +3 -0
  17. data/gemfiles/4.2.gemfile +3 -0
  18. data/lib/draper.rb +63 -0
  19. data/lib/draper/automatic_delegation.rb +56 -0
  20. data/lib/draper/collection_decorator.rb +100 -0
  21. data/lib/draper/decoratable.rb +96 -0
  22. data/lib/draper/decoratable/equality.rb +26 -0
  23. data/lib/draper/decorated_association.rb +35 -0
  24. data/lib/draper/decorates_assigned.rb +44 -0
  25. data/lib/draper/decorator.rb +293 -0
  26. data/lib/draper/delegation.rb +13 -0
  27. data/lib/draper/factory.rb +91 -0
  28. data/lib/draper/finders.rb +37 -0
  29. data/lib/draper/helper_proxy.rb +44 -0
  30. data/lib/draper/helper_support.rb +5 -0
  31. data/lib/draper/lazy_helpers.rb +15 -0
  32. data/lib/draper/railtie.rb +70 -0
  33. data/lib/draper/tasks/test.rake +22 -0
  34. data/lib/draper/test/devise_helper.rb +30 -0
  35. data/lib/draper/test/minitest_integration.rb +6 -0
  36. data/lib/draper/test/rspec_integration.rb +20 -0
  37. data/lib/draper/test_case.rb +42 -0
  38. data/lib/draper/undecorate.rb +9 -0
  39. data/lib/draper/version.rb +3 -0
  40. data/lib/draper/view_context.rb +104 -0
  41. data/lib/draper/view_context/build_strategy.rb +48 -0
  42. data/lib/draper/view_helpers.rb +37 -0
  43. data/lib/generators/controller_override.rb +17 -0
  44. data/lib/generators/mini_test/decorator_generator.rb +20 -0
  45. data/lib/generators/mini_test/templates/decorator_spec.rb +4 -0
  46. data/lib/generators/mini_test/templates/decorator_test.rb +4 -0
  47. data/lib/generators/rails/decorator_generator.rb +36 -0
  48. data/lib/generators/rails/templates/decorator.rb +19 -0
  49. data/lib/generators/rspec/decorator_generator.rb +9 -0
  50. data/lib/generators/rspec/templates/decorator_spec.rb +4 -0
  51. data/lib/generators/test_unit/decorator_generator.rb +9 -0
  52. data/lib/generators/test_unit/templates/decorator_test.rb +4 -0
  53. data/spec/draper/collection_decorator_spec.rb +307 -0
  54. data/spec/draper/decoratable/equality_spec.rb +10 -0
  55. data/spec/draper/decoratable_spec.rb +202 -0
  56. data/spec/draper/decorated_association_spec.rb +84 -0
  57. data/spec/draper/decorates_assigned_spec.rb +71 -0
  58. data/spec/draper/decorator_spec.rb +816 -0
  59. data/spec/draper/factory_spec.rb +251 -0
  60. data/spec/draper/finders_spec.rb +166 -0
  61. data/spec/draper/helper_proxy_spec.rb +61 -0
  62. data/spec/draper/lazy_helpers_spec.rb +21 -0
  63. data/spec/draper/undecorate_spec.rb +19 -0
  64. data/spec/draper/view_context/build_strategy_spec.rb +116 -0
  65. data/spec/draper/view_context_spec.rb +154 -0
  66. data/spec/draper/view_helpers_spec.rb +8 -0
  67. data/spec/dummy/.rspec +2 -0
  68. data/spec/dummy/Rakefile +7 -0
  69. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  70. data/spec/dummy/app/controllers/localized_urls.rb +5 -0
  71. data/spec/dummy/app/controllers/posts_controller.rb +20 -0
  72. data/spec/dummy/app/decorators/mongoid_post_decorator.rb +4 -0
  73. data/spec/dummy/app/decorators/post_decorator.rb +60 -0
  74. data/spec/dummy/app/helpers/application_helper.rb +5 -0
  75. data/spec/dummy/app/mailers/application_mailer.rb +3 -0
  76. data/spec/dummy/app/mailers/post_mailer.rb +19 -0
  77. data/spec/dummy/app/models/admin.rb +5 -0
  78. data/spec/dummy/app/models/mongoid_post.rb +5 -0
  79. data/spec/dummy/app/models/post.rb +3 -0
  80. data/spec/dummy/app/models/user.rb +5 -0
  81. data/spec/dummy/app/views/layouts/application.html.erb +11 -0
  82. data/spec/dummy/app/views/post_mailer/decorated_email.html.erb +1 -0
  83. data/spec/dummy/app/views/posts/_post.html.erb +40 -0
  84. data/spec/dummy/app/views/posts/show.html.erb +1 -0
  85. data/spec/dummy/bin/rails +4 -0
  86. data/spec/dummy/config.ru +4 -0
  87. data/spec/dummy/config/application.rb +71 -0
  88. data/spec/dummy/config/boot.rb +5 -0
  89. data/spec/dummy/config/database.yml +25 -0
  90. data/spec/dummy/config/environment.rb +5 -0
  91. data/spec/dummy/config/environments/development.rb +33 -0
  92. data/spec/dummy/config/environments/production.rb +57 -0
  93. data/spec/dummy/config/environments/test.rb +31 -0
  94. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  95. data/spec/dummy/config/initializers/inflections.rb +15 -0
  96. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  97. data/spec/dummy/config/initializers/secret_token.rb +8 -0
  98. data/spec/dummy/config/initializers/session_store.rb +8 -0
  99. data/spec/dummy/config/locales/en.yml +5 -0
  100. data/spec/dummy/config/mongoid.yml +79 -0
  101. data/spec/dummy/config/routes.rb +9 -0
  102. data/spec/dummy/db/migrate/20121019115657_create_posts.rb +8 -0
  103. data/spec/dummy/db/schema.rb +21 -0
  104. data/spec/dummy/db/seeds.rb +2 -0
  105. data/spec/dummy/fast_spec/post_decorator_spec.rb +37 -0
  106. data/spec/dummy/lib/tasks/test.rake +16 -0
  107. data/spec/dummy/public/404.html +26 -0
  108. data/spec/dummy/public/422.html +26 -0
  109. data/spec/dummy/public/500.html +25 -0
  110. data/spec/dummy/public/favicon.ico +0 -0
  111. data/spec/dummy/script/rails +6 -0
  112. data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +16 -0
  113. data/spec/dummy/spec/decorators/devise_spec.rb +64 -0
  114. data/spec/dummy/spec/decorators/helpers_spec.rb +21 -0
  115. data/spec/dummy/spec/decorators/post_decorator_spec.rb +66 -0
  116. data/spec/dummy/spec/decorators/spec_type_spec.rb +7 -0
  117. data/spec/dummy/spec/decorators/view_context_spec.rb +22 -0
  118. data/spec/dummy/spec/mailers/post_mailer_spec.rb +33 -0
  119. data/spec/dummy/spec/models/mongoid_post_spec.rb +8 -0
  120. data/spec/dummy/spec/models/post_spec.rb +6 -0
  121. data/spec/dummy/spec/shared_examples/decoratable.rb +24 -0
  122. data/spec/dummy/spec/spec_helper.rb +8 -0
  123. data/spec/dummy/test/decorators/minitest/devise_test.rb +64 -0
  124. data/spec/dummy/test/decorators/minitest/helpers_test.rb +21 -0
  125. data/spec/dummy/test/decorators/minitest/spec_type_test.rb +52 -0
  126. data/spec/dummy/test/decorators/minitest/view_context_test.rb +24 -0
  127. data/spec/dummy/test/decorators/test_unit/devise_test.rb +64 -0
  128. data/spec/dummy/test/decorators/test_unit/helpers_test.rb +21 -0
  129. data/spec/dummy/test/decorators/test_unit/view_context_test.rb +24 -0
  130. data/spec/dummy/test/minitest_helper.rb +2 -0
  131. data/spec/dummy/test/test_helper.rb +3 -0
  132. data/spec/generators/controller/controller_generator_spec.rb +22 -0
  133. data/spec/generators/decorator/decorator_generator_spec.rb +92 -0
  134. data/spec/integration/integration_spec.rb +66 -0
  135. data/spec/performance/active_record.rb +4 -0
  136. data/spec/performance/benchmark.rb +55 -0
  137. data/spec/performance/decorators.rb +45 -0
  138. data/spec/performance/models.rb +20 -0
  139. data/spec/spec_helper.rb +41 -0
  140. data/spec/support/dummy_app.rb +85 -0
  141. data/spec/support/matchers/have_text.rb +50 -0
  142. data/spec/support/shared_examples/decoratable_equality.rb +40 -0
  143. data/spec/support/shared_examples/view_helpers.rb +39 -0
  144. metadata +420 -0
@@ -0,0 +1,4 @@
1
+ module ActiveRecord
2
+ class Base
3
+ end
4
+ end
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
4
+ Bundler.require(:default) if defined?(Bundler)
5
+
6
+ require "benchmark"
7
+ require "draper"
8
+ require "./performance/models"
9
+ require "./performance/decorators"
10
+
11
+ Benchmark.bm do |bm|
12
+ puts "\n[ Exclusivelly using #method_missing for model delegation ]"
13
+ [ 1_000, 10_000, 100_000 ].each do |i|
14
+ puts "\n[ #{i} ]"
15
+ bm.report("#new ") do
16
+ i.times do |n|
17
+ ProductDecorator.decorate(Product.new)
18
+ end
19
+ end
20
+
21
+ bm.report("#hello_world ") do
22
+ i.times do |n|
23
+ ProductDecorator.decorate(Product.new).hello_world
24
+ end
25
+ end
26
+
27
+ bm.report("#sample_class_method ") do
28
+ i.times do |n|
29
+ ProductDecorator.decorate(Product.new).class.sample_class_method
30
+ end
31
+ end
32
+ end
33
+
34
+ puts "\n[ Defining methods on method_missing first hit ]"
35
+ [ 1_000, 10_000, 100_000 ].each do |i|
36
+ puts "\n[ #{i} ]"
37
+ bm.report("#new ") do
38
+ i.times do |n|
39
+ FastProductDecorator.decorate(FastProduct.new)
40
+ end
41
+ end
42
+
43
+ bm.report("#hello_world ") do
44
+ i.times do |n|
45
+ FastProductDecorator.decorate(FastProduct.new).hello_world
46
+ end
47
+ end
48
+
49
+ bm.report("#sample_class_method ") do
50
+ i.times do |n|
51
+ FastProductDecorator.decorate(FastProduct.new).class.sample_class_method
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,45 @@
1
+ require "./performance/models"
2
+ class ProductDecorator < Draper::Decorator
3
+
4
+ def awesome_title
5
+ "Awesome Title"
6
+ end
7
+
8
+ # Original #method_missing
9
+ def method_missing(method, *args, &block)
10
+ if allow?(method)
11
+ begin
12
+ model.send(method, *args, &block)
13
+ rescue NoMethodError
14
+ super
15
+ end
16
+ else
17
+ super
18
+ end
19
+ end
20
+
21
+ end
22
+
23
+ class FastProductDecorator < Draper::Decorator
24
+
25
+ def awesome_title
26
+ "Awesome Title"
27
+ end
28
+
29
+ # Modified #method_missing
30
+ def method_missing(method, *args, &block)
31
+ if allow?(method)
32
+ begin
33
+ self.class.send :define_method, method do |*args, &block|
34
+ model.send(method, *args, &block)
35
+ end
36
+ self.send(method, *args, &block)
37
+ rescue NoMethodError
38
+ super
39
+ end
40
+ else
41
+ super
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,20 @@
1
+ require "./performance/active_record"
2
+ class Product < ActiveRecord::Base
3
+ def self.sample_class_method
4
+ "sample class method"
5
+ end
6
+
7
+ def hello_world
8
+ "Hello, World"
9
+ end
10
+ end
11
+
12
+ class FastProduct < ActiveRecord::Base
13
+ def self.sample_class_method
14
+ "sample class method"
15
+ end
16
+
17
+ def hello_world
18
+ "Hello, World"
19
+ end
20
+ end
@@ -0,0 +1,41 @@
1
+ require 'bundler/setup'
2
+ require 'draper'
3
+ require 'rails/version'
4
+ require 'action_controller'
5
+ require 'action_controller/test_case'
6
+
7
+ RSpec.configure do |config|
8
+ config.expect_with(:rspec) {|c| c.syntax = :expect}
9
+ config.order = :random
10
+ config.mock_with :rspec do |mocks|
11
+ mocks.yield_receiver_to_any_instance_implementation_blocks = true
12
+ end
13
+ end
14
+
15
+ class Model; include Draper::Decoratable; end
16
+
17
+ class Product < Model; end
18
+ class SpecialProduct < Product; end
19
+ class Other < Model; end
20
+ class ProductDecorator < Draper::Decorator; end
21
+ class ProductsDecorator < Draper::CollectionDecorator; end
22
+
23
+ class ProductPresenter < Draper::Decorator; end
24
+
25
+ class OtherDecorator < Draper::Decorator; end
26
+
27
+ module Namespaced
28
+ class Product < Model; end
29
+ class ProductDecorator < Draper::Decorator; end
30
+
31
+ class OtherDecorator < Draper::Decorator; end
32
+ end
33
+
34
+ # After each example, revert changes made to the class
35
+ def protect_class(klass)
36
+ before { stub_const klass.name, Class.new(klass) }
37
+ end
38
+
39
+ def protect_module(mod)
40
+ before { stub_const mod.name, mod.dup }
41
+ end
@@ -0,0 +1,85 @@
1
+ require 'socket'
2
+ require 'net/http'
3
+
4
+ # Adapted from code by Jon Leighton
5
+ # https://github.com/jonleighton/focused_controller/blob/ec7ccf1/test/acceptance/app_test.rb
6
+
7
+ class DummyApp
8
+
9
+ def initialize(environment)
10
+ raise ArgumentError, "Environment must be development or production" unless ["development", "production"].include?(environment.to_s)
11
+ @environment = environment
12
+ end
13
+
14
+ attr_reader :environment
15
+
16
+ def url
17
+ "http://#{localhost}:#{port}"
18
+ end
19
+
20
+ def get(path)
21
+ Net::HTTP.get(URI(url + path))
22
+ end
23
+
24
+ def within_app(&block)
25
+ Dir.chdir(root, &block)
26
+ end
27
+
28
+ def start_server
29
+ within_app do
30
+ IO.popen("bundle exec rails s -e #{@environment} -p #{port} 2>&1") do |out|
31
+ start = Time.now
32
+ started = false
33
+ output = ""
34
+ timeout = 60.0
35
+
36
+ while !started && !out.eof? && Time.now - start <= timeout
37
+ output << read_output(out)
38
+ sleep 0.1
39
+
40
+ begin
41
+ TCPSocket.new(localhost, port)
42
+ rescue Errno::ECONNREFUSED
43
+ else
44
+ started = true
45
+ end
46
+ end
47
+
48
+ raise "Server failed to start:\n#{output}" unless started
49
+
50
+ yield
51
+
52
+ Process.kill("KILL", out.pid)
53
+ File.delete("tmp/pids/server.pid")
54
+ end
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ def root
61
+ File.expand_path("../../dummy", __FILE__)
62
+ end
63
+
64
+ def localhost
65
+ "127.0.0.1"
66
+ end
67
+
68
+ def port
69
+ @port ||= begin
70
+ server = TCPServer.new(localhost, 0)
71
+ server.addr[1]
72
+ ensure
73
+ server.close if server
74
+ end
75
+ end
76
+
77
+ def read_output(stream)
78
+ read = IO.select([stream], [], [stream], 0.1)
79
+ output = ""
80
+ loop { output << stream.read_nonblock(1024) } if read
81
+ output
82
+ rescue Errno::EAGAIN, Errno::EWOULDBLOCK, EOFError
83
+ output
84
+ end
85
+ end
@@ -0,0 +1,50 @@
1
+ require 'capybara'
2
+
3
+ module HaveTextMatcher
4
+ def have_text(text)
5
+ HaveText.new(text)
6
+ end
7
+
8
+ class HaveText
9
+ def initialize(text)
10
+ @text = text
11
+ end
12
+
13
+ def in(css)
14
+ @css = css
15
+ self
16
+ end
17
+
18
+ def matches?(subject)
19
+ @subject = Capybara.string(subject)
20
+
21
+ @subject.has_css?(@css || "*", text: @text)
22
+ end
23
+
24
+ def failure_message
25
+ "expected to find #{@text.inspect} #{within}"
26
+ end
27
+
28
+ def failure_message_when_negated
29
+ "expected not to find #{@text.inspect} #{within}"
30
+ end
31
+
32
+ private
33
+
34
+ def within
35
+ if @css && @subject.has_css?(@css)
36
+ "within\n#{@subject.find(@css).native}"
37
+ else
38
+ "#{inside} within\n#{@subject.native}"
39
+ end
40
+ end
41
+
42
+ def inside
43
+ @css ? "inside #{@css.inspect}" : "anywhere"
44
+ end
45
+ end
46
+ end
47
+
48
+ RSpec.configure do |config|
49
+ config.include HaveTextMatcher
50
+ end
@@ -0,0 +1,40 @@
1
+ shared_examples_for "decoration-aware #==" do |subject|
2
+ it "is true for itself" do
3
+ expect(subject == subject).to be_truthy
4
+ end
5
+
6
+ it "is false for another object" do
7
+ expect(subject == Object.new).to be_falsey
8
+ end
9
+
10
+ it "is true for a decorated version of itself" do
11
+ decorated = double(object: subject, decorated?: true)
12
+
13
+ expect(subject == decorated).to be_truthy
14
+ end
15
+
16
+ it "is false for a decorated other object" do
17
+ decorated = double(object: Object.new, decorated?: true)
18
+
19
+ expect(subject == decorated).to be_falsey
20
+ end
21
+
22
+ it "is false for a decoratable object with a `object` association" do
23
+ decoratable = double(object: subject, decorated?: false)
24
+
25
+ expect(subject == decoratable).to be_falsey
26
+ end
27
+
28
+ it "is false for an undecoratable object with a `object` association" do
29
+ undecoratable = double(object: subject)
30
+
31
+ expect(subject == undecoratable).to be_falsey
32
+ end
33
+
34
+ it "is true for a multiply-decorated version of itself" do
35
+ decorated = double(object: subject, decorated?: true)
36
+ redecorated = double(object: decorated, decorated?: true)
37
+
38
+ expect(subject == redecorated).to be_truthy
39
+ end
40
+ end
@@ -0,0 +1,39 @@
1
+ shared_examples_for "view helpers" do |subject|
2
+ describe "#helpers" do
3
+ it "returns the current view context" do
4
+ Draper::ViewContext.stub current: :current_view_context
5
+ expect(subject.helpers).to be :current_view_context
6
+ end
7
+
8
+ it "is aliased to #h" do
9
+ Draper::ViewContext.stub current: :current_view_context
10
+ expect(subject.h).to be :current_view_context
11
+ end
12
+ end
13
+
14
+ describe "#localize" do
15
+ it "delegates to #helpers" do
16
+ subject.stub helpers: double
17
+ subject.helpers.should_receive(:localize).with(:an_object, some: "parameter")
18
+ subject.localize(:an_object, some: "parameter")
19
+ end
20
+
21
+ it "is aliased to #l" do
22
+ subject.stub helpers: double
23
+ subject.helpers.should_receive(:localize).with(:an_object, some: "parameter")
24
+ subject.l(:an_object, some: "parameter")
25
+ end
26
+ end
27
+
28
+ describe ".helpers" do
29
+ it "returns the current view context" do
30
+ Draper::ViewContext.stub current: :current_view_context
31
+ expect(subject.class.helpers).to be :current_view_context
32
+ end
33
+
34
+ it "is aliased to .h" do
35
+ Draper::ViewContext.stub current: :current_view_context
36
+ expect(subject.class.h).to be :current_view_context
37
+ end
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,420 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: draper_new
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Chashmeet Singh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: actionpack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: request_store
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activemodel
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: ammeter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: minitest-rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: capybara
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: active_model_serializers
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Draper adds an object-oriented layer of presentation logic to your Rails
154
+ apps.
155
+ email:
156
+ - chashmeetsingh@gmail.com
157
+ executables: []
158
+ extensions: []
159
+ extra_rdoc_files: []
160
+ files:
161
+ - ".gitignore"
162
+ - ".rspec"
163
+ - ".travis.yml"
164
+ - ".yardopts"
165
+ - CHANGELOG.md
166
+ - CONTRIBUTING.md
167
+ - Gemfile
168
+ - Guardfile
169
+ - LICENSE
170
+ - README.md
171
+ - Rakefile
172
+ - draper_new.gemspec
173
+ - gemfiles/4.0.gemfile
174
+ - gemfiles/4.1.gemfile
175
+ - gemfiles/4.2.6.gemfile
176
+ - gemfiles/4.2.gemfile
177
+ - lib/draper.rb
178
+ - lib/draper/automatic_delegation.rb
179
+ - lib/draper/collection_decorator.rb
180
+ - lib/draper/decoratable.rb
181
+ - lib/draper/decoratable/equality.rb
182
+ - lib/draper/decorated_association.rb
183
+ - lib/draper/decorates_assigned.rb
184
+ - lib/draper/decorator.rb
185
+ - lib/draper/delegation.rb
186
+ - lib/draper/factory.rb
187
+ - lib/draper/finders.rb
188
+ - lib/draper/helper_proxy.rb
189
+ - lib/draper/helper_support.rb
190
+ - lib/draper/lazy_helpers.rb
191
+ - lib/draper/railtie.rb
192
+ - lib/draper/tasks/test.rake
193
+ - lib/draper/test/devise_helper.rb
194
+ - lib/draper/test/minitest_integration.rb
195
+ - lib/draper/test/rspec_integration.rb
196
+ - lib/draper/test_case.rb
197
+ - lib/draper/undecorate.rb
198
+ - lib/draper/version.rb
199
+ - lib/draper/view_context.rb
200
+ - lib/draper/view_context/build_strategy.rb
201
+ - lib/draper/view_helpers.rb
202
+ - lib/generators/controller_override.rb
203
+ - lib/generators/mini_test/decorator_generator.rb
204
+ - lib/generators/mini_test/templates/decorator_spec.rb
205
+ - lib/generators/mini_test/templates/decorator_test.rb
206
+ - lib/generators/rails/decorator_generator.rb
207
+ - lib/generators/rails/templates/decorator.rb
208
+ - lib/generators/rspec/decorator_generator.rb
209
+ - lib/generators/rspec/templates/decorator_spec.rb
210
+ - lib/generators/test_unit/decorator_generator.rb
211
+ - lib/generators/test_unit/templates/decorator_test.rb
212
+ - spec/draper/collection_decorator_spec.rb
213
+ - spec/draper/decoratable/equality_spec.rb
214
+ - spec/draper/decoratable_spec.rb
215
+ - spec/draper/decorated_association_spec.rb
216
+ - spec/draper/decorates_assigned_spec.rb
217
+ - spec/draper/decorator_spec.rb
218
+ - spec/draper/factory_spec.rb
219
+ - spec/draper/finders_spec.rb
220
+ - spec/draper/helper_proxy_spec.rb
221
+ - spec/draper/lazy_helpers_spec.rb
222
+ - spec/draper/undecorate_spec.rb
223
+ - spec/draper/view_context/build_strategy_spec.rb
224
+ - spec/draper/view_context_spec.rb
225
+ - spec/draper/view_helpers_spec.rb
226
+ - spec/dummy/.rspec
227
+ - spec/dummy/Rakefile
228
+ - spec/dummy/app/controllers/application_controller.rb
229
+ - spec/dummy/app/controllers/localized_urls.rb
230
+ - spec/dummy/app/controllers/posts_controller.rb
231
+ - spec/dummy/app/decorators/mongoid_post_decorator.rb
232
+ - spec/dummy/app/decorators/post_decorator.rb
233
+ - spec/dummy/app/helpers/application_helper.rb
234
+ - spec/dummy/app/mailers/application_mailer.rb
235
+ - spec/dummy/app/mailers/post_mailer.rb
236
+ - spec/dummy/app/models/admin.rb
237
+ - spec/dummy/app/models/mongoid_post.rb
238
+ - spec/dummy/app/models/post.rb
239
+ - spec/dummy/app/models/user.rb
240
+ - spec/dummy/app/views/layouts/application.html.erb
241
+ - spec/dummy/app/views/post_mailer/decorated_email.html.erb
242
+ - spec/dummy/app/views/posts/_post.html.erb
243
+ - spec/dummy/app/views/posts/show.html.erb
244
+ - spec/dummy/bin/rails
245
+ - spec/dummy/config.ru
246
+ - spec/dummy/config/application.rb
247
+ - spec/dummy/config/boot.rb
248
+ - spec/dummy/config/database.yml
249
+ - spec/dummy/config/environment.rb
250
+ - spec/dummy/config/environments/development.rb
251
+ - spec/dummy/config/environments/production.rb
252
+ - spec/dummy/config/environments/test.rb
253
+ - spec/dummy/config/initializers/backtrace_silencers.rb
254
+ - spec/dummy/config/initializers/inflections.rb
255
+ - spec/dummy/config/initializers/mime_types.rb
256
+ - spec/dummy/config/initializers/secret_token.rb
257
+ - spec/dummy/config/initializers/session_store.rb
258
+ - spec/dummy/config/locales/en.yml
259
+ - spec/dummy/config/mongoid.yml
260
+ - spec/dummy/config/routes.rb
261
+ - spec/dummy/db/migrate/20121019115657_create_posts.rb
262
+ - spec/dummy/db/schema.rb
263
+ - spec/dummy/db/seeds.rb
264
+ - spec/dummy/fast_spec/post_decorator_spec.rb
265
+ - spec/dummy/lib/tasks/test.rake
266
+ - spec/dummy/log/.gitkeep
267
+ - spec/dummy/public/404.html
268
+ - spec/dummy/public/422.html
269
+ - spec/dummy/public/500.html
270
+ - spec/dummy/public/favicon.ico
271
+ - spec/dummy/script/rails
272
+ - spec/dummy/spec/decorators/active_model_serializers_spec.rb
273
+ - spec/dummy/spec/decorators/devise_spec.rb
274
+ - spec/dummy/spec/decorators/helpers_spec.rb
275
+ - spec/dummy/spec/decorators/post_decorator_spec.rb
276
+ - spec/dummy/spec/decorators/spec_type_spec.rb
277
+ - spec/dummy/spec/decorators/view_context_spec.rb
278
+ - spec/dummy/spec/mailers/post_mailer_spec.rb
279
+ - spec/dummy/spec/models/mongoid_post_spec.rb
280
+ - spec/dummy/spec/models/post_spec.rb
281
+ - spec/dummy/spec/shared_examples/decoratable.rb
282
+ - spec/dummy/spec/spec_helper.rb
283
+ - spec/dummy/test/decorators/minitest/devise_test.rb
284
+ - spec/dummy/test/decorators/minitest/helpers_test.rb
285
+ - spec/dummy/test/decorators/minitest/spec_type_test.rb
286
+ - spec/dummy/test/decorators/minitest/view_context_test.rb
287
+ - spec/dummy/test/decorators/test_unit/devise_test.rb
288
+ - spec/dummy/test/decorators/test_unit/helpers_test.rb
289
+ - spec/dummy/test/decorators/test_unit/view_context_test.rb
290
+ - spec/dummy/test/minitest_helper.rb
291
+ - spec/dummy/test/test_helper.rb
292
+ - spec/generators/controller/controller_generator_spec.rb
293
+ - spec/generators/decorator/decorator_generator_spec.rb
294
+ - spec/integration/integration_spec.rb
295
+ - spec/performance/active_record.rb
296
+ - spec/performance/benchmark.rb
297
+ - spec/performance/decorators.rb
298
+ - spec/performance/models.rb
299
+ - spec/spec_helper.rb
300
+ - spec/support/dummy_app.rb
301
+ - spec/support/matchers/have_text.rb
302
+ - spec/support/shared_examples/decoratable_equality.rb
303
+ - spec/support/shared_examples/view_helpers.rb
304
+ homepage: http://github.com/chashmeetsingh/draper
305
+ licenses:
306
+ - MIT
307
+ metadata: {}
308
+ post_install_message:
309
+ rdoc_options: []
310
+ require_paths:
311
+ - lib
312
+ required_ruby_version: !ruby/object:Gem::Requirement
313
+ requirements:
314
+ - - ">="
315
+ - !ruby/object:Gem::Version
316
+ version: '0'
317
+ required_rubygems_version: !ruby/object:Gem::Requirement
318
+ requirements:
319
+ - - ">="
320
+ - !ruby/object:Gem::Version
321
+ version: '0'
322
+ requirements: []
323
+ rubyforge_project:
324
+ rubygems_version: 2.6.3
325
+ signing_key:
326
+ specification_version: 4
327
+ summary: View Models for Rails
328
+ test_files:
329
+ - spec/draper/collection_decorator_spec.rb
330
+ - spec/draper/decoratable/equality_spec.rb
331
+ - spec/draper/decoratable_spec.rb
332
+ - spec/draper/decorated_association_spec.rb
333
+ - spec/draper/decorates_assigned_spec.rb
334
+ - spec/draper/decorator_spec.rb
335
+ - spec/draper/factory_spec.rb
336
+ - spec/draper/finders_spec.rb
337
+ - spec/draper/helper_proxy_spec.rb
338
+ - spec/draper/lazy_helpers_spec.rb
339
+ - spec/draper/undecorate_spec.rb
340
+ - spec/draper/view_context/build_strategy_spec.rb
341
+ - spec/draper/view_context_spec.rb
342
+ - spec/draper/view_helpers_spec.rb
343
+ - spec/dummy/.rspec
344
+ - spec/dummy/Rakefile
345
+ - spec/dummy/app/controllers/application_controller.rb
346
+ - spec/dummy/app/controllers/localized_urls.rb
347
+ - spec/dummy/app/controllers/posts_controller.rb
348
+ - spec/dummy/app/decorators/mongoid_post_decorator.rb
349
+ - spec/dummy/app/decorators/post_decorator.rb
350
+ - spec/dummy/app/helpers/application_helper.rb
351
+ - spec/dummy/app/mailers/application_mailer.rb
352
+ - spec/dummy/app/mailers/post_mailer.rb
353
+ - spec/dummy/app/models/admin.rb
354
+ - spec/dummy/app/models/mongoid_post.rb
355
+ - spec/dummy/app/models/post.rb
356
+ - spec/dummy/app/models/user.rb
357
+ - spec/dummy/app/views/layouts/application.html.erb
358
+ - spec/dummy/app/views/post_mailer/decorated_email.html.erb
359
+ - spec/dummy/app/views/posts/_post.html.erb
360
+ - spec/dummy/app/views/posts/show.html.erb
361
+ - spec/dummy/bin/rails
362
+ - spec/dummy/config.ru
363
+ - spec/dummy/config/application.rb
364
+ - spec/dummy/config/boot.rb
365
+ - spec/dummy/config/database.yml
366
+ - spec/dummy/config/environment.rb
367
+ - spec/dummy/config/environments/development.rb
368
+ - spec/dummy/config/environments/production.rb
369
+ - spec/dummy/config/environments/test.rb
370
+ - spec/dummy/config/initializers/backtrace_silencers.rb
371
+ - spec/dummy/config/initializers/inflections.rb
372
+ - spec/dummy/config/initializers/mime_types.rb
373
+ - spec/dummy/config/initializers/secret_token.rb
374
+ - spec/dummy/config/initializers/session_store.rb
375
+ - spec/dummy/config/locales/en.yml
376
+ - spec/dummy/config/mongoid.yml
377
+ - spec/dummy/config/routes.rb
378
+ - spec/dummy/db/migrate/20121019115657_create_posts.rb
379
+ - spec/dummy/db/schema.rb
380
+ - spec/dummy/db/seeds.rb
381
+ - spec/dummy/fast_spec/post_decorator_spec.rb
382
+ - spec/dummy/lib/tasks/test.rake
383
+ - spec/dummy/log/.gitkeep
384
+ - spec/dummy/public/404.html
385
+ - spec/dummy/public/422.html
386
+ - spec/dummy/public/500.html
387
+ - spec/dummy/public/favicon.ico
388
+ - spec/dummy/script/rails
389
+ - spec/dummy/spec/decorators/active_model_serializers_spec.rb
390
+ - spec/dummy/spec/decorators/devise_spec.rb
391
+ - spec/dummy/spec/decorators/helpers_spec.rb
392
+ - spec/dummy/spec/decorators/post_decorator_spec.rb
393
+ - spec/dummy/spec/decorators/spec_type_spec.rb
394
+ - spec/dummy/spec/decorators/view_context_spec.rb
395
+ - spec/dummy/spec/mailers/post_mailer_spec.rb
396
+ - spec/dummy/spec/models/mongoid_post_spec.rb
397
+ - spec/dummy/spec/models/post_spec.rb
398
+ - spec/dummy/spec/shared_examples/decoratable.rb
399
+ - spec/dummy/spec/spec_helper.rb
400
+ - spec/dummy/test/decorators/minitest/devise_test.rb
401
+ - spec/dummy/test/decorators/minitest/helpers_test.rb
402
+ - spec/dummy/test/decorators/minitest/spec_type_test.rb
403
+ - spec/dummy/test/decorators/minitest/view_context_test.rb
404
+ - spec/dummy/test/decorators/test_unit/devise_test.rb
405
+ - spec/dummy/test/decorators/test_unit/helpers_test.rb
406
+ - spec/dummy/test/decorators/test_unit/view_context_test.rb
407
+ - spec/dummy/test/minitest_helper.rb
408
+ - spec/dummy/test/test_helper.rb
409
+ - spec/generators/controller/controller_generator_spec.rb
410
+ - spec/generators/decorator/decorator_generator_spec.rb
411
+ - spec/integration/integration_spec.rb
412
+ - spec/performance/active_record.rb
413
+ - spec/performance/benchmark.rb
414
+ - spec/performance/decorators.rb
415
+ - spec/performance/models.rb
416
+ - spec/spec_helper.rb
417
+ - spec/support/dummy_app.rb
418
+ - spec/support/matchers/have_text.rb
419
+ - spec/support/shared_examples/decoratable_equality.rb
420
+ - spec/support/shared_examples/view_helpers.rb