Skip to content

Instantly share code, notes, and snippets.

@kblake
Created April 8, 2011 20:41
Show Gist options
  • Save kblake/910690 to your computer and use it in GitHub Desktop.
Save kblake/910690 to your computer and use it in GitHub Desktop.
# Write the tag class and the methods to make the specs pass
describe Tag do
def tag(name, options = {})
Tag.new(name, options).show
end
it "instantiate itself" do
Tag.new(:p).should_not be_nil
end
it "accept a tag and generate" do
tag(:p).should == "<p></p>"
end
it "have content" do
tag(:p, :content => "Hello World!").should == "<p>Hello World!</p>"
end
it "one attribute" do
tag(:p, :content => "hello again", :class => "fun").should == "<p class='fun'>hello again</p>"
end
it "multiple attributes" do
tag(:p, :content => "hello again", :class => "fun", :id => "unique").should == "<p class='fun' id='unique'>hello again</p>"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment