active_decorator 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95d46d933899535231f0e24953747370ac289afed99ac881dd91a1bafca06d00
4
- data.tar.gz: '08989f206e82987244927a07c17f147f59f25c268bb61b59763dbed7cf11aa06'
3
+ metadata.gz: aaf638a40c289f98d04544cf74fb6fc4ed4e6d900e9624612ad4369a61b2032d
4
+ data.tar.gz: 014c96599fa99736ff84c75571a95e6ad49bb24d99220e382b78e8516f746759
5
5
  SHA512:
6
- metadata.gz: e89c4cc6d373b308858919ebf119c18bc3547e09d0f0dda9d1c52643a844eb50696aac9f5e0372f7c274acbe5d3f34db5b66ad02db62cd3a0808f7c3b566436b
7
- data.tar.gz: d62771d0c66da65522e8a3b05ba03a5bce188da0c6bad782bac5d8b7d53827ca5471fbd756e7533b7b4701b4539f0a038098c0be37dac514b688c32821b1cd93
6
+ metadata.gz: f2270ef449d855e51524d81ba1feeda5582732969dd622a0e2e4cc4b700e8e0d1529e0f891ca39572f2c03c41cd6143a2809c8dad27fcfdca1c3408434445ee0
7
+ data.tar.gz: 515a67fa6e3964ec7b8ece6a6ec4d410fd4479aac285d2bd2d6c59eeea023a35123b54b3bb0c0e4481931328d89200c682f7756db534934d59b90ff6b52984c9
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ Gemfile.lock
4
4
  gemfiles/*.lock
5
5
  pkg/*
6
6
  log
7
+ tmp
@@ -11,84 +11,78 @@ before_install:
11
11
  - sudo apt update -qq
12
12
  - sudo apt install -y chromium-chromedriver
13
13
  - sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/
14
- - gem update bundler --no-document
15
-
16
- rvm:
17
- - 2.5.3
18
- - 2.4.5
19
- - 2.3.7
20
- - 2.2.10
21
- - 2.1.10
22
- - 2.0.0
23
- gemfile:
24
- - gemfiles/Gemfile-rails.5.2.x
25
- - gemfiles/Gemfile-rails.5.1.x
26
- - gemfiles/Gemfile-rails.5.0.x
27
- - gemfiles/Gemfile-rails.4.2.x
28
- - gemfiles/Gemfile-rails.4.1.x
29
- - gemfiles/Gemfile-rails.4.0.x
30
- - gemfiles/Gemfile-rails.3.2.x
14
+ - gem i bundler -v '<2'
15
+
16
+ # rvm:
17
+ # - 2.6.2
18
+ # - 2.5.5
19
+ # - 2.4.5
20
+ # - 2.3.8
21
+ # - 2.2.10
22
+ # - 2.1.10
23
+ # - 2.0.0
24
+ # gemfile:
25
+ # - gemfiles/Gemfile-rails.5.2.x
26
+ # - gemfiles/Gemfile-rails.5.1.x
27
+ # - gemfiles/Gemfile-rails.5.0.x
28
+ # - 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
31
32
 
32
33
  matrix:
33
- exclude:
34
- - rvm: 2.1.10
34
+ include:
35
+ - rvm: 2.6.2
35
36
  gemfile: gemfiles/Gemfile-rails.5.2.x
36
- - rvm: 2.0.0
37
+ - rvm: 2.6.2
37
38
  gemfile: gemfiles/Gemfile-rails.5.2.x
38
- - rvm: 2.4.5
39
- gemfile: gemfiles/Gemfile-rails.5.1.x
40
- - rvm: 2.3.7
41
- gemfile: gemfiles/Gemfile-rails.5.1.x
42
- - rvm: 2.1.10
39
+ env: API=1
40
+ - rvm: 2.6.2
43
41
  gemfile: gemfiles/Gemfile-rails.5.1.x
44
- - rvm: 2.0.0
42
+ - rvm: 2.6.2
45
43
  gemfile: gemfiles/Gemfile-rails.5.1.x
46
- - rvm: 2.4.5
47
- gemfile: gemfiles/Gemfile-rails.5.0.x
48
- - rvm: 2.3.7
49
- gemfile: gemfiles/Gemfile-rails.5.0.x
50
- - rvm: 2.1.10
44
+ env: API=1
45
+ - rvm: 2.6.2
51
46
  gemfile: gemfiles/Gemfile-rails.5.0.x
52
- - rvm: 2.0.0
47
+ - rvm: 2.6.2
53
48
  gemfile: gemfiles/Gemfile-rails.5.0.x
54
- - rvm: 2.5.3
55
- gemfile: gemfiles/Gemfile-rails.4.2.x
49
+ env: API=1
50
+
51
+ - rvm: 2.5.5
52
+ gemfile: gemfiles/Gemfile-rails.5.2.x
53
+
56
54
  - rvm: 2.4.5
55
+ gemfile: gemfiles/Gemfile-rails.5.2.x
56
+
57
+ - rvm: 2.3.8
58
+ gemfile: gemfiles/Gemfile-rails.5.2.x
59
+ - rvm: 2.3.8
57
60
  gemfile: gemfiles/Gemfile-rails.4.2.x
58
- - rvm: 2.5.3
59
- gemfile: gemfiles/Gemfile-rails.4.1.x
60
- - rvm: 2.4.5
61
- gemfile: gemfiles/Gemfile-rails.4.1.x
62
- - rvm: 2.2.10
61
+ - rvm: 2.3.8
63
62
  gemfile: gemfiles/Gemfile-rails.4.1.x
64
- - rvm: 2.1.10
65
- gemfile: gemfiles/Gemfile-rails.4.1.x
66
- - rvm: 2.5.3
67
- gemfile: gemfiles/Gemfile-rails.4.0.x
68
- - rvm: 2.4.5
63
+ - rvm: 2.3.8
69
64
  gemfile: gemfiles/Gemfile-rails.4.0.x
65
+
70
66
  - rvm: 2.2.10
71
- gemfile: gemfiles/Gemfile-rails.4.0.x
67
+ gemfile: gemfiles/Gemfile-rails.5.2.x
68
+
72
69
  - rvm: 2.1.10
73
- gemfile: gemfiles/Gemfile-rails.4.0.x
74
- - rvm: 2.5.3
75
- gemfile: gemfiles/Gemfile-rails.3.2.x
76
- - rvm: 2.4.5
70
+ gemfile: gemfiles/Gemfile-rails.4.2.x
71
+
72
+ - rvm: 2.0.0
73
+ gemfile: gemfiles/Gemfile-rails.4.2.x
74
+
75
+ - rvm: 2.0.0
77
76
  gemfile: gemfiles/Gemfile-rails.3.2.x
78
- include:
77
+
78
+
79
79
  - rvm: ruby-head
80
80
  gemfile: gemfiles/Gemfile-rails.edge
81
- - rvm: 2.5.3
82
- gemfile: gemfiles/Gemfile-rails.5.2.x
83
- env: API=1
84
- - rvm: 2.5.3
85
- gemfile: gemfiles/Gemfile-rails.5.1.x
86
- env: API=1
87
- - rvm: 2.5.3
88
- gemfile: gemfiles/Gemfile-rails.5.0.x
89
- env: API=1
81
+
90
82
  - rvm: ruby-head
91
83
  gemfile: gemfiles/Gemfile-rails.edge
92
84
  env: API=1
85
+
93
86
  allow_failures:
94
87
  - rvm: ruby-head
88
+ - gemfile: gemfiles/Gemfile-rails.edge
data/README.md CHANGED
@@ -15,7 +15,7 @@ A simple and Rubyish view helper for Rails 3, Rails 4, Rails 5, and Rails 6. Kee
15
15
 
16
16
  ## Supported versions ##
17
17
 
18
- * Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, and 2.5, and 2.6 (trunk)
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
20
  * Rails 3.2.x, 4.0.x, 4.1.x, 4.2.x, 5.0, 5.1, 5.2, and 6.0 (edge)
21
21
 
@@ -22,7 +22,7 @@ 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', '< 1.4'
26
26
  s.add_development_dependency 'rake'
27
27
  s.add_development_dependency 'jbuilder'
28
28
  end
@@ -15,6 +15,7 @@ module ActiveDecorator
15
15
  # Decorates the given object.
16
16
  # Plus, performs special decoration for the classes below:
17
17
  # Array: decorates its each element
18
+ # Hash: decorates its each value
18
19
  # AR::Relation: decorates its each record lazily
19
20
  # AR model: decorates its associations on the fly
20
21
  #
@@ -29,6 +30,10 @@ module ActiveDecorator
29
30
  obj.each do |r|
30
31
  decorate r
31
32
  end
33
+ elsif obj.is_a?(Hash)
34
+ obj.values.each do |v|
35
+ decorate v
36
+ end
32
37
  elsif defined?(ActiveRecord) && obj.is_a?(ActiveRecord::Relation)
33
38
  # don't call each nor to_a immediately
34
39
  if obj.respond_to?(:records)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveDecorator
4
- VERSION = '1.1.1'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -3,7 +3,6 @@
3
3
  require 'test_helper'
4
4
 
5
5
  class DecoratorTest < Test::Unit::TestCase
6
-
7
6
  test 'it returns the object on decoration' do
8
7
  book = Book.new title: 'Boek'
9
8
  assert_equal book, ActiveDecorator::Decorator.instance.decorate(book)
@@ -31,4 +30,22 @@ class DecoratorTest < Test::Unit::TestCase
31
30
  books = Book.all
32
31
  assert_equal books, ActiveDecorator::Decorator.instance.decorate(ActiveDecorator::Decorator.instance.decorate(books))
33
32
  end
33
+
34
+ test 'decorating Array decorates its each element' do
35
+ array = [Book.new(title: 'Boek')]
36
+ assert_equal array, ActiveDecorator::Decorator.instance.decorate(array)
37
+
38
+ array.each do |value|
39
+ assert value.is_a?(BookDecorator)
40
+ end
41
+ end
42
+
43
+ test 'decorating Hash decorates its each value' do
44
+ hash = {some_record: Book.new(title: 'Boek')}
45
+ assert_equal hash, ActiveDecorator::Decorator.instance.decorate(hash)
46
+
47
+ hash.values.each do |value|
48
+ assert value.is_a?(BookDecorator)
49
+ end
50
+ end
34
51
  end
@@ -30,7 +30,11 @@ rescue LoadError
30
30
  include Capybara::DSL
31
31
  end
32
32
  else
33
- ActionDispatch::SystemTestCase.driven_by(:selenium, using: :headless_chrome)
33
+ if ActionPack::VERSION::STRING > '5.2'
34
+ ActionDispatch::SystemTestCase.driven_by :selenium, using: :headless_chrome
35
+ else
36
+ ActionDispatch::SystemTestCase.driven_by :selenium_chrome_headless
37
+ end
34
38
  end
35
39
 
36
40
  module DatabaseDeleter
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.1.1
4
+ version: 1.2.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: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2019-04-01 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: '0'
75
+ version: '1.4'
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: '0'
82
+ version: '1.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -197,8 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.7.6
200
+ rubygems_version: 3.0.3
202
201
  signing_key:
203
202
  specification_version: 4
204
203
  summary: A simple and Rubyish view helper for Rails