show_for 0.2.3 → 0.2.4
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.
- data/.gitignore +1 -0
- data/CHANGELOG.rdoc +67 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +13 -1
- data/Rakefile +27 -0
- data/lib/generators/show_for/templates/show_for.rb +1 -1
- data/lib/show_for/attribute.rb +16 -1
- data/lib/show_for/builder.rb +9 -3
- data/lib/show_for/label.rb +2 -2
- data/lib/show_for/version.rb +2 -2
- data/lib/show_for.rb +1 -1
- data/show_for.gemspec +21 -0
- data/test/builder_test.rb +96 -1
- data/test/test_helper.rb +2 -0
- metadata +19 -12
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.bundle/
|
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
== 0.2.4
|
2
|
+
|
3
|
+
* enhancements
|
4
|
+
* Do not add separator if label is not present (by github.com/eugenebolshakov)
|
5
|
+
* Add method for output value only (by github.com/jenkek)
|
6
|
+
|
7
|
+
* bug fix
|
8
|
+
* Fix empty labels to be html_safe (label => false) (by github.com/eugenebolshakov)
|
9
|
+
|
10
|
+
== 0.2.3
|
11
|
+
|
12
|
+
* enhancements
|
13
|
+
* added :attributes method to generate all attributes given
|
14
|
+
* update generator to use the new syntax show_for:install
|
15
|
+
|
16
|
+
* bug fix
|
17
|
+
* fix numeric types
|
18
|
+
|
19
|
+
== 0.2.2
|
20
|
+
|
21
|
+
* bug fix
|
22
|
+
* allow show_for to work with AR association proxies
|
23
|
+
|
24
|
+
* enhancements
|
25
|
+
* improvements on html safe and output buffers
|
26
|
+
|
27
|
+
== 0.2.1
|
28
|
+
|
29
|
+
* enhancements
|
30
|
+
* added label_proc
|
31
|
+
* compatibility with latest Rails
|
32
|
+
|
33
|
+
== 0.2.0
|
34
|
+
|
35
|
+
* enhancements
|
36
|
+
* Rails 3 compatibility
|
37
|
+
|
38
|
+
== 0.1.4
|
39
|
+
|
40
|
+
* bug fix
|
41
|
+
* allow show_for to work with AR association proxies
|
42
|
+
|
43
|
+
== 0.1.3
|
44
|
+
|
45
|
+
* enhancements
|
46
|
+
* allow builder to be given to show_for
|
47
|
+
|
48
|
+
* bugfix
|
49
|
+
* Fix typo in yaml
|
50
|
+
|
51
|
+
== 0.1.2
|
52
|
+
|
53
|
+
* enhancements
|
54
|
+
* allow f.attribute :nickname, :in => :profile as association shortcut
|
55
|
+
|
56
|
+
* deprecations
|
57
|
+
* :method now becomes :using
|
58
|
+
|
59
|
+
== 0.1.1
|
60
|
+
|
61
|
+
* enhancements
|
62
|
+
* HAML compatibility (by github.com/grimen)
|
63
|
+
* blank_content support (by github.com/grimen)
|
64
|
+
|
65
|
+
== 0.1
|
66
|
+
|
67
|
+
* First release
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionmailer (3.0.3)
|
6
|
+
actionpack (= 3.0.3)
|
7
|
+
mail (~> 2.2.9)
|
8
|
+
actionpack (3.0.3)
|
9
|
+
activemodel (= 3.0.3)
|
10
|
+
activesupport (= 3.0.3)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
erubis (~> 2.6.6)
|
13
|
+
i18n (~> 0.4)
|
14
|
+
rack (~> 1.2.1)
|
15
|
+
rack-mount (~> 0.6.13)
|
16
|
+
rack-test (~> 0.5.6)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activemodel (3.0.3)
|
19
|
+
activesupport (= 3.0.3)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
i18n (~> 0.4)
|
22
|
+
activerecord (3.0.3)
|
23
|
+
activemodel (= 3.0.3)
|
24
|
+
activesupport (= 3.0.3)
|
25
|
+
arel (~> 2.0.2)
|
26
|
+
tzinfo (~> 0.3.23)
|
27
|
+
activeresource (3.0.3)
|
28
|
+
activemodel (= 3.0.3)
|
29
|
+
activesupport (= 3.0.3)
|
30
|
+
activesupport (3.0.3)
|
31
|
+
arel (2.0.4)
|
32
|
+
builder (2.1.2)
|
33
|
+
columnize (0.3.1)
|
34
|
+
erubis (2.6.6)
|
35
|
+
abstract (>= 1.0.0)
|
36
|
+
i18n (0.4.2)
|
37
|
+
linecache (0.43)
|
38
|
+
mail (2.2.10)
|
39
|
+
activesupport (>= 2.3.6)
|
40
|
+
i18n (~> 0.4.1)
|
41
|
+
mime-types (~> 1.16)
|
42
|
+
treetop (~> 1.4.8)
|
43
|
+
mime-types (1.16)
|
44
|
+
polyglot (0.3.1)
|
45
|
+
rack (1.2.1)
|
46
|
+
rack-mount (0.6.13)
|
47
|
+
rack (>= 1.0.0)
|
48
|
+
rack-test (0.5.6)
|
49
|
+
rack (>= 1.0)
|
50
|
+
rails (3.0.3)
|
51
|
+
actionmailer (= 3.0.3)
|
52
|
+
actionpack (= 3.0.3)
|
53
|
+
activerecord (= 3.0.3)
|
54
|
+
activeresource (= 3.0.3)
|
55
|
+
activesupport (= 3.0.3)
|
56
|
+
bundler (~> 1.0)
|
57
|
+
railties (= 3.0.3)
|
58
|
+
railties (3.0.3)
|
59
|
+
actionpack (= 3.0.3)
|
60
|
+
activesupport (= 3.0.3)
|
61
|
+
rake (>= 0.8.7)
|
62
|
+
thor (~> 0.14.4)
|
63
|
+
rake (0.8.7)
|
64
|
+
ruby-debug (0.10.3)
|
65
|
+
columnize (>= 0.1)
|
66
|
+
ruby-debug-base (~> 0.10.3.0)
|
67
|
+
ruby-debug-base (0.10.3)
|
68
|
+
linecache (>= 0.3)
|
69
|
+
thor (0.14.6)
|
70
|
+
treetop (1.4.9)
|
71
|
+
polyglot (>= 0.3.1)
|
72
|
+
tzinfo (0.3.23)
|
73
|
+
|
74
|
+
PLATFORMS
|
75
|
+
ruby
|
76
|
+
|
77
|
+
DEPENDENCIES
|
78
|
+
rails (~> 3.0.0)
|
79
|
+
ruby-debug
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 PlataformaTec http://blog.plataformatec.com.br/
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -24,9 +24,13 @@ Install the gem:
|
|
24
24
|
|
25
25
|
sudo gem install show_for
|
26
26
|
|
27
|
+
Or add ShowFor to your Gemfile and bundle it up:
|
28
|
+
|
29
|
+
gem 'show_for'
|
30
|
+
|
27
31
|
Run the generator:
|
28
32
|
|
29
|
-
rails generate
|
33
|
+
rails generate show_for:install
|
30
34
|
|
31
35
|
And you are ready to go. Since this branch is aims Rails 3 support,
|
32
36
|
if you want to use it with Rails 2.3 you should check this branch:
|
@@ -47,6 +51,8 @@ ShowFor allows you to quickly show a model information with I18n features.
|
|
47
51
|
<% a.attribute :photo do %>
|
48
52
|
<%= image_tag(@admin.photo_url) %>
|
49
53
|
<% end %>
|
54
|
+
|
55
|
+
<% a.value :biography %>
|
50
56
|
<% end %>
|
51
57
|
|
52
58
|
Will generate something like:
|
@@ -72,6 +78,11 @@ Will generate something like:
|
|
72
78
|
<strong class="label">Photo</strong><br />
|
73
79
|
<img src="path/to/photo" />
|
74
80
|
</p>
|
81
|
+
<p class="wrapper admin_biography">
|
82
|
+
Etiam porttitor eros ut diam vestibulum et blandit lectus tempor. Donec venenatis fermentum nunc ac dignissim.
|
83
|
+
Pellentesque volutpat eros quis enim mollis bibendum. Ut cursus sem ac sem accumsan nec porttitor felis luctus.
|
84
|
+
Sed purus nunc, auctor vitae consectetur pharetra, tristique non nisi.
|
85
|
+
</p>
|
75
86
|
</div>
|
76
87
|
|
77
88
|
You also have the possibility to show a list of attributes, useful if you don't need to change any configuration:
|
@@ -168,3 +179,4 @@ If you discover any bugs or want to drop a line, feel free to create an issue on
|
|
168
179
|
http://github.com/plataformatec/show_for/issues
|
169
180
|
|
170
181
|
MIT License. Copyright 2010 Plataforma Tecnologia. http://blog.plataformatec.com.br
|
182
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rake/testtask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
|
9
|
+
desc 'Default: run unit tests.'
|
10
|
+
task :default => :test
|
11
|
+
|
12
|
+
desc 'Test the show_form plugin.'
|
13
|
+
Rake::TestTask.new(:test) do |t|
|
14
|
+
t.libs << 'lib'
|
15
|
+
t.libs << 'test'
|
16
|
+
t.pattern = 'test/**/*_test.rb'
|
17
|
+
t.verbose = true
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Generate documentation for the show_for plugin.'
|
21
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
22
|
+
rdoc.rdoc_dir = 'rdoc'
|
23
|
+
rdoc.title = 'ShowFor'
|
24
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
25
|
+
rdoc.rdoc_files.include('README.rdoc')
|
26
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
27
|
+
end
|
@@ -33,5 +33,5 @@ ShowFor.setup do |config|
|
|
33
33
|
|
34
34
|
# If you want to wrap the text inside a label (e.g. to append a semicolon),
|
35
35
|
# specify label_proc - it will be automatically called, passing in the label text.
|
36
|
-
# config.label_proc = lambda { |l|
|
36
|
+
# config.label_proc = lambda { |l| l + ":" }
|
37
37
|
end
|
data/lib/show_for/attribute.rb
CHANGED
@@ -15,10 +15,25 @@ module ShowFor
|
|
15
15
|
wrap_label_and_content(attribute_name, value, options, &collection_block)
|
16
16
|
end
|
17
17
|
|
18
|
+
def value(attribute_name, options={}, &block)
|
19
|
+
apply_default_options!(attribute_name, options)
|
20
|
+
collection_block, block = block, nil if collection_block?(block)
|
21
|
+
|
22
|
+
value = if block
|
23
|
+
block
|
24
|
+
elsif @object.respond_to?(:"human_#{attribute_name}")
|
25
|
+
@object.send :"human_#{attribute_name}"
|
26
|
+
else
|
27
|
+
@object.send(attribute_name)
|
28
|
+
end
|
29
|
+
wrap_content(attribute_name, value, options, &collection_block)
|
30
|
+
end
|
31
|
+
|
18
32
|
def attributes(*attribute_names)
|
19
33
|
attribute_names.map do |attribute_name|
|
20
34
|
attribute(attribute_name)
|
21
35
|
end.join.html_safe
|
22
36
|
end
|
23
37
|
end
|
24
|
-
end
|
38
|
+
end
|
39
|
+
|
data/lib/show_for/builder.rb
CHANGED
@@ -23,8 +23,13 @@ module ShowFor
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def wrap_label_and_content(name, value, options, &block) #:nodoc:
|
26
|
-
|
27
|
-
|
26
|
+
label = label(name, options, false)
|
27
|
+
label += ShowFor.separator.to_s.html_safe if label.present?
|
28
|
+
wrap_with(:wrapper, label + content(value, options, false, &block), options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def wrap_content(name, value, options, &block) #:nodoc:
|
32
|
+
wrap_with(:wrapper, content(value, options, false, &block), options)
|
28
33
|
end
|
29
34
|
|
30
35
|
# Set "#{object_name}_#{attribute_name}" as in the wrapper tag.
|
@@ -57,4 +62,5 @@ module ShowFor
|
|
57
62
|
block && block.arity == 1
|
58
63
|
end
|
59
64
|
end
|
60
|
-
end
|
65
|
+
end
|
66
|
+
|
data/lib/show_for/label.rb
CHANGED
@@ -9,7 +9,7 @@ module ShowFor
|
|
9
9
|
human_attribute_name(text_or_attribute)
|
10
10
|
end
|
11
11
|
|
12
|
-
return
|
12
|
+
return nil.to_s if label == false
|
13
13
|
options[:label_html] = options.dup if apply_options
|
14
14
|
|
15
15
|
label = ShowFor.label_proc.call(label) if options.fetch(:wrap_label, true) && ShowFor.label_proc
|
@@ -22,4 +22,4 @@ module ShowFor
|
|
22
22
|
@object.class.human_attribute_name(attribute.to_s)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
data/lib/show_for/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module ShowFor
|
2
|
-
VERSION = "0.2.
|
3
|
-
end
|
2
|
+
VERSION = "0.2.4".freeze
|
3
|
+
end
|
data/lib/show_for.rb
CHANGED
@@ -25,7 +25,7 @@ module ShowFor
|
|
25
25
|
@@collection_tag = :ul
|
26
26
|
|
27
27
|
mattr_accessor :default_collection_proc
|
28
|
-
@@default_collection_proc = lambda { |value| "<li>#{value}</li>" }
|
28
|
+
@@default_collection_proc = lambda { |value| "<li>#{ERB::Util.html_escape(value)}</li>".html_safe }
|
29
29
|
|
30
30
|
mattr_accessor :i18n_format
|
31
31
|
@@i18n_format = :default
|
data/show_for.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "show_for/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "show_for"
|
7
|
+
s.version = ShowFor::VERSION.dup
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.summary = "Wrap your objects with a helper to easily show them"
|
10
|
+
s.email = "contact@plataformatec.com.br"
|
11
|
+
s.homepage = "http://github.com/plataformatec/show_for"
|
12
|
+
s.description = "Wrap your objects with a helper to easily show them"
|
13
|
+
s.authors = ['José Valim']
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.rubyforge_project = "show_for"
|
21
|
+
end
|
data/test/builder_test.rb
CHANGED
@@ -8,6 +8,12 @@ class BuilderTest < ActionView::TestCase
|
|
8
8
|
end)
|
9
9
|
end
|
10
10
|
|
11
|
+
def with_value_for(object, attribute, options={}, &block)
|
12
|
+
concat(show_for(object) do |o|
|
13
|
+
concat o.value(attribute, options, &block)
|
14
|
+
end)
|
15
|
+
end
|
16
|
+
|
11
17
|
def with_association_for(object, association, options={}, &block)
|
12
18
|
concat(show_for(object) do |o|
|
13
19
|
concat o.association(association, options, &block)
|
@@ -72,6 +78,7 @@ class BuilderTest < ActionView::TestCase
|
|
72
78
|
test "show_for skips label if requested" do
|
73
79
|
with_attribute_for @user, :name, :label => false
|
74
80
|
assert_no_select "div.show_for p.wrapper strong.label"
|
81
|
+
assert_no_select "div.show_for p.wrapper br"
|
75
82
|
end
|
76
83
|
|
77
84
|
test "show_for allows label to be configured globally" do
|
@@ -246,6 +253,93 @@ class BuilderTest < ActionView::TestCase
|
|
246
253
|
end
|
247
254
|
end
|
248
255
|
|
256
|
+
# VALUE
|
257
|
+
test "show_for allows content tag to be configured globally, without label and separator" do
|
258
|
+
swap ShowFor, :content_tag => :span do
|
259
|
+
with_value_for @user, :name
|
260
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
261
|
+
assert_no_select "div.show_for p.wrapper br"
|
262
|
+
assert_select "div.show_for p.wrapper span.content"
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
test "show_for allows content with tag to be changed by attribute, without label and separator" do
|
267
|
+
with_value_for @user, :name, :content_tag => :p
|
268
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
269
|
+
assert_no_select "div.show_for p.wrapper br"
|
270
|
+
assert_select "div.show_for p.wrapper p.content"
|
271
|
+
end
|
272
|
+
|
273
|
+
test "show_for allows content tag html to be configured by attribute, without label and separator" do
|
274
|
+
with_value_for @user, :name, :content_tag => :span, :content_html => { :id => "thecontent", :class => "special" }
|
275
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
276
|
+
assert_no_select "div.show_for p.wrapper br"
|
277
|
+
assert_select "div.show_for p.wrapper span#thecontent.special.content"
|
278
|
+
end
|
279
|
+
|
280
|
+
test "show_for accepts an attribute as string, without label and separator" do
|
281
|
+
with_value_for @user, :name
|
282
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
283
|
+
assert_no_select "div.show_for p.wrapper br"
|
284
|
+
assert_select "div.show_for p.wrapper", /ShowFor/
|
285
|
+
end
|
286
|
+
|
287
|
+
test "show_for accepts an attribute as time, without label and separator" do
|
288
|
+
with_value_for @user, :created_at
|
289
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
290
|
+
assert_no_select "div.show_for p.wrapper br"
|
291
|
+
assert_select "div.show_for p.wrapper", /#{Regexp.escape(I18n.l(@user.created_at))}/
|
292
|
+
end
|
293
|
+
|
294
|
+
test "show_for accepts an attribute as date, without label and separator" do
|
295
|
+
with_value_for @user, :updated_at
|
296
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
297
|
+
assert_no_select "div.show_for p.wrapper br"
|
298
|
+
assert_select "div.show_for p.wrapper", /#{Regexp.escape(I18n.l(@user.updated_at))}/
|
299
|
+
end
|
300
|
+
|
301
|
+
test "show_for accepts an attribute as time with format options, without label and separator" do
|
302
|
+
with_value_for @user, :created_at, :format => :long
|
303
|
+
assert_select "div.show_for p.wrapper", /#{Regexp.escape(I18n.l(@user.created_at, :format => :long))}/
|
304
|
+
end
|
305
|
+
|
306
|
+
test "show_for accepts an attribute as nil, without label and separator" do
|
307
|
+
c = with_value_for @user, :birthday
|
308
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
309
|
+
assert_no_select "div.show_for p.wrapper br"
|
310
|
+
assert_select "div.show_for p.wrapper", /Not specified/
|
311
|
+
end
|
312
|
+
|
313
|
+
test "show_for accepts blank attributes, without label and separator" do
|
314
|
+
with_value_for @user, :description
|
315
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
316
|
+
assert_no_select "div.show_for p.wrapper br"
|
317
|
+
assert_select "div.show_for p.wrapper", /Not specified/
|
318
|
+
end
|
319
|
+
|
320
|
+
test "show_for uses :if_blank if attribute is nil, without label and separator" do
|
321
|
+
with_value_for @user, :birthday, :if_blank => "No description provided"
|
322
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
323
|
+
assert_no_select "div.show_for p.wrapper br"
|
324
|
+
assert_select "div.show_for p.wrapper", /No description provided/
|
325
|
+
end
|
326
|
+
|
327
|
+
test "show_for uses :if_blank if attribute is blank, without label and separator" do
|
328
|
+
with_value_for @user, :description, :if_blank => "No description provided"
|
329
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
330
|
+
assert_no_select "div.show_for p.wrapper br"
|
331
|
+
assert_select "div.show_for p.wrapper", /No description provided/
|
332
|
+
end
|
333
|
+
|
334
|
+
test "show_for escapes content by default, without label and separator" do
|
335
|
+
@user.name = "<b>hack you!</b>"
|
336
|
+
with_value_for @user, :name
|
337
|
+
assert_no_select "div.show_for p.wrapper strong.label"
|
338
|
+
assert_no_select "div.show_for p.wrapper br"
|
339
|
+
assert_no_select "div.show_for p.wrapper b"
|
340
|
+
assert_select "div.show_for p.wrapper", /<b>/
|
341
|
+
end
|
342
|
+
|
249
343
|
# COLLECTIONS
|
250
344
|
test "show_for accepts an attribute as a collection" do
|
251
345
|
with_attribute_for @user, :scopes
|
@@ -356,4 +450,5 @@ class BuilderTest < ActionView::TestCase
|
|
356
450
|
assert_select "div.show_for p.user_email.wrapper", /Not specified/
|
357
451
|
assert_select "p.user_email strong.label", "Email"
|
358
452
|
end
|
359
|
-
end
|
453
|
+
end
|
454
|
+
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: show_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Jos\xC3\xA9 Valim"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-06 00:00:00 -02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -25,9 +25,16 @@ executables: []
|
|
25
25
|
|
26
26
|
extensions: []
|
27
27
|
|
28
|
-
extra_rdoc_files:
|
29
|
-
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
30
|
files:
|
31
|
+
- .gitignore
|
32
|
+
- CHANGELOG.rdoc
|
33
|
+
- Gemfile
|
34
|
+
- Gemfile.lock
|
35
|
+
- MIT-LICENSE
|
36
|
+
- README.rdoc
|
37
|
+
- Rakefile
|
31
38
|
- init.rb
|
32
39
|
- lib/generators/show_for/USAGE
|
33
40
|
- lib/generators/show_for/install_generator.rb
|
@@ -42,7 +49,7 @@ files:
|
|
42
49
|
- lib/show_for/helper.rb
|
43
50
|
- lib/show_for/label.rb
|
44
51
|
- lib/show_for/version.rb
|
45
|
-
-
|
52
|
+
- show_for.gemspec
|
46
53
|
- test/builder_test.rb
|
47
54
|
- test/helper_test.rb
|
48
55
|
- test/support/misc_helpers.rb
|
@@ -53,8 +60,8 @@ homepage: http://github.com/plataformatec/show_for
|
|
53
60
|
licenses: []
|
54
61
|
|
55
62
|
post_install_message:
|
56
|
-
rdoc_options:
|
57
|
-
|
63
|
+
rdoc_options: []
|
64
|
+
|
58
65
|
require_paths:
|
59
66
|
- lib
|
60
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -77,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
84
|
version: "0"
|
78
85
|
requirements: []
|
79
86
|
|
80
|
-
rubyforge_project:
|
81
|
-
rubygems_version: 1.
|
87
|
+
rubyforge_project: show_for
|
88
|
+
rubygems_version: 1.5.0
|
82
89
|
signing_key:
|
83
90
|
specification_version: 3
|
84
91
|
summary: Wrap your objects with a helper to easily show them
|