Override #to_s on Tag for simplified joining

This commit is contained in:
Katrina Owen 2013-02-18 18:48:22 -07:00
parent 01b7f78f3c
commit 0b733b6183
3 changed files with 11 additions and 2 deletions

View file

@ -45,5 +45,10 @@ class TagTest < ActiveSupport::TestCase
def test_tag_label
assert_equal 'one-two-three', Tag.new(:name => 'one two three').label
end
def test_tag_as_string
tags = [Tag.new(:name => 'tag1'), Tag.new(:name => 'tag2')]
assert_equal 'tag1, tag2', tags.join(', ')
end
end