-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
121 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require "test_helper" | ||
|
||
class HelperTest < ActionView::TestCase | ||
test "show for yields an instance of ShowFor::Builder" do | ||
show_for @user do |f| | ||
assert f.instance_of?(ShowFor::Builder) | ||
end | ||
end | ||
|
||
test "show for should add default class to form" do | ||
show_for @user do |f| end | ||
assert_select "div.show_for" | ||
end | ||
|
||
test "show for should add object class name as css class to form" do | ||
show_for @user do |f| end | ||
assert_select "div.show_for.user" | ||
end | ||
|
||
test "show for should pass options" do | ||
show_for @user, :id => "my_div", :class => "common" do |f| end | ||
assert_select "div#my_div.show_for.user.common" | ||
end | ||
|
||
test "show for tag should be configurable" do | ||
swap ShowFor, :show_for_tag => :p do | ||
show_for @user do |f| end | ||
assert_select "p.show_for" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters