active_decorator 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/active_decorator.gemspec +2 -0
- data/gemfiles/Gemfile-rails.6.0.x +1 -1
- data/lib/active_decorator/decorator.rb +1 -1
- data/lib/active_decorator/version.rb +1 -1
- data/lib/generators/rails/templates/decorator.rb +2 -0
- data/lib/generators/rspec/templates/decorator_spec.rb +2 -0
- data/lib/generators/test_unit/templates/decorator_test.rb +2 -0
- data/test/decorator_test.rb +7 -0
- data/test/fake_app/app/decorators/comic_decorator.rb +5 -0
- data/test/fake_app/fake_app.rb +4 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9312dab89b8f57877eac8447beff11151b7399640c9a457aa51d9251a0779792
|
4
|
+
data.tar.gz: d09cceaf7f064a6536d983fdb577bdbca11aba51046faaee021887ca112b1bed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1d98fea1b67c618239dc865b913a8f1ccf32097ca19b7e2adc2679bb3668ce57a981ddcc5940aa3b5388d85ac7fe01eb4cd51bd8005944253016112d53e5c1c
|
7
|
+
data.tar.gz: 9314835959902259af91f0909abd3b299dc7b7a30730323b235e51a231d8d9ce644145c457cfeae526b18a600dbf3561dcbf9072219ad17a9d980a1ec3c0595a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.3.1
|
2
|
+
|
3
|
+
* Switched back from Ruby's `const_get` to Active Support `constantize` for fetching decorator modules, due to inability to properly detect namespaced decorator [@sinsoku]
|
4
|
+
|
1
5
|
## 1.3.0
|
2
6
|
|
3
7
|
* Switched from Active Support `constantize` to Ruby's `const_get` when fetching decorator modules
|
data/active_decorator.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
+
s.add_dependency 'activesupport'
|
22
|
+
|
21
23
|
s.add_development_dependency 'test-unit-rails'
|
22
24
|
s.add_development_dependency 'selenium-webdriver'
|
23
25
|
s.add_development_dependency 'puma'
|
@@ -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 =
|
72
|
+
d = decorator_name.constantize
|
73
73
|
unless Class === d
|
74
74
|
d.send :include, ActiveDecorator::Helpers
|
75
75
|
@@decorators[model_class] = d
|
data/test/decorator_test.rb
CHANGED
@@ -48,4 +48,11 @@ class DecoratorTest < Test::Unit::TestCase
|
|
48
48
|
assert value.is_a?(BookDecorator)
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
test "Don't use the wrong decorator for nested classes" do
|
53
|
+
comic = Foo::Comic.new
|
54
|
+
|
55
|
+
assert_equal comic, ActiveDecorator::Decorator.instance.decorate(comic)
|
56
|
+
assert !comic.is_a?(ComicDecorator)
|
57
|
+
end
|
51
58
|
end
|
data/test/fake_app/fake_app.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_decorator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
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-08-16 00:00:00.000000000 Z
|
12
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'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: test-unit-rails
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +179,7 @@ files:
|
|
165
179
|
- test/configuration_test.rb
|
166
180
|
- test/controllers/fake_detection_test.rb
|
167
181
|
- test/decorator_test.rb
|
182
|
+
- test/fake_app/app/decorators/comic_decorator.rb
|
168
183
|
- test/fake_app/app/views/api/bookstores/show.json.jbuilder
|
169
184
|
- test/fake_app/app/views/authors/index.html.erb
|
170
185
|
- test/fake_app/app/views/authors/show.html.erb
|
@@ -218,6 +233,7 @@ test_files:
|
|
218
233
|
- test/configuration_test.rb
|
219
234
|
- test/controllers/fake_detection_test.rb
|
220
235
|
- test/decorator_test.rb
|
236
|
+
- test/fake_app/app/decorators/comic_decorator.rb
|
221
237
|
- test/fake_app/app/views/api/bookstores/show.json.jbuilder
|
222
238
|
- test/fake_app/app/views/authors/index.html.erb
|
223
239
|
- test/fake_app/app/views/authors/show.html.erb
|