0
require File.dirname(__FILE__) + '/../test_helper'
0
-class TaggingTest < Test::Unit::TestCase
0
- fixtures :taggings, :tags, :assets, :contents, :sites
0
+context "Asset Tagging" do
0
+ fixtures :taggings, :tags, :assets
0
-
def test_should_show_taggable_tags0
+
specify "should show taggable tags" do0
assert_models_equal [tags(:ruby)], assets(:gif).tags
0
-
def test_should_add_tags0
+
specify "should add tags" do0
assert_difference Tagging, :count do
0
assert_no_difference Tag, :count do
0
Tagging.add_to assets(:gif), [tags(:rails)]
0
@@ -16,7 +16,7 @@ class TaggingTest < Test::Unit::TestCase
0
assert_models_equal [tags(:rails), tags(:ruby)], assets(:gif).reload.tags
0
-
def test_should_delete_tags0
+
specify "should delete tags" do0
assert_difference Tagging, :count, -1 do
0
assert_no_difference Tag, :count do
0
Tagging.delete_from assets(:gif), [tags(:ruby)]
0
@@ -25,7 +25,7 @@ class TaggingTest < Test::Unit::TestCase
0
assert_equal [], assets(:gif).reload.tags
0
-
def test_should_change_tags0
+
specify "should change tags" do0
assert_difference Tagging, :count, 2 do
0
assert_difference Tag, :count do
0
Tagging.set_on assets(:gif), 'rails, mongrel, foo'
0
@@ -33,12 +33,47 @@ class TaggingTest < Test::Unit::TestCase
0
assert_models_equal [Tag[:foo], tags(:mongrel), tags(:rails)], assets(:gif).reload.tags
0
- def test_should_find_by_tags
0
+ specify "should find by tags" do
0
assert_models_equal [assets(:gif)], Asset.find_tagged_with('ruby, rails')
0
+context "Article Tagging" do
0
+ fixtures :taggings, :tags, :contents, :sites
0
+ specify "should show taggable tags" do
0
+ assert_models_equal [tags(:rails)], contents(:another).tags
0
+ specify "should add tags" do
0
+ assert_difference Tagging, :count do
0
+ assert_no_difference Tag, :count do
0
+ Tagging.add_to contents(:another), [tags(:ruby)]
0
+ assert_models_equal [tags(:rails), tags(:ruby)], contents(:another).reload.tags
0
+ specify "should delete tags" do
0
+ assert_difference Tagging, :count, -1 do
0
+ assert_no_difference Tag, :count do
0
+ Tagging.delete_from contents(:another), [tags(:rails)]
0
+ assert_equal [], contents(:another).reload.tags
0
- def test_should_find_tags_by_site
0
+ specify "should change tags" do
0
+ assert_difference Tagging, :count, 2 do
0
+ assert_difference Tag, :count do
0
+ Tagging.set_on contents(:another), 'ruby, mongrel, foo'
0
+ assert_models_equal [Tag[:foo], tags(:mongrel), tags(:ruby)], contents(:another).reload.tags
0
+ specify "should find by tags in site" do
0
assert_models_equal [tags(:rails)], sites(:first).tags
Comments
No one has commented yet.