show_for 0.4.0 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bf7d8896e8ef6cf4029dec5b1be980ab4fdda13c
4
- data.tar.gz: 8bcebe6966ece81c1485ce5fb94b691601817433
2
+ SHA256:
3
+ metadata.gz: f887e097d4512d2b054ca7dde3017a18c4389d6fe376a254518474fb266e99da
4
+ data.tar.gz: 6f1be23083f6459f303f87a5060d3ae7494c15d9754db16d0a2565aa1ef595d3
5
5
  SHA512:
6
- metadata.gz: 2f87342c9090ec41e3e52e12a2aa5b78f54707060c26240b23d91f50a2f1883aa3c3e95c87b6d53064bf9c1168e2f12105db5c7c16caef43a5b9f1d0c287ec74
7
- data.tar.gz: 90ae998a6a90834359f9df100d55e7fb525a3e5d97ecc0b90e6c70fcb311f93b9a6cfd2aee8e2931ef18448f9c46017298577306b337829562c10d8b4a5c77de
6
+ metadata.gz: 73ca01b5978117f4b942f7784cb8da9d7b3651ab1ad3c8b6995864fd057e7af172e17f7035d24467fdc1171bb00385a9314b26b71abdfe9d6cf5d05a1d50bcb4
7
+ data.tar.gz: b122b66cdc14e4db341337e37b1f23726354580448e3e311c4d3ba49b54d06bb4bd448a3edec6a29aaad5274999ec5f021268dd25c0120591eef9c0d15f68f76
@@ -1,3 +1,32 @@
1
+ ## 0.8.0
2
+
3
+ * Respect `nil` value when provided, by skipping model attribute value.
4
+ * Add support for Ruby 3.0, drop support for Ruby < 2.5.
5
+ * Add support for Rails 6.1, drop support for Rails < 5.2.
6
+ * Move CI to GitHub Actions.
7
+
8
+ ## 0.7.0
9
+
10
+ * Add support for Rails 6.0.
11
+ * Drop support for Rails < 5.0 and Ruby < 2.4.
12
+
13
+ ## 0.6.1
14
+
15
+ * Add support for Rails 5.2.
16
+ * Fix issue causing blank class not being applied to field wrapper when the result of a Proc is empty.
17
+
18
+ ## 0.6.0
19
+
20
+ * Relaxed dependencies to support Rails 5.1.
21
+
22
+ ## 0.5.0
23
+
24
+ * Relaxed dependencies to support Rails 5.
25
+ * Removed support for Rails `3.2` and `4.0` and Ruby `1.9.3` and `2.0.0`.
26
+
27
+ ### enhancements
28
+ * Do not generate label/content/wrapper/collection classes when config is set to `nil`.
29
+
1
30
  ## 0.4.0
2
31
 
3
32
  ### enhancements
@@ -101,7 +130,7 @@
101
130
  ## 0.1.2
102
131
 
103
132
  ### enhancements
104
- * allow `f.attribute :nickname, :in => :profile` as association shortcut
133
+ * allow `f.attribute :nickname, in: :profile` as association shortcut
105
134
 
106
135
  ### deprecations
107
136
  * `:method` now becomes `:using`
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2015 Plataformatec http://plataformatec.com.br/
1
+ Copyright (c) 2012-2019 Plataformatec http://plataformatec.com.br/
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,26 +1,25 @@
1
1
  # ShowFor
2
2
 
3
3
  [![Gem Version](https://fury-badge.herokuapp.com/rb/show_for.png)](http://badge.fury.io/rb/show_for)
4
- [![Build Status](https://api.travis-ci.org/plataformatec/show_for.png?branch=master)](http://travis-ci.org/plataformatec/show_for)
5
- [![Code Climate](https://codeclimate.com/github/plataformatec/show_for.png)](https://codeclimate.com/github/plataformatec/show_for)
4
+ [![Code Climate](https://codeclimate.com/github/heartcombo/show_for.png)](https://codeclimate.com/github/heartcombo/show_for)
6
5
 
7
6
  ShowFor allows you to quickly show a model information with I18n features.
8
7
 
9
8
  ```erb
10
9
  <%= show_for @user do |u| %>
11
10
  <%= u.attribute :name %>
12
- <%= u.attribute :nickname, :in => :profile %>
11
+ <%= u.attribute :nickname, in: :profile %>
13
12
  <%= u.attribute :confirmed? %>
14
- <%= u.attribute :created_at, :format => :short %>
15
- <%= u.attribute :last_sign_in_at, :if_blank => "User did not access yet",
16
- :wrapper_html => { :id => "sign_in_timestamp" } %>
13
+ <%= u.attribute :created_at, format: :short %>
14
+ <%= u.attribute :last_sign_in_at, if_blank: "User did not access yet",
15
+ wrapper_html: { id: "sign_in_timestamp" } %>
17
16
 
18
17
  <%= u.attribute :photo do %>
19
18
  <%= image_tag(@user.photo_url) %>
20
19
  <% end %>
21
20
 
22
21
  <%= u.association :company %>
23
- <%= u.association :tags, :to_sentence => true %>
22
+ <%= u.association :tags, to_sentence: true %>
24
23
  <% end %>
25
24
  ```
26
25
 
@@ -40,7 +39,7 @@ Run the generator:
40
39
 
41
40
  And you are ready to go.
42
41
 
43
- Note: This branch aims Rails 3.2 and 4 support, so if you want to use it with
42
+ Note: This branch aims Rails 5 and 6 support, so if you want to use it with
44
43
  older versions of Rails, check out the available branches.
45
44
 
46
45
  ## Usage
@@ -50,11 +49,11 @@ ShowFor allows you to quickly show a model information with I18n features.
50
49
  ```erb
51
50
  <%= show_for @admin do |a| %>
52
51
  <%= a.attribute :name %>
53
- <%= a.attribute :login, :value => :upcase %>
52
+ <%= a.attribute :login, value: :upcase %>
54
53
  <%= a.attribute :confirmed? %>
55
- <%= a.attribute :created_at, :format => :short %>
56
- <%= a.attribute :last_sign_in_at, :if_blank => "Administrator did not access yet"
57
- :wrapper_html => { :id => "sign_in_timestamp" } %>
54
+ <%= a.attribute :created_at, format: :short %>
55
+ <%= a.attribute :last_sign_in_at, if_blank: "Administrator did not access yet"
56
+ wrapper_html: { id: "sign_in_timestamp" } %>
58
57
 
59
58
  <%= a.attribute :photo do %>
60
59
  <%= image_tag(@admin.photo_url) %>
@@ -141,8 +140,8 @@ ShowFor also exposes the label method. In case you want to use the default
141
140
  `human_attribute_name` lookup and the default wrapping:
142
141
 
143
142
  ```ruby
144
- a.label :name #=> <strong class="label">Name</strong>
145
- a.label "Name", :id => "my_name" #=> <strong class="label" id="my_name">Name</strong>
143
+ a.label :name #=> <strong class="label">Name</strong>
144
+ a.label "Name", id: "my_name" #=> <strong class="label" id="my_name">Name</strong>
146
145
  ```
147
146
 
148
147
  Optionally, if you want to wrap the inner part of the label with some text
@@ -163,16 +162,16 @@ ShowFor also supports associations.
163
162
  ```erb
164
163
  <%= show_for @artwork do |a| %>
165
164
  <%= a.association :artist %>
166
- <%= a.association :artist, :using => :name_with_title %>
167
- <%= a.attribute :name_with_title, :in => :artist %>
165
+ <%= a.association :artist, using: :name_with_title %>
166
+ <%= a.attribute :name_with_title, in: :artist %>
168
167
 
169
168
  <%= a.association :tags %>
170
- <%= a.association :tags, :to_sentence => true %>
169
+ <%= a.association :tags, to_sentence: true %>
171
170
  <%= a.association :tags do
172
171
  @artwork.tags.map(&:name).to_sentence
173
172
  end %>
174
173
 
175
- <%= a.association :fans, :collection_tag => :ol do |fan| %>
174
+ <%= a.association :fans, collection_tag: :ol do |fan| %>
176
175
  <li><%= link_to fan.name, fan %></li>
177
176
  <% end %>
178
177
  <% end %>
@@ -196,7 +195,7 @@ collection objects.
196
195
  Here are some other examples of the many possibilites to custom the output content:
197
196
 
198
197
  ```erb
199
- <%= u.association :relationships, :label => 'test' do %>
198
+ <%= u.association :relationships, label: 'test' do %>
200
199
  <% @user.relationships.each do |relation| %>
201
200
  <%= relation.related_user.name if relation.related_user_role == 'supervisor' %>
202
201
  <% end %>
@@ -216,10 +215,17 @@ Here are some other examples of the many possibilites to custom the output conte
216
215
 
217
216
  * Jonas Grimfelt (http://github.com/grimen)
218
217
 
218
+ ## Supported Ruby / Rails versions
219
+
220
+ We intend to maintain support for all Ruby / Rails versions that haven't reached end-of-life.
221
+
222
+ For more information about specific versions please check [Ruby](https://www.ruby-lang.org/en/downloads/branches/)
223
+ and [Rails](https://guides.rubyonrails.org/maintenance_policy.html) maintenance policies, and our test matrix.
224
+
219
225
  ## Bugs and Feedback
220
226
 
221
227
  If you discover any bugs or want to drop a line, feel free to create an issue on GitHub.
222
228
 
223
- http://github.com/plataformatec/show_for/issues
229
+ http://github.com/heartcombo/show_for/issues
224
230
 
225
- MIT License. Copyright 2012-2015 Plataformatec. http://plataformatec.com.br
231
+ MIT License. Copyright 2012-2019 Plataformatec. http://plataformatec.com.br
@@ -2,7 +2,7 @@ module ShowFor
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
  desc "Copy ShowFor installation files"
5
- class_option :template_engine, :desc => 'Template engine to be invoked (erb or haml or slim).'
5
+ class_option :template_engine, desc: 'Template engine to be invoked (erb or haml or slim).'
6
6
  source_root File.expand_path('../templates', __FILE__)
7
7
 
8
8
  def copy_initializers
@@ -1,6 +1,6 @@
1
1
  module ShowFor
2
2
  module Association
3
- def attribute(attribute_name, options={}, &block)
3
+ def attribute(attribute_name, options = {}, &block)
4
4
  if association_name = options.delete(:in)
5
5
  options[:using] = attribute_name
6
6
  association(association_name, options, &block)
@@ -9,7 +9,7 @@ module ShowFor
9
9
  end
10
10
  end
11
11
 
12
- def association(association_name, options={}, &block)
12
+ def association(association_name, options = {}, &block)
13
13
  apply_default_options!(association_name, options)
14
14
 
15
15
  # If a block with an iterator was given, no need to calculate the labels
@@ -1,6 +1,6 @@
1
1
  module ShowFor
2
2
  module Attribute
3
- def attribute(attribute_name, options={}, &block)
3
+ def attribute(attribute_name, options = {}, &block)
4
4
  apply_default_options!(attribute_name, options)
5
5
  block = block_from_value_option(attribute_name, options) unless block
6
6
  collection_block, block = block, nil if collection_block?(block)
@@ -10,7 +10,7 @@ module ShowFor
10
10
  wrap_label_and_content(attribute_name, value, options, &collection_block)
11
11
  end
12
12
 
13
- def value(attribute_name, options={}, &block)
13
+ def value(attribute_name, options = {}, &block)
14
14
  apply_default_options!(attribute_name, options)
15
15
  collection_block, block = block, nil if collection_block?(block)
16
16
 
@@ -38,10 +38,9 @@ module ShowFor
38
38
  end
39
39
 
40
40
  def block_from_value_option(attribute_name, options)
41
- case options[:value]
42
- when nil
41
+ if !options.has_key?(:value)
43
42
  nil
44
- when Symbol
43
+ elsif options[:value].is_a?(Symbol)
45
44
  block_from_symbol(attribute_name, options)
46
45
  else
47
46
  lambda { options[:value].to_s }
@@ -59,4 +58,3 @@ module ShowFor
59
58
  end
60
59
  end
61
60
  end
62
-
@@ -53,7 +53,7 @@ module ShowFor
53
53
 
54
54
  def apply_wrapper_options!(type, options, value)
55
55
  options[:"#{type}_html"] ||= {}
56
- options[:"#{type}_html"][:class] = [options[:"#{type}_html"][:class], ShowFor.blank_content_class].join(' ') if value.blank? && value != false
56
+ options[:"#{type}_html"][:class] = [options[:"#{type}_html"][:class], ShowFor.blank_content_class].join(' ') if is_empty?(value)
57
57
  options
58
58
  end
59
59
 
@@ -67,7 +67,7 @@ module ShowFor
67
67
  if tag
68
68
  type_class = ShowFor.send :"#{type}_class"
69
69
  html_options = options.delete(:"#{type}_html") || {}
70
- html_options[:class] = "#{type_class} #{html_options[:class]}".rstrip
70
+ html_options[:class] = [type_class, html_options[:class]].compact.presence
71
71
  @template.content_tag(tag, content, html_options)
72
72
  else
73
73
  content
@@ -84,6 +84,11 @@ module ShowFor
84
84
  def skip_blanks?(value) #:nodoc:
85
85
  ShowFor.skip_blanks && value.blank? && value != false
86
86
  end
87
+
88
+ def is_empty?(value) #:nodoc:
89
+ value = @template.capture(&value) if value.is_a?(Proc)
90
+ value.blank? && value != false
91
+ end
87
92
  end
88
93
  end
89
94
 
@@ -1,6 +1,6 @@
1
1
  module ShowFor
2
2
  module Content
3
- def content(value, options={}, apply_options=true, &block)
3
+ def content(value, options = {}, apply_options = true, &block)
4
4
  # cache value for apply_wrapper_options!
5
5
  sample_value = value
6
6
 
@@ -10,11 +10,11 @@ module ShowFor
10
10
 
11
11
  content = case value
12
12
  when Date, Time, DateTime
13
- I18n.l value, :format => options.delete(:format) || ShowFor.i18n_format
13
+ I18n.l value, format: options.delete(:format) || ShowFor.i18n_format
14
14
  when TrueClass
15
- I18n.t :"show_for.yes", :default => "Yes"
15
+ I18n.t :"show_for.yes", default: "Yes"
16
16
  when FalseClass
17
- I18n.t :"show_for.no", :default => "No"
17
+ I18n.t :"show_for.no", default: "No"
18
18
  when Array, Hash
19
19
  collection_handler(value, options, &block) unless value.empty?
20
20
  when Proc
@@ -48,11 +48,11 @@ module ShowFor
48
48
  end
49
49
 
50
50
  def translate_blank_html
51
- template.t(:'show_for.blank_html', :default => translate_blank_text)
51
+ template.t(:'show_for.blank_html', default: translate_blank_text)
52
52
  end
53
53
 
54
54
  def translate_blank_text
55
- I18n.t(:'show_for.blank', :default => "Not specified")
55
+ I18n.t(:'show_for.blank', default: "Not specified")
56
56
  end
57
57
 
58
58
  def blank_value(options)
@@ -9,7 +9,7 @@ module ShowFor
9
9
  # f.attribute :email
10
10
  # end
11
11
  #
12
- def show_for(object, html_options={}, &block)
12
+ def show_for(object, html_options = {}, &block)
13
13
  html_options = html_options.dup
14
14
 
15
15
  tag = html_options.delete(:show_for_tag) || ShowFor.show_for_tag
@@ -1,6 +1,6 @@
1
1
  module ShowFor
2
2
  module Label
3
- def label(text_or_attribute, options={}, apply_options=true)
3
+ def label(text_or_attribute, options = {}, apply_options = true)
4
4
  label = if text_or_attribute.is_a?(String)
5
5
  text_or_attribute
6
6
  elsif options.key?(:label)
@@ -1,3 +1,3 @@
1
1
  module ShowFor
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.8.0".freeze
3
3
  end
@@ -7,17 +7,17 @@ class AssociationTest < ActionView::TestCase
7
7
  end
8
8
 
9
9
  test "show_for accepts :using as option to tell how to retrieve association value" do
10
- with_association_for @user, :company, :using => :alternate_name
10
+ with_association_for @user, :company, using: :alternate_name
11
11
  assert_select "div.show_for div.wrapper", /Alternate Plataformatec/
12
12
  end
13
13
 
14
14
  test "show_for accepts :in to tell to retrieve an attribute from association" do
15
- with_attribute_for @user, :alternate_name, :in => :company
15
+ with_attribute_for @user, :alternate_name, in: :company
16
16
  assert_select "div.show_for div.wrapper", /Alternate Plataformatec/
17
17
  end
18
18
 
19
19
  test "show_for forwards all options send with :in to association" do
20
- with_attribute_for @user, :alternate_name, :in => :tags, :to_sentence => true
20
+ with_attribute_for @user, :alternate_name, in: :tags, to_sentence: true
21
21
  assert_no_select "div.show_for div.wrapper ul.collection"
22
22
  assert_select "div.show_for div.wrapper", /Alternate Tag 1, Alternate Tag 2, and Alternate Tag 3/
23
23
  end
@@ -35,7 +35,7 @@ class AssociationTest < ActionView::TestCase
35
35
  []
36
36
  end
37
37
 
38
- swap ShowFor, :association_methods => [:name] do
38
+ swap ShowFor, association_methods: [:name] do
39
39
  with_association_for @user, :tags
40
40
  assert_no_select "div.show_for div.wrapper ul.collection"
41
41
  assert_no_select "div.show_for div.wrapper", /Enumerator/
@@ -47,7 +47,7 @@ class AssociationTest < ActionView::TestCase
47
47
  []
48
48
  end
49
49
 
50
- swap ShowFor, :association_methods => [:name] do
50
+ swap ShowFor, association_methods: [:name] do
51
51
  with_association_for @user, :tags do |tag|
52
52
  tag.name
53
53
  end
@@ -89,7 +89,7 @@ class AssociationTest < ActionView::TestCase
89
89
  end
90
90
 
91
91
  test "show_for accepts :using as option to tell how to retrieve association values" do
92
- with_association_for @user, :tags, :using => :alternate_name
92
+ with_association_for @user, :tags, using: :alternate_name
93
93
  assert_select "div.show_for div.wrapper ul.collection"
94
94
  assert_select "div.show_for div.wrapper ul.collection li", "Alternate Tag 1"
95
95
  assert_select "div.show_for div.wrapper ul.collection li", "Alternate Tag 2"
@@ -97,13 +97,13 @@ class AssociationTest < ActionView::TestCase
97
97
  end
98
98
 
99
99
  test "show_for accepts :to_sentence as option in collection associations" do
100
- with_association_for @user, :tags, :to_sentence => true
100
+ with_association_for @user, :tags, to_sentence: true
101
101
  assert_no_select "div.show_for div.wrapper ul.collection"
102
102
  assert_select "div.show_for div.wrapper", /Tag 1, Tag 2, and Tag 3/
103
103
  end
104
104
 
105
105
  test "show_for accepts :join as option in collection associations" do
106
- with_association_for @user, :tags, :join => ", "
106
+ with_association_for @user, :tags, join: ", "
107
107
  assert_no_select "div.show_for div.wrapper ul.collection"
108
108
  assert_select "div.show_for div.wrapper", /Tag 1, Tag 2, Tag 3/
109
109
  end
@@ -117,7 +117,7 @@ class AssociationTest < ActionView::TestCase
117
117
  end
118
118
 
119
119
  test "show_for accepts a block with argument in collection associations" do
120
- with_association_for @user, :tags, :collection_tag => :p do |tag|
120
+ with_association_for @user, :tags, collection_tag: :p do |tag|
121
121
  assert_kind_of Tag, tag
122
122
  content_tag(:span, tag.name)
123
123
  end
@@ -133,7 +133,7 @@ class AssociationTest < ActionView::TestCase
133
133
  []
134
134
  end
135
135
 
136
- swap ShowFor, :skip_blanks => true do
136
+ swap ShowFor, skip_blanks: true do
137
137
  with_association_for @user, :tags
138
138
  assert_no_select "div.show_for div.wrapper"
139
139
  end
@@ -144,7 +144,7 @@ class AssociationTest < ActionView::TestCase
144
144
  nil
145
145
  end
146
146
 
147
- swap ShowFor, :skip_blanks => true do
147
+ swap ShowFor, skip_blanks: true do
148
148
  with_association_for @user, :company
149
149
  assert_no_select "div.show_for div.wrapper"
150
150
  end
@@ -5,7 +5,7 @@ class AttributeTest < ActionView::TestCase
5
5
  test "show_for accepts an attribute as a collection" do
6
6
  with_attribute_for @user, :scopes
7
7
  assert_select "div.show_for div.wrapper ul.collection"
8
- assert_select "div.show_for div.wrapper ul.collection li", :count => 3
8
+ assert_select "div.show_for div.wrapper ul.collection li", count: 3
9
9
  end
10
10
 
11
11
  test "show_for accepts an attribute as a collection with a block to iterate the collection" do
@@ -13,48 +13,64 @@ class AttributeTest < ActionView::TestCase
13
13
  content_tag :span, scope
14
14
  end
15
15
  assert_select "div.show_for div.wrapper ul.collection"
16
- assert_select "div.show_for div.wrapper ul.collection span", :count => 3
16
+ assert_select "div.show_for div.wrapper ul.collection span", count: 3
17
17
  end
18
18
 
19
19
  test "show_for treats symbol for :value as method on each element of collection" do
20
- with_attribute_for @user, :scopes, :value => :upcase
20
+ with_attribute_for @user, :scopes, value: :upcase
21
21
  @user.scopes.each do |scope|
22
22
  assert_select "div.show_for div.wrapper ul.collection", /#{scope.upcase}/
23
23
  end
24
24
  end
25
25
 
26
26
  test "show_for allows collection tag to be configured globally" do
27
- swap ShowFor, :collection_tag => :ol, :collection_class => "my_collection" do
27
+ swap ShowFor, collection_tag: :ol, collection_class: "my_collection" do
28
28
  with_attribute_for @user, :scopes
29
29
  assert_select "div.show_for div.wrapper ol.my_collection"
30
30
  end
31
31
  end
32
32
 
33
+ test "show_for allows collection class to be disabled globally" do
34
+ swap ShowFor, collection_tag: :ol, collection_class: nil do
35
+ with_attribute_for @user, :scopes
36
+ assert_select "div.show_for div.wrapper ol"
37
+ assert_no_select "ol[class]"
38
+ end
39
+ end
40
+
33
41
  test "show_for allows collection tag to be changed by attribute" do
34
- with_attribute_for @user, :scopes, :collection_tag => :ol
42
+ with_attribute_for @user, :scopes, collection_tag: :ol
35
43
  assert_select "div.show_for div.wrapper ol.collection"
36
44
  end
37
45
 
38
46
  test "show_for allows collection tag html to be configured by attribute" do
39
- with_attribute_for @user, :scopes, :collection_html => { :id => "thecollection", :class => "special" }
47
+ with_attribute_for @user, :scopes, collection_html: { id: "thecollection", class: "special" }
40
48
  assert_select "div.show_for div.wrapper ul#thecollection.special.collection"
41
49
  end
42
50
 
43
51
  # CONTENT
44
52
  test "show_for allows content tag to be configured globally" do
45
- swap ShowFor, :content_tag => :span, :content_class => :my_content do
53
+ swap ShowFor, content_tag: :span, content_class: :my_content do
46
54
  with_attribute_for @user, :name
47
55
  assert_select "div.show_for div.wrapper span.my_content"
48
56
  end
49
57
  end
50
58
 
59
+ test "show_for allows content class to be disabled globally" do
60
+ swap ShowFor, content_tag: :span, content_class: nil do
61
+ with_attribute_for @user, :name
62
+ assert_select "div.show_for div.wrapper span"
63
+ assert_no_select "span[class]"
64
+ end
65
+ end
66
+
51
67
  test "show_for allows content tag to be changed by attribute" do
52
- with_attribute_for @user, :name, :content_tag => :span
68
+ with_attribute_for @user, :name, content_tag: :span
53
69
  assert_select "div.show_for div.wrapper span.content"
54
70
  end
55
71
 
56
72
  test "show_for allows content tag html to be configured by attribute" do
57
- with_attribute_for @user, :name, :content_tag => :span, :content_html => { :id => "thecontent", :class => "special" }
73
+ with_attribute_for @user, :name, content_tag: :span, content_html: { id: "thecontent", class: "special" }
58
74
  assert_select "div.show_for div.wrapper span#thecontent.special.content"
59
75
  end
60
76
 
@@ -74,8 +90,8 @@ class AttributeTest < ActionView::TestCase
74
90
  end
75
91
 
76
92
  test "show_for accepts an attribute as time with format options" do
77
- with_attribute_for @user, :created_at, :format => :long
78
- assert_select "div.show_for div.wrapper", /#{Regexp.escape(I18n.l(@user.created_at, :format => :long))}/
93
+ with_attribute_for @user, :created_at, format: :long
94
+ assert_select "div.show_for div.wrapper", /#{Regexp.escape(I18n.l(@user.created_at, format: :long))}/
79
95
  end
80
96
 
81
97
  test "show_for accepts an attribute as true" do
@@ -84,7 +100,7 @@ class AttributeTest < ActionView::TestCase
84
100
  end
85
101
 
86
102
  test "show_for accepts an attribute as true which can be localized" do
87
- store_translations(:en, :show_for => { :yes => "Hell yeah!" }) do
103
+ store_translations(:en, show_for: { yes: "Hell yeah!" }) do
88
104
  with_attribute_for @user, :active
89
105
  assert_select "div.show_for div.wrapper", /Hell yeah!/
90
106
  end
@@ -96,7 +112,7 @@ class AttributeTest < ActionView::TestCase
96
112
  end
97
113
 
98
114
  test "show_for accepts an attribute as false which can be localized" do
99
- store_translations(:en, :show_for => { :no => "Hell no!" }) do
115
+ store_translations(:en, show_for: { no: "Hell no!" }) do
100
116
  with_attribute_for @user, :invalid
101
117
  assert_select "div.show_for div.wrapper", /Hell no!/
102
118
  end
@@ -108,21 +124,21 @@ class AttributeTest < ActionView::TestCase
108
124
  end
109
125
 
110
126
  test "show_for accepts not spcified message can be localized" do
111
- store_translations(:en, :show_for => { :blank => "OMG! It's blank!" }) do
127
+ store_translations(:en, show_for: { blank: "OMG! It's blank!" }) do
112
128
  with_attribute_for @user, :description
113
129
  assert_select "div.show_for div.wrapper", /OMG! It's blank!/
114
130
  end
115
131
  end
116
132
 
117
133
  test "show_for accepts not spcified message can be localized with html" do
118
- store_translations(:en, :show_for => { :blank_html => "<span>OMG! It's blank!</span>" }) do
134
+ store_translations(:en, show_for: { blank_html: "<span>OMG! It's blank!</span>" }) do
119
135
  with_attribute_for @user, :description
120
136
  assert_select "div.show_for div.wrapper span", "OMG! It's blank!"
121
137
  end
122
138
  end
123
139
 
124
140
  test "show_for uses :if_blank if attribute is blank" do
125
- with_attribute_for @user, :description, :if_blank => "No description provided"
141
+ with_attribute_for @user, :description, if_blank: "No description provided"
126
142
  assert_select "div.show_for div.wrapper", /No description provided/
127
143
  end
128
144
 
@@ -134,7 +150,7 @@ class AttributeTest < ActionView::TestCase
134
150
  end
135
151
 
136
152
  test "show_for uses :if_blank if the block content is blank" do
137
- with_attribute_for @user, :description, :if_blank => "No description provided" do
153
+ with_attribute_for @user, :description, if_blank: "No description provided" do
138
154
  ""
139
155
  end
140
156
  assert_select "div.show_for div.wrapper", /No description provided/
@@ -151,8 +167,7 @@ class AttributeTest < ActionView::TestCase
151
167
  @user.name = "<b>hack you!</b>"
152
168
  with_attribute_for @user, :name
153
169
  assert_no_select "div.show_for div.wrapper b"
154
- assert_select "div.show_for div.wrapper",
155
- rails_42? ? "Super User Name!<b>hack you!</b>" : "Super User Name!&lt;b&gt;hack you!&lt;/b&gt;"
170
+ assert_select "div.show_for div.wrapper", "Super User Name!<b>hack you!</b>"
156
171
  end
157
172
 
158
173
  test "show_for works with html_safe marked strings" do
@@ -162,36 +177,41 @@ class AttributeTest < ActionView::TestCase
162
177
  end
163
178
 
164
179
  test "show_for uses :value if supplied" do
165
- with_attribute_for @user, :name, :value => "Calculated Value"
180
+ with_attribute_for @user, :name, value: "Calculated Value"
166
181
  assert_select "div.show_for div.wrapper", /Calculated Value/
167
182
  end
168
183
 
169
184
  test "show_for uses :value and casts to string if supplied" do
170
- with_attribute_for @user, :name, :value => 123
185
+ with_attribute_for @user, :name, value: 123
171
186
  assert_select "div.show_for div.wrapper", /123/
172
187
  end
173
188
 
189
+ test "show_for ignores attribute if :value supplied but with nil value" do
190
+ with_attribute_for @user, :name, value: nil
191
+ assert_select "div.show_for div.wrapper", /Not specified/
192
+ end
193
+
174
194
  test "show_for ignores :value if a block is supplied" do
175
- with_attribute_for @user, :name, :value => "Calculated Value" do
195
+ with_attribute_for @user, :name, value: "Calculated Value" do
176
196
  @user.name.upcase
177
197
  end
178
198
  assert_select "div.show_for div.wrapper", /#{@user.name.upcase}/
179
199
  end
180
200
 
181
201
  test "show_for treats symbol for :value as method on attribute" do
182
- with_attribute_for @user, :name, :value => :upcase
202
+ with_attribute_for @user, :name, value: :upcase
183
203
  assert_select "div.show_for div.wrapper", /#{@user.name.upcase}/
184
204
  end
185
205
 
186
206
  test "show_for does not display blank attribute if skip_blanks option is passed" do
187
- swap ShowFor, :skip_blanks => true do
207
+ swap ShowFor, skip_blanks: true do
188
208
  with_attribute_for @user, :description
189
209
  assert_no_select "div.show_for div.wrapper"
190
210
  end
191
211
  end
192
212
 
193
213
  test "show_for display false attribute if skip_blanks option is passed" do
194
- swap ShowFor, :skip_blanks => true do
214
+ swap ShowFor, skip_blanks: true do
195
215
  with_attribute_for @user, :invalid
196
216
  assert_select "div.show_for div.wrapper", /No/
197
217
  end
@@ -207,9 +227,10 @@ class AttributeTest < ActionView::TestCase
207
227
  end
208
228
 
209
229
  test "show_for should wrap blank attributes with no_attribute" do
210
- swap ShowFor, :blank_content_class => 'no_attribute' do
211
- with_attributes_for @user, :name, :birthday
230
+ swap ShowFor, blank_content_class: 'no_attribute' do
231
+ with_attributes_for @user, :name, :birthday, :karma
212
232
  assert_select ".wrapper.user_birthday.no_attribute"
233
+ assert_select ".wrapper.user_karma.no_attribute"
213
234
  assert_select ".wrapper.user_name.no_attribute", false
214
235
  end
215
236
  end
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  class BuilderTest < ActionView::TestCase
4
4
  # WRAPPER
5
5
  test "show_for allows wrapper to be configured globally" do
6
- swap ShowFor, :wrapper_tag => "li", :wrapper_class => "my_wrapper" do
6
+ swap ShowFor, wrapper_tag: "li", wrapper_class: "my_wrapper" do
7
7
  with_attribute_for @user, :name
8
8
  assert_select "div.show_for li.user_name.my_wrapper"
9
9
  assert_select "div.show_for li.my_wrapper strong.label"
@@ -11,6 +11,13 @@ class BuilderTest < ActionView::TestCase
11
11
  end
12
12
  end
13
13
 
14
+ test "show_for allows wrapper class to be disabled globally" do
15
+ swap ShowFor, wrapper_tag: "li", wrapper_class: nil do
16
+ with_attribute_for @user, :name
17
+ assert_select "div.show_for li[class='user_name']"
18
+ end
19
+ end
20
+
14
21
  test "show_for attribute wraps each attribute with a label and content" do
15
22
  with_attribute_for @user, :name
16
23
  assert_select "div.show_for div.user_name.wrapper"
@@ -19,7 +26,7 @@ class BuilderTest < ActionView::TestCase
19
26
  end
20
27
 
21
28
  test "show_for properly deals with namespaced models" do
22
- @user = Namespaced::User.new(:id => 1, :name => "ShowFor")
29
+ @user = Namespaced::User.new(id: 1, name: "ShowFor")
23
30
 
24
31
  with_attribute_for @user, :name
25
32
  assert_select "div.show_for div.namespaced_user_name.wrapper"
@@ -28,18 +35,18 @@ class BuilderTest < ActionView::TestCase
28
35
  end
29
36
 
30
37
  test "show_for allows wrapper tag to be changed by attribute" do
31
- with_attribute_for @user, :name, :wrapper_tag => :span
38
+ with_attribute_for @user, :name, wrapper_tag: :span
32
39
  assert_select "div.show_for span.user_name.wrapper"
33
40
  end
34
41
 
35
42
  test "show_for allows wrapper html to be configured by attribute" do
36
- with_attribute_for @user, :name, :wrapper_html => { :id => "thewrapper", :class => "special" }
43
+ with_attribute_for @user, :name, wrapper_html: { id: "thewrapper", class: "special" }
37
44
  assert_select "div.show_for div#thewrapper.user_name.wrapper.special"
38
45
  end
39
46
 
40
47
  # SEPARATOR
41
48
  test "show_for allows separator to be configured globally" do
42
- swap ShowFor, :separator => '<span class="separator"></span>' do
49
+ swap ShowFor, separator: '<span class="separator"></span>' do
43
50
  with_attribute_for @user, :name
44
51
  assert_select "div.show_for div.user_name span.separator"
45
52
  assert_select "div.show_for div.wrapper span.separator"
@@ -48,13 +55,13 @@ class BuilderTest < ActionView::TestCase
48
55
  end
49
56
 
50
57
  test "show_for allows separator to be changed by attribute"do
51
- with_attribute_for @user, :name, :separator => '<span class="separator"></span>'
58
+ with_attribute_for @user, :name, separator: '<span class="separator"></span>'
52
59
  assert_select "div.show_for div.wrapper span.separator"
53
60
  assert_no_select "div.show_for br"
54
61
  end
55
62
 
56
63
  test "show_for allows disabling separator by attribute" do
57
- with_attribute_for @user, :name, :separator => false
64
+ with_attribute_for @user, :name, separator: false
58
65
  assert_no_select "div.show_for div.wrapper span.separator"
59
66
  assert_no_select "div.show_for div.wrapper br"
60
67
  assert_no_select "div.show_for div.wrapper", /false/
@@ -66,7 +73,7 @@ class BuilderTest < ActionView::TestCase
66
73
  end
67
74
 
68
75
  test "show_for does not blow if a separator is not set" do
69
- swap ShowFor, :separator => nil do
76
+ swap ShowFor, separator: nil do
70
77
  with_attribute_for @user, :name
71
78
  assert_select "div.show_for div.wrapper"
72
79
  end
@@ -7,26 +7,26 @@ class ContentTest < ActionView::TestCase
7
7
  end
8
8
 
9
9
  test "show_for#content accepts :if_blank as option" do
10
- with_content_for @user, "", :if_blank => "Got blank"
10
+ with_content_for @user, "", if_blank: "Got blank"
11
11
  assert_select "div.show_for", "Got blank"
12
12
  end
13
13
 
14
14
  test "show_for#content accepts html options" do
15
- with_content_for @user, "Special content", :content_tag => :b, :id => "thecontent", :class => "special"
15
+ with_content_for @user, "Special content", content_tag: :b, id: "thecontent", class: "special"
16
16
  assert_select "div.show_for b#thecontent.special.content", "Special content"
17
17
  assert_no_select "div.show_for b[content_tag]"
18
18
  end
19
19
 
20
20
  test "show_for#content with blank value has a 'no value'-class" do
21
- swap ShowFor, :blank_content_class => "nothing" do
22
- with_content_for @user, nil, :content_tag => :b
21
+ swap ShowFor, blank_content_class: "nothing" do
22
+ with_content_for @user, nil, content_tag: :b
23
23
  assert_select "div.show_for b.nothing"
24
24
  end
25
25
  end
26
26
 
27
27
  test "show_for#content with blank value does not display content if skip_blanks option is passed" do
28
- swap ShowFor, :skip_blanks => true do
29
- with_content_for @user, nil, :content_tag => :b
28
+ swap ShowFor, skip_blanks: true do
29
+ with_content_for @user, nil, content_tag: :b
30
30
  assert_no_select "div.show_for b"
31
31
  end
32
32
  end
@@ -11,7 +11,7 @@ class HelperTest < ActionView::TestCase
11
11
  end
12
12
 
13
13
  test "show for yields an instance of builder class specified by builder option" do
14
- show_for(@user, :builder => CustomBuilder) do |f|
14
+ show_for(@user, builder: CustomBuilder) do |f|
15
15
  assert f.instance_of?(CustomBuilder)
16
16
  end
17
17
  end
@@ -27,28 +27,28 @@ class HelperTest < ActionView::TestCase
27
27
  end
28
28
 
29
29
  test "show for should pass options" do
30
- concat(show_for(@user, :id => "my_div", :class => "common") do |f| end)
30
+ concat(show_for(@user, id: "my_div", class: "common") do |f| end)
31
31
  assert_select "div#my_div.show_for.user.common"
32
32
  end
33
33
 
34
34
  test "show for tag should be configurable" do
35
- swap ShowFor, :show_for_tag => :p do
35
+ swap ShowFor, show_for_tag: :p do
36
36
  concat(show_for(@user) do |f| end)
37
37
  assert_select "p.show_for"
38
38
  end
39
39
  end
40
40
 
41
41
  test "show for class should be configurable" do
42
- swap ShowFor, :show_for_class => :awesome do
42
+ swap ShowFor, show_for_class: :awesome do
43
43
  concat(show_for(@user) do |f| end)
44
44
  assert_select "div.show_for.user.awesome"
45
45
  end
46
46
  end
47
47
 
48
48
  test "show for options hash should not be modified" do
49
- html_options = { :show_for_tag => :li }
49
+ html_options = { show_for_tag: :li }
50
50
  concat(show_for(@user, html_options) do |f| end)
51
- assert_equal({ :show_for_tag => :li }, html_options)
51
+ assert_equal({ show_for_tag: :li }, html_options)
52
52
  end
53
53
 
54
54
  end
@@ -7,35 +7,43 @@ class LabelTest < ActionView::TestCase
7
7
  end
8
8
 
9
9
  test "show_for skips label if requested" do
10
- with_attribute_for @user, :name, :label => false
10
+ with_attribute_for @user, :name, label: false
11
11
  assert_no_select "div.show_for div.wrapper strong.label"
12
12
  assert_no_select "div.show_for div.wrapper br"
13
13
  end
14
14
 
15
15
  test "show_for uses custom content_tag and skips label if requested" do
16
- with_attribute_for @user, :name, :label => false, :content_tag => :h2
16
+ with_attribute_for @user, :name, label: false, content_tag: :h2
17
17
  assert_select "div.show_for div.wrapper h2.content", "ShowFor"
18
18
  end
19
19
 
20
20
  test "show_for allows label to be configured globally" do
21
- swap ShowFor, :label_tag => :span, :label_class => "my_label" do
21
+ swap ShowFor, label_tag: :span, label_class: "my_label" do
22
22
  with_attribute_for @user, :name
23
23
  assert_select "div.show_for div.wrapper span.my_label"
24
24
  end
25
25
  end
26
26
 
27
+ test "show_for allows label class to be disabled globally" do
28
+ swap ShowFor, label_tag: :span, label_class: nil do
29
+ with_attribute_for @user, :name
30
+ assert_select "div.show_for div.wrapper span"
31
+ assert_no_select "span[class]"
32
+ end
33
+ end
34
+
27
35
  test "show_for allows label to be changed by attribute" do
28
- with_attribute_for @user, :name, :label_tag => :span
36
+ with_attribute_for @user, :name, label_tag: :span
29
37
  assert_select "div.show_for div.wrapper span.label"
30
38
  end
31
39
 
32
40
  test "show_for allows label html to be configured by attribute" do
33
- with_attribute_for @user, :name, :label_html => { :id => "thelabel", :class => "special" }
41
+ with_attribute_for @user, :name, label_html: { id: "thelabel", class: "special" }
34
42
  assert_select "div.show_for div.wrapper strong#thelabel.special.label"
35
43
  end
36
44
 
37
45
  test "show_for allows label to be set without lookup" do
38
- with_attribute_for @user, :name, :label => "Special Label"
46
+ with_attribute_for @user, :name, label: "Special Label"
39
47
  assert_select "div.show_for div.wrapper strong.label", "Special Label"
40
48
  end
41
49
 
@@ -50,20 +58,20 @@ class LabelTest < ActionView::TestCase
50
58
  end
51
59
 
52
60
  test "show_for#label accepts html options" do
53
- with_label_for @user, :name, :id => "thelabel", :class => "special"
61
+ with_label_for @user, :name, id: "thelabel", class: "special"
54
62
  assert_select "div.show_for strong#thelabel.special.label"
55
63
  end
56
64
 
57
65
  test "should let you override the label wrapper" do
58
- swap ShowFor, :label_proc => proc { |l| l + ":" } do
66
+ swap ShowFor, label_proc: proc { |l| l + ":" } do
59
67
  with_label_for @user, "Special Label"
60
68
  assert_select "div.show_for strong.label", "Special Label:"
61
69
  end
62
70
  end
63
71
 
64
72
  test "should you skip wrapping the label on a per item basis" do
65
- swap ShowFor, :label_proc => proc { |l| l + ":" } do
66
- with_label_for @user, "Special Label", :wrap_label => false
73
+ swap ShowFor, label_proc: proc { |l| l + ":" } do
74
+ with_label_for @user, "Special Label", wrap_label: false
67
75
  assert_select "div.show_for strong.label", "Special Label"
68
76
  end
69
77
  end
@@ -8,8 +8,8 @@ module MiscHelpers
8
8
  end
9
9
  end
10
10
 
11
- def assert_no_select(selector, value=nil)
12
- assert_select(selector, :text => value, :count => 0)
11
+ def assert_no_select(selector, value = nil)
12
+ assert_select(selector, text: value, count: 0)
13
13
  end
14
14
 
15
15
  def swap(object, new_values)
@@ -25,31 +25,31 @@ module MiscHelpers
25
25
  end
26
26
  end
27
27
 
28
- def with_attribute_for(object, attribute, options={}, &block)
28
+ def with_attribute_for(object, attribute, options = {}, &block)
29
29
  concat(show_for(object) do |o|
30
30
  concat o.attribute(attribute, options, &block)
31
31
  end)
32
32
  end
33
33
 
34
- def with_value_for(object, attribute, options={}, &block)
34
+ def with_value_for(object, attribute, options = {}, &block)
35
35
  concat(show_for(object) do |o|
36
36
  concat o.value(attribute, options, &block)
37
37
  end)
38
38
  end
39
39
 
40
- def with_association_for(object, association, options={}, &block)
40
+ def with_association_for(object, association, options = {}, &block)
41
41
  concat(show_for(object) do |o|
42
42
  concat o.association(association, options, &block)
43
43
  end)
44
44
  end
45
45
 
46
- def with_label_for(object, attribute, options={})
46
+ def with_label_for(object, attribute, options = {})
47
47
  concat(show_for(object) do |o|
48
48
  concat o.label(attribute, options)
49
49
  end)
50
50
  end
51
51
 
52
- def with_content_for(object, value, options={})
52
+ def with_content_for(object, value, options = {})
53
53
  concat(show_for(object) do |o|
54
54
  concat o.content(value, options)
55
55
  end)
@@ -12,7 +12,7 @@ end
12
12
  Tag = Struct.new(:id, :name) do
13
13
  extend ActiveModel::Naming
14
14
 
15
- def self.all(options={})
15
+ def self.all(options = {})
16
16
  (1..3).map{ |i| Tag.new(i, "Tag #{i}") }
17
17
  end
18
18
 
@@ -26,22 +26,18 @@ class ActionView::TestCase
26
26
 
27
27
  setup :setup_new_user
28
28
 
29
- def setup_new_user(options={})
29
+ def setup_new_user(options = {})
30
30
  @user = User.new({
31
- :id => 1,
32
- :name => 'ShowFor',
33
- :description => '',
34
- :active => true,
35
- :invalid => false,
36
- :scopes => ["admin", "manager", "visitor"],
37
- :birthday => nil,
38
- :created_at => Time.now,
39
- :updated_at => Date.today
31
+ id: 1,
32
+ name: 'ShowFor',
33
+ description: '',
34
+ active: true,
35
+ invalid: false,
36
+ scopes: ["admin", "manager", "visitor"],
37
+ birthday: nil,
38
+ karma: Proc.new { nil },
39
+ created_at: Time.now,
40
+ updated_at: Date.today
40
41
  }.merge(options))
41
42
  end
42
-
43
- # TODO: remove after supporting Rails 4.2+ only.
44
- def rails_42?
45
- ActiveModel::VERSION::STRING >= "4.2.0"
46
- end
47
43
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class ValueTest < ActionView::TestCase
4
4
  test "show_for allows content tag to be configured globally, without label and separator" do
5
- swap ShowFor, :content_tag => :span do
5
+ swap ShowFor, content_tag: :span do
6
6
  with_value_for @user, :name
7
7
  assert_no_select "div.show_for div.wrapper strong.label"
8
8
  assert_no_select "div.show_for div.wrapper br"
@@ -11,14 +11,14 @@ class ValueTest < ActionView::TestCase
11
11
  end
12
12
 
13
13
  test "show_for allows content with tag to be changed by attribute, without label and separator" do
14
- with_value_for @user, :name, :content_tag => :span
14
+ with_value_for @user, :name, content_tag: :span
15
15
  assert_no_select "div.show_for div.wrapper strong.label"
16
16
  assert_no_select "div.show_for div.wrapper br"
17
17
  assert_select "div.show_for div.wrapper span.content"
18
18
  end
19
19
 
20
20
  test "show_for allows content tag html to be configured by attribute, without label and separator" do
21
- with_value_for @user, :name, :content_tag => :span, :content_html => { :id => "thecontent", :class => "special" }
21
+ with_value_for @user, :name, content_tag: :span, content_html: { id: "thecontent", class: "special" }
22
22
  assert_no_select "div.show_for div.wrapper strong.label"
23
23
  assert_no_select "div.show_for div.wrapper br"
24
24
  assert_select "div.show_for div.wrapper span#thecontent.special.content"
@@ -46,12 +46,12 @@ class ValueTest < ActionView::TestCase
46
46
  end
47
47
 
48
48
  test "show_for accepts an attribute as time with format options, without label and separator" do
49
- with_value_for @user, :created_at, :format => :long
50
- assert_select "div.show_for div.wrapper", /#{Regexp.escape(I18n.l(@user.created_at, :format => :long))}/
49
+ with_value_for @user, :created_at, format: :long
50
+ assert_select "div.show_for div.wrapper", /#{Regexp.escape(I18n.l(@user.created_at, format: :long))}/
51
51
  end
52
52
 
53
53
  test "show_for accepts an attribute as nil, without label and separator" do
54
- c = with_value_for @user, :birthday
54
+ with_value_for @user, :birthday
55
55
  assert_no_select "div.show_for div.wrapper strong.label"
56
56
  assert_no_select "div.show_for div.wrapper br"
57
57
  assert_select "div.show_for div.wrapper", /Not specified/
@@ -65,14 +65,14 @@ class ValueTest < ActionView::TestCase
65
65
  end
66
66
 
67
67
  test "show_for uses :if_blank if attribute is nil, without label and separator" do
68
- with_value_for @user, :birthday, :if_blank => "No description provided"
68
+ with_value_for @user, :birthday, if_blank: "No description provided"
69
69
  assert_no_select "div.show_for div.wrapper strong.label"
70
70
  assert_no_select "div.show_for div.wrapper br"
71
71
  assert_select "div.show_for div.wrapper", /No description provided/
72
72
  end
73
73
 
74
74
  test "show_for uses :if_blank if attribute is blank, without label and separator" do
75
- with_value_for @user, :description, :if_blank => "No description provided"
75
+ with_value_for @user, :description, if_blank: "No description provided"
76
76
  assert_no_select "div.show_for div.wrapper strong.label"
77
77
  assert_no_select "div.show_for div.wrapper br"
78
78
  assert_select "div.show_for div.wrapper", /No description provided/
@@ -84,7 +84,6 @@ class ValueTest < ActionView::TestCase
84
84
  assert_no_select "div.show_for div.wrapper strong.label"
85
85
  assert_no_select "div.show_for div.wrapper br"
86
86
  assert_no_select "div.show_for div.wrapper b"
87
- assert_select "div.show_for div.wrapper",
88
- rails_42? ? "<b>hack you!</b>" : "&lt;b&gt;hack you!&lt;/b&gt;"
87
+ assert_select "div.show_for div.wrapper", "<b>hack you!</b>"
89
88
  end
90
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: show_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-12 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,40 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5'
19
+ version: '5.2'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '3.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '5'
26
+ version: '5.2'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: actionpack
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '3.2'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '5'
33
+ version: '5.2'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
38
  - - ">="
48
39
  - !ruby/object:Gem::Version
49
- version: '3.2'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '5'
40
+ version: '5.2'
53
41
  description: Wrap your objects with a helper to easily show them
54
42
  email: contact@plataformatec.com.br
55
43
  executables: []
@@ -86,9 +74,10 @@ files:
86
74
  - test/test_helper.rb
87
75
  - test/value_test.rb
88
76
  homepage: http://github.com/plataformatec/show_for
89
- licenses: []
77
+ licenses:
78
+ - MIT
90
79
  metadata: {}
91
- post_install_message:
80
+ post_install_message:
92
81
  rdoc_options: []
93
82
  require_paths:
94
83
  - lib
@@ -96,27 +85,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
85
  requirements:
97
86
  - - ">="
98
87
  - !ruby/object:Gem::Version
99
- version: '0'
88
+ version: 2.5.0
100
89
  required_rubygems_version: !ruby/object:Gem::Requirement
101
90
  requirements:
102
91
  - - ">="
103
92
  - !ruby/object:Gem::Version
104
93
  version: '0'
105
94
  requirements: []
106
- rubyforge_project: show_for
107
- rubygems_version: 2.4.5
108
- signing_key:
95
+ rubygems_version: 3.0.3
96
+ signing_key:
109
97
  specification_version: 4
110
98
  summary: Wrap your objects with a helper to easily show them
111
99
  test_files:
112
- - test/association_test.rb
113
- - test/attribute_test.rb
114
100
  - test/builder_test.rb
115
- - test/content_test.rb
116
- - test/generators/show_for_generator_test.rb
117
- - test/helper_test.rb
118
- - test/label_test.rb
101
+ - test/attribute_test.rb
102
+ - test/value_test.rb
119
103
  - test/support/misc_helpers.rb
120
104
  - test/support/models.rb
105
+ - test/label_test.rb
121
106
  - test/test_helper.rb
122
- - test/value_test.rb
107
+ - test/helper_test.rb
108
+ - test/association_test.rb
109
+ - test/generators/show_for_generator_test.rb
110
+ - test/content_test.rb