active_decorator 1.2.0 → 1.3.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/.gitignore +1 -0
- data/.travis.yml +16 -25
- data/CHANGELOG.md +16 -0
- data/README.md +3 -3
- data/active_decorator.gemspec +2 -1
- data/gemfiles/Gemfile-rails.4.2.x +1 -0
- data/gemfiles/Gemfile-rails.5.0.x +1 -0
- data/gemfiles/{Gemfile-rails.4.0.x → Gemfile-rails.6.0.x} +1 -2
- data/lib/active_decorator.rb +5 -1
- data/lib/active_decorator/config.rb +7 -1
- data/lib/active_decorator/decorator.rb +4 -8
- data/lib/active_decorator/monkey/active_record/associations.rb +28 -24
- data/lib/active_decorator/railtie.rb +8 -6
- data/lib/active_decorator/version.rb +1 -1
- data/lib/active_decorator/view_context.rb +3 -11
- data/test/fake_app/app/views/authors/show.html.erb +1 -1
- data/test/fake_app/fake_app.rb +8 -17
- data/test/features/association_test.rb +2 -4
- data/test/models/association_test.rb +75 -0
- data/test/test_helper.rb +1 -0
- metadata +23 -9
- data/gemfiles/Gemfile-rails.3.2.x +0 -8
- data/gemfiles/Gemfile-rails.4.1.x +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39935554e752b75933ebf759c5173fc67b451c077c6cb3d18c48af54f9b4192c
|
4
|
+
data.tar.gz: 6917e250174825e7ead1ffaa69ad4614ba6aa1070bd53d6e84aa2b2c15faef47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1acb7ae8ea1a3a263d59611d3819036eb6aa303a3dfc3b55b0a6eb9eaef4b26412ed6c74aea6580ef1435aaab4a62360b7464e75130004f3da1d563f49a321c3
|
7
|
+
data.tar.gz: 69b9d07798170f1944cdd98a396b880232ed44278167ae0db3760aebdfc83a86f8f9fcf9846ec8008594bbb28e6285b9537fef3c19805ebbe3d17b47dd3e589d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
|
-
sudo: false
|
4
|
-
|
5
|
-
script: bundle exec rake test
|
6
|
-
|
7
3
|
addons:
|
8
4
|
chrome: stable
|
9
5
|
|
10
6
|
before_install:
|
11
7
|
- sudo apt update -qq
|
12
8
|
- sudo apt install -y chromium-chromedriver
|
13
|
-
- sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/
|
14
9
|
- gem i bundler -v '<2'
|
15
10
|
|
11
|
+
cache: bundler
|
12
|
+
|
16
13
|
# rvm:
|
17
|
-
# - 2.6.
|
14
|
+
# - 2.6.3
|
18
15
|
# - 2.5.5
|
19
|
-
# - 2.4.
|
16
|
+
# - 2.4.6
|
20
17
|
# - 2.3.8
|
21
18
|
# - 2.2.10
|
22
19
|
# - 2.1.10
|
@@ -26,42 +23,40 @@ before_install:
|
|
26
23
|
# - gemfiles/Gemfile-rails.5.1.x
|
27
24
|
# - gemfiles/Gemfile-rails.5.0.x
|
28
25
|
# - gemfiles/Gemfile-rails.4.2.x
|
29
|
-
# - gemfiles/Gemfile-rails.4.1.x
|
30
|
-
# - gemfiles/Gemfile-rails.4.0.x
|
31
|
-
# - gemfiles/Gemfile-rails.3.2.x
|
32
26
|
|
33
27
|
matrix:
|
34
28
|
include:
|
35
|
-
- rvm: 2.6.
|
29
|
+
- rvm: 2.6.3
|
30
|
+
gemfile: gemfiles/Gemfile-rails.6.0.x
|
31
|
+
- rvm: 2.6.3
|
32
|
+
gemfile: gemfiles/Gemfile-rails.6.0.x
|
33
|
+
env: API=1
|
34
|
+
- rvm: 2.6.3
|
36
35
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
37
|
-
- rvm: 2.6.
|
36
|
+
- rvm: 2.6.3
|
38
37
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
39
38
|
env: API=1
|
40
|
-
- rvm: 2.6.
|
39
|
+
- rvm: 2.6.3
|
41
40
|
gemfile: gemfiles/Gemfile-rails.5.1.x
|
42
|
-
- rvm: 2.6.
|
41
|
+
- rvm: 2.6.3
|
43
42
|
gemfile: gemfiles/Gemfile-rails.5.1.x
|
44
43
|
env: API=1
|
45
|
-
- rvm: 2.6.
|
44
|
+
- rvm: 2.6.3
|
46
45
|
gemfile: gemfiles/Gemfile-rails.5.0.x
|
47
|
-
- rvm: 2.6.
|
46
|
+
- rvm: 2.6.3
|
48
47
|
gemfile: gemfiles/Gemfile-rails.5.0.x
|
49
48
|
env: API=1
|
50
49
|
|
51
50
|
- rvm: 2.5.5
|
52
51
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
53
52
|
|
54
|
-
- rvm: 2.4.
|
53
|
+
- rvm: 2.4.6
|
55
54
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
56
55
|
|
57
56
|
- rvm: 2.3.8
|
58
57
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
59
58
|
- rvm: 2.3.8
|
60
59
|
gemfile: gemfiles/Gemfile-rails.4.2.x
|
61
|
-
- rvm: 2.3.8
|
62
|
-
gemfile: gemfiles/Gemfile-rails.4.1.x
|
63
|
-
- rvm: 2.3.8
|
64
|
-
gemfile: gemfiles/Gemfile-rails.4.0.x
|
65
60
|
|
66
61
|
- rvm: 2.2.10
|
67
62
|
gemfile: gemfiles/Gemfile-rails.5.2.x
|
@@ -72,10 +67,6 @@ matrix:
|
|
72
67
|
- rvm: 2.0.0
|
73
68
|
gemfile: gemfiles/Gemfile-rails.4.2.x
|
74
69
|
|
75
|
-
- rvm: 2.0.0
|
76
|
-
gemfile: gemfiles/Gemfile-rails.3.2.x
|
77
|
-
|
78
|
-
|
79
70
|
- rvm: ruby-head
|
80
71
|
gemfile: gemfiles/Gemfile-rails.edge
|
81
72
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 1.3.0
|
2
|
+
|
3
|
+
* Switched from Active Support `constantize` to Ruby's `const_get` when fetching decorator modules
|
4
|
+
|
5
|
+
* Switched `config` from ActiveSupport::Configurable to a simple Struct
|
6
|
+
|
7
|
+
* Association decoration now propagates from AssociationRelation to spawned Relations (e.g. `@post.comments.order(:id).each`)
|
8
|
+
|
9
|
+
* Dropped support for Rails 3.2, 4.0, and 4.1
|
10
|
+
|
11
|
+
|
12
|
+
## 1.2.0
|
13
|
+
|
14
|
+
* Decorate values in Hash recursively [@FumiyaShibusawa]
|
15
|
+
|
16
|
+
|
1
17
|
## 1.1.1
|
2
18
|
|
3
19
|
* Improved ActionController::API support for Rails 5.0.x [@frodsan]
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ActiveDecorator [](https://travis-ci.org/amatsuda/active_decorator) [](https://codeclimate.com/github/amatsuda/active_decorator)
|
2
2
|
|
3
|
-
A simple and Rubyish view helper for Rails
|
3
|
+
A simple and Rubyish view helper for Rails 4, Rails 5, and Rails 6. Keep your helpers and views Object-Oriented!
|
4
4
|
|
5
5
|
|
6
6
|
## Features ##
|
@@ -17,7 +17,7 @@ A simple and Rubyish view helper for Rails 3, Rails 4, Rails 5, and Rails 6. Kee
|
|
17
17
|
|
18
18
|
* Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x, and 2.7 (trunk)
|
19
19
|
|
20
|
-
* Rails
|
20
|
+
* Rails 4.2.x, 5.0, 5.1, 5.2, and 6.0 (edge)
|
21
21
|
|
22
22
|
|
23
23
|
## Supported ORMs ##
|
@@ -105,7 +105,7 @@ end
|
|
105
105
|
```erb
|
106
106
|
<p><%= @author.name %></p>
|
107
107
|
<ul>
|
108
|
-
<% @author.books.each do |book| %>
|
108
|
+
<% @author.books.order(:id).each do |book| %>
|
109
109
|
<%# `book` here is auto-decorated because @author is a decorated instance %>
|
110
110
|
<li><%= book.link %></li>
|
111
111
|
<% end %>
|
data/active_decorator.gemspec
CHANGED
@@ -22,7 +22,8 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency 'selenium-webdriver'
|
23
23
|
s.add_development_dependency 'puma'
|
24
24
|
s.add_development_dependency 'capybara'
|
25
|
-
s.add_development_dependency 'sqlite3'
|
25
|
+
s.add_development_dependency 'sqlite3'
|
26
26
|
s.add_development_dependency 'rake'
|
27
27
|
s.add_development_dependency 'jbuilder'
|
28
|
+
s.add_development_dependency 'byebug'
|
28
29
|
end
|
data/lib/active_decorator.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ActiveDecorator
|
4
|
-
|
4
|
+
def self.config
|
5
|
+
@_config ||= Struct.new(:decorator_suffix).new
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.configure
|
9
|
+
yield config
|
10
|
+
end
|
5
11
|
|
6
12
|
config.decorator_suffix = 'Decorator'
|
7
13
|
end
|
@@ -31,7 +31,7 @@ module ActiveDecorator
|
|
31
31
|
decorate r
|
32
32
|
end
|
33
33
|
elsif obj.is_a?(Hash)
|
34
|
-
obj.
|
34
|
+
obj.each_value do |v|
|
35
35
|
decorate v
|
36
36
|
end
|
37
37
|
elsif defined?(ActiveRecord) && obj.is_a?(ActiveRecord::Relation)
|
@@ -69,7 +69,7 @@ module ActiveDecorator
|
|
69
69
|
return @@decorators[model_class] if @@decorators.key? model_class
|
70
70
|
|
71
71
|
decorator_name = "#{model_class.name}#{ActiveDecorator.config.decorator_suffix}"
|
72
|
-
d = decorator_name
|
72
|
+
d = Object.const_get decorator_name, false
|
73
73
|
unless Class === d
|
74
74
|
d.send :include, ActiveDecorator::Helpers
|
75
75
|
@@decorators[model_class] = d
|
@@ -90,18 +90,14 @@ module ActiveDecorator
|
|
90
90
|
# For AR 3 and 4
|
91
91
|
module RelationDecoratorLegacy
|
92
92
|
def to_a
|
93
|
-
|
94
|
-
ActiveDecorator::Decorator.instance.decorate arr
|
95
|
-
end
|
93
|
+
ActiveDecorator::Decorator.instance.decorate super
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
99
97
|
# For AR 5+
|
100
98
|
module RelationDecorator
|
101
99
|
def records
|
102
|
-
|
103
|
-
ActiveDecorator::Decorator.instance.decorate arr
|
104
|
-
end
|
100
|
+
ActiveDecorator::Decorator.instance.decorate super
|
105
101
|
end
|
106
102
|
end
|
107
103
|
end
|
@@ -11,15 +11,7 @@ module ActiveDecorator
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
if Rails.version.to_f < 4.1
|
16
|
-
module CollectionAssociation
|
17
|
-
private
|
18
|
-
def first_or_last(*)
|
19
|
-
ActiveDecorator::Decorator.instance.decorate_association(owner, super)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
elsif Rails.version.to_f < 5.1
|
14
|
+
if Rails.version.to_f < 5.1
|
23
15
|
module CollectionAssociation
|
24
16
|
private
|
25
17
|
def first_nth_or_last(*)
|
@@ -28,29 +20,41 @@ module ActiveDecorator
|
|
28
20
|
end
|
29
21
|
end
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
module CollectionProxy
|
24
|
+
def take(*)
|
25
|
+
ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
|
26
|
+
end
|
27
|
+
|
28
|
+
if Rails.version.to_f >= 5.1
|
29
|
+
def last(*)
|
34
30
|
ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
|
35
31
|
end
|
36
32
|
|
37
|
-
|
38
|
-
def last(limit = nil)
|
39
|
-
ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
33
|
+
private
|
43
34
|
|
44
|
-
|
45
|
-
|
46
|
-
|
35
|
+
def find_nth_with_limit(*)
|
36
|
+
ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
|
37
|
+
end
|
47
38
|
|
48
|
-
|
49
|
-
|
50
|
-
end
|
39
|
+
def find_nth_from_last(*)
|
40
|
+
ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
|
51
41
|
end
|
52
42
|
end
|
53
43
|
end
|
44
|
+
|
45
|
+
module CollectionAssociation
|
46
|
+
private
|
47
|
+
|
48
|
+
def build_record(*)
|
49
|
+
ActiveDecorator::Decorator.instance.decorate_association(@owner, super)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
module AssociationRelation
|
55
|
+
def spawn(*)
|
56
|
+
ActiveDecorator::Decorator.instance.decorate_association(@association.owner, super)
|
57
|
+
end
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'active_decorator/view_context'
|
4
|
-
require 'rails'
|
5
|
-
|
6
3
|
module ActiveDecorator
|
7
4
|
class Railtie < ::Rails::Railtie
|
8
5
|
initializer 'active_decorator' do
|
@@ -18,6 +15,7 @@ module ActiveDecorator
|
|
18
15
|
require 'active_decorator/monkey/action_controller/base/rescue_from'
|
19
16
|
ActionController::Base.send :prepend, ActiveDecorator::Monkey::ActionController::Base
|
20
17
|
|
18
|
+
require 'active_decorator/view_context'
|
21
19
|
ActionController::Base.send :include, ActiveDecorator::ViewContext::Filter
|
22
20
|
end
|
23
21
|
|
@@ -38,6 +36,7 @@ module ActiveDecorator
|
|
38
36
|
ActionMailer::Base.send :prepend, ActiveDecorator::Monkey::AbstractController::Rendering
|
39
37
|
|
40
38
|
if ActionMailer::Base.respond_to? :before_action
|
39
|
+
require 'active_decorator/view_context'
|
41
40
|
ActionMailer::Base.send :include, ActiveDecorator::ViewContext::Filter
|
42
41
|
end
|
43
42
|
end
|
@@ -45,12 +44,15 @@ module ActiveDecorator
|
|
45
44
|
ActiveSupport.on_load :active_record do
|
46
45
|
require 'active_decorator/monkey/active_record/associations'
|
47
46
|
ActiveRecord::Associations::Association.send :prepend, ActiveDecorator::Monkey::ActiveRecord::Associations::Association
|
47
|
+
|
48
48
|
if Rails.version.to_f < 5.1
|
49
49
|
ActiveRecord::Associations::CollectionAssociation.send :prepend, ActiveDecorator::Monkey::ActiveRecord::Associations::CollectionAssociation
|
50
50
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
|
52
|
+
ActiveRecord::AssociationRelation.send :prepend, ActiveDecorator::Monkey::ActiveRecord::AssociationRelation
|
53
|
+
|
54
|
+
ActiveRecord::Associations::CollectionProxy.send :prepend, ActiveDecorator::Monkey::ActiveRecord::Associations::CollectionProxy
|
55
|
+
ActiveRecord::Associations::CollectionAssociation.send :prepend, ActiveDecorator::Monkey::ActiveRecord::Associations::CollectionAssociation
|
54
56
|
end
|
55
57
|
end
|
56
58
|
end
|
@@ -32,17 +32,9 @@ module ActiveDecorator
|
|
32
32
|
extend ActiveSupport::Concern
|
33
33
|
|
34
34
|
included do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
blk.call
|
39
|
-
end
|
40
|
-
end
|
41
|
-
else
|
42
|
-
around_filter do |controller, blk|
|
43
|
-
ActiveDecorator::ViewContext.run_with(controller.view_context) do
|
44
|
-
blk.call
|
45
|
-
end
|
35
|
+
around_action do |controller, blk|
|
36
|
+
ActiveDecorator::ViewContext.run_with(controller.view_context) do
|
37
|
+
blk.call
|
46
38
|
end
|
47
39
|
end
|
48
40
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= @author.capitalized_name %>
|
3
3
|
<%= @author.books.first.upcased_title %>
|
4
4
|
<%= @author.books.last.upcased_title %>
|
5
|
-
<% if
|
5
|
+
<% if p = @author.publishers.take %><%= p.upcased_name %><% end %>
|
6
6
|
<% if Rails.version.to_f >= 5.1 && p = @author.publishers.second_to_last %><%= p.reversed_name %><% end %>
|
7
7
|
<% if p = @author.profile %><%= p.address %><% end %>
|
8
8
|
<% if h = @author.profile_history %><%= h.update_date %><% end %>
|
data/test/fake_app/fake_app.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
4
|
+
|
3
5
|
require 'active_record'
|
4
6
|
require 'action_controller/railtie'
|
5
7
|
require 'action_mailer/railtie'
|
@@ -173,24 +175,13 @@ unless ENV['API']
|
|
173
175
|
end
|
174
176
|
class AuthorsController < ApplicationController
|
175
177
|
def index
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
@authors = RelationProxy.new(Author.scoped)
|
182
|
-
else
|
183
|
-
@authors = Author.scoped
|
184
|
-
end
|
178
|
+
# ActiveRecord 4.x
|
179
|
+
if params[:variable_type] == 'array'
|
180
|
+
@authors = Author.all.to_a
|
181
|
+
elsif params[:variable_type] == 'proxy'
|
182
|
+
@authors = RelationProxy.new(Author.all)
|
185
183
|
else
|
186
|
-
|
187
|
-
if params[:variable_type] == 'array'
|
188
|
-
@authors = Author.all.to_a
|
189
|
-
elsif params[:variable_type] == 'proxy'
|
190
|
-
@authors = RelationProxy.new(Author.all)
|
191
|
-
else
|
192
|
-
@authors = Author.all
|
193
|
-
end
|
184
|
+
@authors = Author.all
|
194
185
|
end
|
195
186
|
end
|
196
187
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
|
-
class
|
5
|
+
class AssociationIntegrationTest < ActionDispatch::IntegrationTest
|
6
6
|
setup do
|
7
7
|
company = Company.create! name: 'NaCl'
|
8
8
|
@matz = company.authors.create! name: 'matz'
|
@@ -23,9 +23,7 @@ class AssociationTest < ActionDispatch::IntegrationTest
|
|
23
23
|
visit "/authors/#{@matz.id}"
|
24
24
|
assert page.has_content? 'the world of code'.upcase
|
25
25
|
assert page.has_content? 'the ruby programming language'.upcase
|
26
|
-
|
27
|
-
assert page.has_content? 'nikkei linux'.upcase
|
28
|
-
end
|
26
|
+
assert page.has_content? 'nikkei linux'.upcase
|
29
27
|
if Rails.version.to_f >= 5.1
|
30
28
|
assert page.has_content? 'nikkei linux'.reverse
|
31
29
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class AssociationTest < Test::Unit::TestCase
|
6
|
+
setup do
|
7
|
+
a = Author.create! name: 'pragdave'
|
8
|
+
ActiveDecorator::Decorator.instance.decorate a
|
9
|
+
|
10
|
+
@books = a.books
|
11
|
+
|
12
|
+
b = @books.create! title: 'pragprog'
|
13
|
+
@id = b.id
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'build' do
|
17
|
+
b = @books.build title: 'pickaxe'
|
18
|
+
assert b.is_a? ActiveDecorator::Decorated
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'create!' do
|
22
|
+
b = @books.create! title: 'pickaxe'
|
23
|
+
assert b.is_a? ActiveDecorator::Decorated
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'each' do
|
27
|
+
@books.each do |b|
|
28
|
+
assert b.is_a? ActiveDecorator::Decorated
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
test 'first' do
|
33
|
+
assert @books.first.is_a? ActiveDecorator::Decorated
|
34
|
+
end
|
35
|
+
|
36
|
+
test 'last' do
|
37
|
+
assert @books.last.is_a? ActiveDecorator::Decorated
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'find' do
|
41
|
+
assert @books.find(@id).is_a? ActiveDecorator::Decorated
|
42
|
+
end
|
43
|
+
|
44
|
+
test 'take' do
|
45
|
+
assert @books.take.is_a? ActiveDecorator::Decorated
|
46
|
+
end
|
47
|
+
|
48
|
+
sub_test_case 'when method chained' do
|
49
|
+
setup do
|
50
|
+
@books = @books.order(:id)
|
51
|
+
end
|
52
|
+
|
53
|
+
test 'each' do
|
54
|
+
@books.each do |b|
|
55
|
+
assert b.is_a? ActiveDecorator::Decorated
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
test 'first' do
|
60
|
+
assert @books.first.is_a? ActiveDecorator::Decorated
|
61
|
+
end
|
62
|
+
|
63
|
+
test 'last' do
|
64
|
+
assert @books.last.is_a? ActiveDecorator::Decorated
|
65
|
+
end
|
66
|
+
|
67
|
+
test 'find' do
|
68
|
+
assert @books.find(@id).is_a? ActiveDecorator::Decorated
|
69
|
+
end
|
70
|
+
|
71
|
+
test 'take' do
|
72
|
+
assert @books.take.is_a? ActiveDecorator::Decorated
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_decorator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit-rails
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: byebug
|
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'
|
111
125
|
description: A simple and Rubyish view helper for Rails
|
112
126
|
email:
|
113
127
|
- ronnie@dio.jp
|
@@ -123,13 +137,11 @@ files:
|
|
123
137
|
- README.md
|
124
138
|
- Rakefile
|
125
139
|
- active_decorator.gemspec
|
126
|
-
- gemfiles/Gemfile-rails.3.2.x
|
127
|
-
- gemfiles/Gemfile-rails.4.0.x
|
128
|
-
- gemfiles/Gemfile-rails.4.1.x
|
129
140
|
- gemfiles/Gemfile-rails.4.2.x
|
130
141
|
- gemfiles/Gemfile-rails.5.0.x
|
131
142
|
- gemfiles/Gemfile-rails.5.1.x
|
132
143
|
- gemfiles/Gemfile-rails.5.2.x
|
144
|
+
- gemfiles/Gemfile-rails.6.0.x
|
133
145
|
- gemfiles/Gemfile-rails.edge
|
134
146
|
- lib/active_decorator.rb
|
135
147
|
- lib/active_decorator/config.rb
|
@@ -177,6 +189,7 @@ files:
|
|
177
189
|
- test/features/jbuilder_test.rb
|
178
190
|
- test/features/name_error_handling_test.rb
|
179
191
|
- test/features/partial_test.rb
|
192
|
+
- test/models/association_test.rb
|
180
193
|
- test/test_helper.rb
|
181
194
|
homepage: https://github.com/amatsuda/active_decorator
|
182
195
|
licenses:
|
@@ -229,4 +242,5 @@ test_files:
|
|
229
242
|
- test/features/jbuilder_test.rb
|
230
243
|
- test/features/name_error_handling_test.rb
|
231
244
|
- test/features/partial_test.rb
|
245
|
+
- test/models/association_test.rb
|
232
246
|
- test/test_helper.rb
|