Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sutto committed Mar 25, 2010
1 parent 5721887 commit cf6ef30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/show_for/label.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def label(text_or_attribute, options={}, apply_options=true)

return "" if label == false
options[:label_html] = options.dup if apply_options
label = ::I18n.t(:'show_for.label_wrapper', :label => label, :default => "{{label}}")
label = ::I18n.t(:'show_for.label_wrapper', :label => label, :default => "{{label}}") if options.fetch(:wrap_label, true)
wrap_with :label, label, options
end

Expand Down
7 changes: 7 additions & 0 deletions test/builder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ def with_content_for(object, value, options={})
assert_select "div.show_for strong.label", "Special Label:"
end
end

test "should you skip wrapping the label on a per item basis" do
store_translations(:en, :show_for => {"label_wrapper" => "{{label}}:"}) do
with_label_for @user, "Special Label", :wrap_label => false
assert_select "div.show_for strong.label", "Special Label"
end
end

test "show_for accepts an attribute as false" do
with_attribute_for @user, :invalid
Expand Down

0 comments on commit cf6ef30

Please sign in to comment.