Skip to content
Browse files

Rename tag method to content_tag

  • Loading branch information...
1 parent fc5813c commit 800a45b12000d22084045ef6554a4b2fc1e194ff Joe Fiorini committed Jan 15, 2010
Showing with 9 additions and 9 deletions.
  1. +1 −1 lib/totally_tabular/html_helper.rb
  2. +8 −8 spec/lib/totally_tabular/html_helper_spec.rb
View
2 lib/totally_tabular/html_helper.rb
@@ -2,7 +2,7 @@ module TotallyTabular
class HtmlHelper
EMPTY_TAG = /br|input|img/
- def tag(tag, content="", attributes={})
+ def content_tag(tag, content="", attributes={})
if tag.to_s =~ EMPTY_TAG
"<%s%s>" % [tag, attrs(attributes)]
else
View
16 spec/lib/totally_tabular/html_helper_spec.rb
@@ -14,36 +14,36 @@
end
it "returns an empty table tag" do
- @helper.tag(:table).should == "<table></table>"
+ @helper.content_tag(:table).should == "<table></table>"
end
it "returns an empty br tag" do
- @helper.tag(:br).should == "<br>"
+ @helper.content_tag(:br).should == "<br>"
end
it "returns an empty input tag" do
- @helper.tag(:input).should == "<input>"
+ @helper.content_tag(:input).should == "<input>"
end
it "returns an empty img tag" do
- @helper.tag(:img).should == "<img>"
+ @helper.content_tag(:img).should == "<img>"
end
it "returns a tag with content" do
- @helper.tag(:strong, "blah").should == "<strong>blah</strong>"
+ @helper.content_tag(:strong, "blah").should == "<strong>blah</strong>"
end
it "renders with a class specified" do
- @helper.tag(:strong, "blah", :class => "diddy").should =~ /class=\"diddy\"/
+ @helper.content_tag(:strong, "blah", :class => "diddy").should =~ /class=\"diddy\"/
end
it "renders with a href attribute specified" do
url = "http://www.google.com"
- @helper.tag(:a, "blah", :href => url).should =~ /href=\"#{url}\"/
+ @helper.content_tag(:a, "blah", :href => url).should =~ /href=\"#{url}\"/
end
it "renders empty tags with attributes" do
src = "http://www.asite.com/images/my_image.jpg"
- @helper.tag(:img, "", :src => src).should =~ /src=\"#{src}\"/
+ @helper.content_tag(:img, "", :src => src).should =~ /src=\"#{src}\"/
end
end

0 comments on commit 800a45b

Please sign in to comment.
Something went wrong with that request. Please try again.