draper 4.0.4 → 4.0.5

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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +3 -6
  4. data/lib/draper/collection_decorator.rb +0 -6
  5. data/lib/draper/compatibility/broadcastable.rb +24 -0
  6. data/lib/draper/compatibility/global_id.rb +9 -5
  7. data/lib/draper/decoratable.rb +5 -0
  8. data/lib/draper/decorator.rb +2 -18
  9. data/lib/draper/railtie.rb +6 -1
  10. data/lib/draper/version.rb +1 -1
  11. metadata +4 -232
  12. data/.github/PULL_REQUEST_TEMPLATE.md +0 -24
  13. data/.github/workflows/ci.yml +0 -71
  14. data/.gitignore +0 -18
  15. data/Gemfile +0 -46
  16. data/bin/bundle +0 -114
  17. data/bin/rake +0 -29
  18. data/draper.gemspec +0 -34
  19. data/spec/draper/collection_decorator_spec.rb +0 -291
  20. data/spec/draper/configuration_spec.rb +0 -49
  21. data/spec/draper/decoratable/equality_spec.rb +0 -10
  22. data/spec/draper/decoratable_spec.rb +0 -235
  23. data/spec/draper/decorated_association_spec.rb +0 -82
  24. data/spec/draper/decorates_assigned_spec.rb +0 -71
  25. data/spec/draper/decorator_spec.rb +0 -872
  26. data/spec/draper/draper_spec.rb +0 -25
  27. data/spec/draper/factory_spec.rb +0 -247
  28. data/spec/draper/finders_spec.rb +0 -166
  29. data/spec/draper/helper_proxy_spec.rb +0 -61
  30. data/spec/draper/lazy_helpers_spec.rb +0 -21
  31. data/spec/draper/query_methods/load_strategy_spec.rb +0 -26
  32. data/spec/draper/query_methods_spec.rb +0 -80
  33. data/spec/draper/undecorate_chain_spec.rb +0 -20
  34. data/spec/draper/undecorate_spec.rb +0 -19
  35. data/spec/draper/view_context/build_strategy_spec.rb +0 -115
  36. data/spec/draper/view_context_spec.rb +0 -182
  37. data/spec/draper/view_helpers_spec.rb +0 -8
  38. data/spec/dummy/.rspec +0 -1
  39. data/spec/dummy/Rakefile +0 -7
  40. data/spec/dummy/app/assets/config/manifest.js +0 -3
  41. data/spec/dummy/app/controllers/application_controller.rb +0 -2
  42. data/spec/dummy/app/controllers/base_controller.rb +0 -4
  43. data/spec/dummy/app/controllers/localized_urls.rb +0 -5
  44. data/spec/dummy/app/controllers/posts_controller.rb +0 -20
  45. data/spec/dummy/app/decorators/comment_decorator.rb +0 -13
  46. data/spec/dummy/app/decorators/mongoid_post_decorator.rb +0 -2
  47. data/spec/dummy/app/decorators/post_decorator.rb +0 -60
  48. data/spec/dummy/app/helpers/application_helper.rb +0 -5
  49. data/spec/dummy/app/jobs/publish_post_job.rb +0 -7
  50. data/spec/dummy/app/mailers/application_mailer.rb +0 -3
  51. data/spec/dummy/app/mailers/post_mailer.rb +0 -19
  52. data/spec/dummy/app/models/admin.rb +0 -3
  53. data/spec/dummy/app/models/application_record.rb +0 -3
  54. data/spec/dummy/app/models/comment.rb +0 -3
  55. data/spec/dummy/app/models/mongoid_post.rb +0 -3
  56. data/spec/dummy/app/models/post.rb +0 -7
  57. data/spec/dummy/app/models/user.rb +0 -3
  58. data/spec/dummy/app/views/layouts/application.html.erb +0 -11
  59. data/spec/dummy/app/views/post_mailer/decorated_email.html.erb +0 -1
  60. data/spec/dummy/app/views/posts/_post.html.erb +0 -42
  61. data/spec/dummy/app/views/posts/show.html.erb +0 -1
  62. data/spec/dummy/bin/rails +0 -4
  63. data/spec/dummy/config/application.rb +0 -39
  64. data/spec/dummy/config/boot.rb +0 -5
  65. data/spec/dummy/config/database.yml +0 -25
  66. data/spec/dummy/config/environment.rb +0 -5
  67. data/spec/dummy/config/environments/development.rb +0 -78
  68. data/spec/dummy/config/environments/production.rb +0 -102
  69. data/spec/dummy/config/environments/test.rb +0 -69
  70. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  71. data/spec/dummy/config/initializers/draper.rb +0 -5
  72. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  73. data/spec/dummy/config/initializers/inflections.rb +0 -15
  74. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  75. data/spec/dummy/config/initializers/secret_token.rb +0 -8
  76. data/spec/dummy/config/initializers/session_store.rb +0 -8
  77. data/spec/dummy/config/locales/en.yml +0 -5
  78. data/spec/dummy/config/mongoid.yml +0 -142
  79. data/spec/dummy/config/routes.rb +0 -9
  80. data/spec/dummy/config/storage.yml +0 -7
  81. data/spec/dummy/config.ru +0 -4
  82. data/spec/dummy/db/migrate/20121019115657_create_posts.rb +0 -8
  83. data/spec/dummy/db/migrate/20240907041839_create_comments.rb +0 -9
  84. data/spec/dummy/db/schema.rb +0 -28
  85. data/spec/dummy/db/seeds.rb +0 -2
  86. data/spec/dummy/fast_spec/post_decorator_spec.rb +0 -37
  87. data/spec/dummy/lib/tasks/test.rake +0 -16
  88. data/spec/dummy/log/.gitkeep +0 -0
  89. data/spec/dummy/public/404.html +0 -26
  90. data/spec/dummy/public/422.html +0 -26
  91. data/spec/dummy/public/500.html +0 -25
  92. data/spec/dummy/public/favicon.ico +0 -0
  93. data/spec/dummy/script/rails +0 -6
  94. data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +0 -12
  95. data/spec/dummy/spec/decorators/devise_spec.rb +0 -55
  96. data/spec/dummy/spec/decorators/helpers_spec.rb +0 -21
  97. data/spec/dummy/spec/decorators/post_decorator_spec.rb +0 -64
  98. data/spec/dummy/spec/decorators/spec_type_spec.rb +0 -7
  99. data/spec/dummy/spec/decorators/view_context_spec.rb +0 -22
  100. data/spec/dummy/spec/jobs/publish_post_job_spec.rb +0 -11
  101. data/spec/dummy/spec/mailers/post_mailer_spec.rb +0 -25
  102. data/spec/dummy/spec/models/application_spec.rb +0 -7
  103. data/spec/dummy/spec/models/mongoid_post_spec.rb +0 -8
  104. data/spec/dummy/spec/models/post_spec.rb +0 -51
  105. data/spec/dummy/spec/rails_helper.rb +0 -69
  106. data/spec/dummy/spec/shared_examples/decoratable.rb +0 -22
  107. data/spec/dummy/spec/spec_helper.rb +0 -93
  108. data/spec/dummy/test/decorators/minitest/devise_test.rb +0 -55
  109. data/spec/dummy/test/decorators/minitest/helpers_test.rb +0 -21
  110. data/spec/dummy/test/decorators/minitest/spec_type_test.rb +0 -52
  111. data/spec/dummy/test/decorators/minitest/view_context_test.rb +0 -24
  112. data/spec/dummy/test/decorators/test_unit/devise_test.rb +0 -55
  113. data/spec/dummy/test/decorators/test_unit/helpers_test.rb +0 -21
  114. data/spec/dummy/test/decorators/test_unit/view_context_test.rb +0 -24
  115. data/spec/dummy/test/minitest_helper.rb +0 -2
  116. data/spec/dummy/test/test_helper.rb +0 -3
  117. data/spec/generators/controller/controller_generator_spec.rb +0 -23
  118. data/spec/generators/decorator/decorator_generator_spec.rb +0 -93
  119. data/spec/generators/install/install_generator_spec.rb +0 -19
  120. data/spec/integration/integration_spec.rb +0 -70
  121. data/spec/performance/active_record.rb +0 -4
  122. data/spec/performance/benchmark.rb +0 -55
  123. data/spec/performance/decorators.rb +0 -45
  124. data/spec/performance/models.rb +0 -20
  125. data/spec/spec_helper.rb +0 -50
  126. data/spec/support/dummy_app.rb +0 -85
  127. data/spec/support/matchers/have_text.rb +0 -50
  128. data/spec/support/shared_examples/decoratable_equality.rb +0 -40
  129. data/spec/support/shared_examples/view_helpers.rb +0 -39
@@ -1,115 +0,0 @@
1
- require 'spec_helper'
2
-
3
- def fake_view_context
4
- double("ViewContext")
5
- end
6
-
7
- def fake_controller(view_context = fake_view_context)
8
- double("Controller", view_context: view_context, request: double("Request"))
9
- end
10
-
11
- module Draper
12
- describe ViewContext::BuildStrategy::Full do
13
- describe "#call" do
14
- context "when a current controller is set" do
15
- it "returns the controller's view context" do
16
- view_context = fake_view_context
17
- allow(ViewContext).to receive_messages controller: fake_controller(view_context)
18
- strategy = ViewContext::BuildStrategy::Full.new
19
-
20
- expect(strategy.call).to be view_context
21
- end
22
- end
23
-
24
- context "when a current controller is not set" do
25
- it "uses ApplicationController" do
26
- expect(Draper::ViewContext.controller).to be_nil
27
- view_context = ViewContext::BuildStrategy::Full.new.call
28
- expect(view_context.controller).to eq Draper::ViewContext.controller
29
- expect(view_context.controller).to be_an ApplicationController
30
- end
31
- end
32
-
33
- it "adds a request if one is not defined" do
34
- controller = Class.new(ActionController::Base).new
35
- allow(ViewContext).to receive_messages controller: controller
36
- strategy = ViewContext::BuildStrategy::Full.new
37
-
38
- expect(controller.request).to be_nil
39
- strategy.call
40
- expect(controller.request).to be_an ActionDispatch::TestRequest
41
- expect(controller.params).to be_empty
42
-
43
- # sanity checks
44
- expect(controller.view_context.request).to be controller.request
45
- expect(controller.view_context.params).to be controller.params
46
- end
47
-
48
- it "adds methods to the view context from the constructor block" do
49
- allow(ViewContext).to receive(:controller).and_return(fake_controller)
50
- strategy = ViewContext::BuildStrategy::Full.new do
51
- def a_helper_method; end
52
- end
53
-
54
- expect(strategy.call).to respond_to :a_helper_method
55
- end
56
-
57
- it "includes modules into the view context from the constructor block" do
58
- view_context = Object.new
59
- allow(ViewContext).to receive(:controller).and_return(fake_controller(view_context))
60
- helpers = Module.new do
61
- def a_helper_method; end
62
- end
63
- strategy = ViewContext::BuildStrategy::Full.new do
64
- include helpers
65
- end
66
-
67
- expect(strategy.call).to respond_to :a_helper_method
68
- end
69
- end
70
- end
71
-
72
- describe ViewContext::BuildStrategy::Fast do
73
- describe "#call" do
74
- it "returns an instance of a subclass of ActionView::Base" do
75
- strategy = ViewContext::BuildStrategy::Fast.new
76
-
77
- returned = strategy.call
78
-
79
- expect(returned).to be_an ActionView::Base
80
- expect(returned.class).not_to be ActionView::Base
81
- end
82
-
83
- it "returns different instances each time" do
84
- strategy = ViewContext::BuildStrategy::Fast.new
85
-
86
- expect(strategy.call).not_to be strategy.call
87
- end
88
-
89
- it "returns the same subclass each time" do
90
- strategy = ViewContext::BuildStrategy::Fast.new
91
-
92
- expect(strategy.call.class).to be strategy.call.class
93
- end
94
-
95
- it "adds methods to the view context from the constructor block" do
96
- strategy = ViewContext::BuildStrategy::Fast.new do
97
- def a_helper_method; end
98
- end
99
-
100
- expect(strategy.call).to respond_to :a_helper_method
101
- end
102
-
103
- it "includes modules into the view context from the constructor block" do
104
- helpers = Module.new do
105
- def a_helper_method; end
106
- end
107
- strategy = ViewContext::BuildStrategy::Fast.new do
108
- include helpers
109
- end
110
-
111
- expect(strategy.call).to respond_to :a_helper_method
112
- end
113
- end
114
- end
115
- end
@@ -1,182 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Draper
4
- describe ViewContext do
5
- describe "#view_context" do
6
- let(:base) { Class.new { def view_context; :controller_view_context; end } }
7
- let(:controller) { Class.new(base) { include ViewContext } }
8
-
9
- it "saves the superclass's view context" do
10
- expect(ViewContext).to receive(:current=).with(:controller_view_context)
11
- controller.new.view_context
12
- end
13
-
14
- it "returns the superclass's view context" do
15
- expect(controller.new.view_context).to be :controller_view_context
16
- end
17
- end
18
-
19
- describe ".controller" do
20
- it "returns the stored controller from RequestStore" do
21
- allow(RequestStore).to receive_messages store: {current_controller: :stored_controller}
22
-
23
- expect(ViewContext.controller).to be :stored_controller
24
- end
25
- end
26
-
27
- describe ".controller=" do
28
- it "stores a controller in RequestStore" do
29
- store = {}
30
- allow(RequestStore).to receive_messages store: store
31
-
32
- ViewContext.controller = :stored_controller
33
- expect(store[:current_controller]).to be :stored_controller
34
- end
35
-
36
- it "cleans context when controller changes" do
37
- store = {
38
- current_controller: :stored_controller,
39
- current_view_context: :stored_view_context
40
- }
41
-
42
- allow(RequestStore).to receive_messages store: store
43
-
44
- ViewContext.controller = :other_stored_controller
45
-
46
- expect(store).to include(current_controller: :other_stored_controller)
47
- expect(store).not_to include(:current_view_context)
48
- end
49
-
50
- it "doesn't clean context when controller is the same" do
51
- store = {
52
- current_controller: :stored_controller,
53
- current_view_context: :stored_view_context
54
- }
55
-
56
- allow(RequestStore).to receive_messages store: store
57
-
58
- ViewContext.controller = :stored_controller
59
-
60
- expect(store).to include(current_controller: :stored_controller)
61
- expect(store).to include(current_view_context: :stored_view_context)
62
- end
63
- end
64
-
65
- describe ".current" do
66
- it "returns the stored view context from RequestStore" do
67
- allow(RequestStore).to receive_messages store: {current_view_context: :stored_view_context}
68
-
69
- expect(ViewContext.current).to be :stored_view_context
70
- end
71
-
72
- context "when no view context is stored" do
73
- it "builds a view context" do
74
- allow(RequestStore).to receive_messages store: {}
75
- allow(ViewContext).to receive_messages build_strategy: ->{ :new_view_context }
76
- allow(HelperProxy).to receive(:new).with(:new_view_context).and_return(:new_helper_proxy)
77
-
78
- expect(ViewContext.current).to be :new_helper_proxy
79
- end
80
-
81
- it "stores the built view context" do
82
- store = {}
83
- allow(RequestStore).to receive_messages store: store
84
- allow(ViewContext).to receive_messages build_strategy: ->{ :new_view_context }
85
- allow(HelperProxy).to receive(:new).with(:new_view_context).and_return(:new_helper_proxy)
86
-
87
- ViewContext.current
88
- expect(store[:current_view_context]).to be :new_helper_proxy
89
- end
90
- end
91
- end
92
-
93
- describe ".current=" do
94
- it "stores a helper proxy for the view context in RequestStore" do
95
- store = {}
96
- allow(RequestStore).to receive_messages store: store
97
- allow(HelperProxy).to receive(:new).with(:stored_view_context).and_return(:stored_helper_proxy)
98
-
99
- ViewContext.current = :stored_view_context
100
- expect(store[:current_view_context]).to be :stored_helper_proxy
101
- end
102
- end
103
-
104
- describe ".clear!" do
105
- it "clears the stored controller and view controller" do
106
- store = {current_controller: :stored_controller, current_view_context: :stored_view_context}
107
- allow(RequestStore).to receive_messages store: store
108
-
109
- ViewContext.clear!
110
- expect(store).not_to have_key :current_controller
111
- expect(store).not_to have_key :current_view_context
112
- end
113
- end
114
-
115
- describe ".build" do
116
- it "returns a new view context using the build strategy" do
117
- allow(ViewContext).to receive_messages build_strategy: ->{ :new_view_context }
118
-
119
- expect(ViewContext.build).to be :new_view_context
120
- end
121
- end
122
-
123
- describe ".build!" do
124
- it "returns a helper proxy for the new view context" do
125
- allow(ViewContext).to receive_messages build_strategy: ->{ :new_view_context }
126
- allow(HelperProxy).to receive(:new).with(:new_view_context).and_return(:new_helper_proxy)
127
-
128
- expect(ViewContext.build!).to be :new_helper_proxy
129
- end
130
-
131
- it "stores the helper proxy" do
132
- store = {}
133
- allow(RequestStore).to receive_messages store: store
134
- allow(ViewContext).to receive_messages build_strategy: ->{ :new_view_context }
135
- allow(HelperProxy).to receive(:new).with(:new_view_context).and_return(:new_helper_proxy)
136
-
137
- ViewContext.build!
138
- expect(store[:current_view_context]).to be :new_helper_proxy
139
- end
140
- end
141
-
142
- describe ".build_strategy" do
143
- it "defaults to full" do
144
- expect(ViewContext.build_strategy).to be_a ViewContext::BuildStrategy::Full
145
- end
146
-
147
- it "memoizes" do
148
- expect(ViewContext.build_strategy).to be ViewContext.build_strategy
149
- end
150
- end
151
-
152
- describe ".test_strategy" do
153
- protect_module ViewContext
154
-
155
- context "with :fast" do
156
- it "creates a fast strategy" do
157
- ViewContext.test_strategy :fast
158
- expect(ViewContext.build_strategy).to be_a ViewContext::BuildStrategy::Fast
159
- end
160
-
161
- it "passes a block to the strategy" do
162
- allow(ViewContext::BuildStrategy::Fast).to receive(:new) { |&block| block.call }
163
-
164
- expect(ViewContext.test_strategy(:fast){:passed}).to be :passed
165
- end
166
- end
167
-
168
- context "with :full" do
169
- it "creates a full strategy" do
170
- ViewContext.test_strategy :full
171
- expect(ViewContext.build_strategy).to be_a ViewContext::BuildStrategy::Full
172
- end
173
-
174
- it "passes a block to the strategy" do
175
- allow(ViewContext::BuildStrategy::Full).to receive(:new) { |&block| block.call }
176
-
177
- expect(ViewContext.test_strategy(:full){:passed}).to be :passed
178
- end
179
- end
180
- end
181
- end
182
- end
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
- require 'support/shared_examples/view_helpers'
3
-
4
- module Draper
5
- describe ViewHelpers do
6
- it_behaves_like "view helpers", Class.new{include ViewHelpers}.new
7
- end
8
- end
data/spec/dummy/.rspec DELETED
@@ -1 +0,0 @@
1
- --format progress
data/spec/dummy/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env rake
2
- # Add your own tasks in files placed in lib/tasks ending in .rake,
3
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
-
5
- require File.expand_path('../config/application', __FILE__)
6
-
7
- Dummy::Application.load_tasks
@@ -1,3 +0,0 @@
1
- //= link_tree ../images
2
- //= link_directory ../javascripts .js
3
- //= link_directory ../stylesheets .css
@@ -1,2 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- end
@@ -1,4 +0,0 @@
1
- class BaseController < ActionController::Base
2
- include LocalizedUrls
3
- protect_from_forgery
4
- end
@@ -1,5 +0,0 @@
1
- module LocalizedUrls
2
- def default_url_options(options = {})
3
- {locale: I18n.locale, host: "www.example.com", port: 12345}
4
- end
5
- end
@@ -1,20 +0,0 @@
1
- class PostsController < BaseController
2
- decorates_assigned :post
3
-
4
- def show
5
- @post = Post.find(params[:id])
6
- end
7
-
8
- def mail
9
- post = Post.find(params[:id])
10
- email = PostMailer.decorated_email(post).deliver
11
- render html: email.body.to_s.html_safe
12
- end
13
-
14
- private
15
-
16
- def goodnight_moon
17
- "Goodnight, moon!"
18
- end
19
- helper_method :goodnight_moon
20
- end
@@ -1,13 +0,0 @@
1
- class CommentDecorator < Draper::Decorator
2
- delegate_all
3
-
4
- # Define presentation-specific methods here. Helpers are accessed through
5
- # `helpers` (aka `h`). You can override attributes, for example:
6
- #
7
- # def created_at
8
- # helpers.content_tag :span, class: 'time' do
9
- # object.created_at.strftime("%a %m/%d/%y")
10
- # end
11
- # end
12
-
13
- end
@@ -1,2 +0,0 @@
1
- class MongoidPostDecorator < Draper::Decorator
2
- end
@@ -1,60 +0,0 @@
1
- class PostDecorator < Draper::Decorator
2
- # don't delegate_all here because it helps to identify things we
3
- # have to delegate for ActiveModel compatibility
4
-
5
- # need to delegate attribute methods for AM::Serialization
6
- # need to delegate id and new_record? for AR::Base#== (Rails 3.0 only)
7
- delegate :id, :created_at, :new_record?
8
-
9
- def posted_date
10
- if created_at.to_date == DateTime.now.utc.to_date
11
- "Today"
12
- else
13
- "Not Today"
14
- end
15
- end
16
-
17
- def path_with_model
18
- h.post_path(object)
19
- end
20
-
21
- def path_with_id
22
- h.post_path(id: id)
23
- end
24
-
25
- def url_with_model
26
- h.post_url(object)
27
- end
28
-
29
- def url_with_id
30
- h.post_url(id: id)
31
- end
32
-
33
- def link
34
- h.link_to id.to_s, self
35
- end
36
-
37
- def truncated
38
- h.truncate("Once upon a time in a world far far away", length: 17, separator: ' ')
39
- end
40
-
41
- def html_escaped
42
- h.html_escape("<script>danger</script>")
43
- end
44
-
45
- def hello_world
46
- h.hello_world
47
- end
48
-
49
- def goodnight_moon
50
- h.goodnight_moon
51
- end
52
-
53
- def updated_at
54
- :overridden
55
- end
56
-
57
- def persisted?
58
- true
59
- end
60
- end
@@ -1,5 +0,0 @@
1
- module ApplicationHelper
2
- def hello_world
3
- "Hello, world!"
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- class PublishPostJob < ActiveJob::Base
2
- queue_as :default
3
-
4
- def perform(post)
5
- post.save!
6
- end
7
- end
@@ -1,3 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- include LocalizedUrls
3
- end
@@ -1,19 +0,0 @@
1
- class PostMailer < ApplicationMailer
2
- default from: "from@example.com"
3
- layout "application"
4
-
5
- # Mailers don't import app/helpers automatically
6
- helper :application
7
-
8
- def decorated_email(post)
9
- @post = post.decorate
10
- mail to: "to@example.com", subject: "A decorated post"
11
- end
12
-
13
- private
14
-
15
- def goodnight_moon
16
- "Goodnight, moon!"
17
- end
18
- helper_method :goodnight_moon
19
- end
@@ -1,3 +0,0 @@
1
- class Admin
2
- extend Devise::Models if defined? Devise
3
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
@@ -1,3 +0,0 @@
1
- class Comment < ApplicationRecord
2
- belongs_to :post
3
- end
@@ -1,3 +0,0 @@
1
- class MongoidPost
2
- include Mongoid::Document if defined? Mongoid
3
- end
@@ -1,7 +0,0 @@
1
- class Post < ApplicationRecord
2
- # attr_accessible :title, :body
3
-
4
- has_many :comments
5
-
6
- broadcasts if defined? Turbo::Broadcastable
7
- end
@@ -1,3 +0,0 @@
1
- class User
2
- extend Devise::Models if defined? Devise
3
- end
@@ -1,11 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- </head>
6
- <body>
7
-
8
- <%= yield %>
9
-
10
- </body>
11
- </html>
@@ -1 +0,0 @@
1
- <%= render @post %>
@@ -1,42 +0,0 @@
1
- <dl>
2
- <dt>Environment:</dt>
3
- <dd id="environment"><%= Rails.env %></dd>
4
-
5
- <dt>Draper view context controller:</dt>
6
- <dd id="controller"><%= Draper::ViewContext.current.controller.class %></dd>
7
-
8
- <dt>Posted:</dt>
9
- <dd id="posted_date"><%= post.posted_date %></dd>
10
-
11
- <dt>Built-in helpers:</dt>
12
- <dd id="truncated"><%= post.truncated %></dd>
13
-
14
- <dt>Built-in private helpers:</dt>
15
- <dd id="html_escaped"><%= post.html_escaped %></dd>
16
-
17
- <dt>Helpers from app/helpers:</dt>
18
- <dd id="hello_world"><%= post.hello_world %></dd>
19
-
20
- <dt>Helpers from the controller:</dt>
21
- <dd id="goodnight_moon"><%= post.goodnight_moon %></dd>
22
-
23
- <% unless defined? mailer %>
24
- <dt>Path with decorator:</dt>
25
- <dd id="path_with_decorator"><%= post_url(post) %></dd>
26
-
27
- <dt>Path with model:</dt>
28
- <dd id="path_with_model"><%= post.path_with_model %></dd>
29
-
30
- <dt>Path with id:</dt>
31
- <dd id="path_with_id"><%= post.path_with_id %></dd>
32
- <% end %>
33
-
34
- <dt>URL with decorator:</dt>
35
- <dd id="url_with_decorator"><%= post_url(post) %></dd>
36
-
37
- <dt>URL with model:</dt>
38
- <dd id="url_with_model"><%= post.url_with_model %></dd>
39
-
40
- <dt>URL with id:</dt>
41
- <dd id="url_with_id"><%= post.url_with_id %></dd>
42
- </dl>
@@ -1 +0,0 @@
1
- <%= render post %>
data/spec/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,39 +0,0 @@
1
- require_relative 'boot'
2
-
3
- require 'rails/all'
4
-
5
- # Require the gems listed in Gemfile, including any gems
6
- # you've limited to :test, :development, or :production.
7
- Kernel.silence_warnings do
8
- Bundler.require(*Rails.groups)
9
- end
10
-
11
- module Dummy
12
- class Application < Rails::Application
13
- config.load_defaults Rails::VERSION::STRING.to_f
14
-
15
- # For compatibility with applications that use this config
16
- # config.action_controller.include_all_helpers = false # FIXME
17
-
18
- # Please, add to the `ignore` list any other `lib` subdirectories that do
19
- # not contain `.rb` files, or that should not be reloaded or eager loaded.
20
- # Common ones are `templates`, `generators`, or `middleware`, for example.
21
- config.try :autoload_lib, ignore: %w[assets tasks] # HACK for Rails below 7
22
-
23
- # Configuration for the application, engines, and railties goes here.
24
- #
25
- # These settings can be overridden in specific environments using the files
26
- # in config/environments, which are processed later.
27
- #
28
- # config.time_zone = "Central Time (US & Canada)"
29
- # config.eager_load_paths << Rails.root.join("extras")
30
-
31
- # HACK: allows testing in production & development environments
32
- # Tell Action Mailer not to deliver emails to the real world.
33
- # The :test delivery method accumulates sent emails in the
34
- # ActionMailer::Base.deliveries array.
35
- config.action_mailer.delivery_method = :test
36
- end
37
- end
38
-
39
- ActiveRecord::Migration.verbose = false
@@ -1,5 +0,0 @@
1
- require 'rubygems'
2
-
3
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
4
-
5
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Dummy::Application.initialize!