rotuka-taggable 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/tag_test.rb ADDED
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/abstract_unit'
2
+
3
+ class TagTest < Test::Unit::TestCase
4
+ fixtures :tags, :taggings, :users, :photos, :posts
5
+
6
+ def test_name_required
7
+ t = Tag.create
8
+ assert_match /blank/, t.errors[:name].to_s
9
+ end
10
+
11
+ def test_name_unique
12
+ t = Tag.create!(:name => "My tag")
13
+ duplicate = t.clone
14
+
15
+ assert !duplicate.save
16
+ assert_match /taken/, duplicate.errors[:name].to_s
17
+ end
18
+
19
+ def test_taggings
20
+ assert_equivalent [taggings(:jonathan_sky_good), taggings(:sam_flowers_good), taggings(:sam_flower_good), taggings(:ruby_good)], tags(:good).taggings
21
+ assert_equivalent [taggings(:sam_ground_bad), taggings(:jonathan_bad_cat_bad)], tags(:bad).taggings
22
+ end
23
+
24
+ def test_to_s
25
+ assert_equal tags(:good).name, tags(:good).to_s
26
+ end
27
+
28
+ def test_equality
29
+ assert_equal tags(:good), tags(:good)
30
+ assert_equal Tag.find(1), Tag.find(1)
31
+ assert_equal Tag.new(:name => 'A'), Tag.new(:name => 'A')
32
+ assert_not_equal Tag.new(:name => 'A'), Tag.new(:name => 'B')
33
+ end
34
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/abstract_unit'
2
+
3
+ class TaggingTest < Test::Unit::TestCase
4
+ fixtures :tags, :taggings, :posts
5
+
6
+ def test_tag
7
+ assert_equal tags(:good), taggings(:jonathan_sky_good).tag
8
+ end
9
+
10
+ def test_taggable
11
+ assert_equal posts(:jonathan_sky), taggings(:jonathan_sky_good).taggable
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ require File.dirname(__FILE__) + '/abstract_unit'
2
+
3
+ class TagsHelperTest < Test::Unit::TestCase
4
+ fixtures :tags, :taggings, :posts
5
+
6
+ include TagsHelper
7
+
8
+ def test_tag_cloud
9
+ cloud_elements = []
10
+
11
+ tag_cloud Post.tag_counts, %w(css1 css2 css3 css4) do |tag, css_class|
12
+ cloud_elements << [tag, css_class]
13
+ end
14
+
15
+ assert_equal [
16
+ [tags(:good), "css2"],
17
+ [tags(:bad), "css1"],
18
+ [tags(:nature), "css4"],
19
+ [tags(:question), "css1"]
20
+ ], cloud_elements
21
+ end
22
+
23
+ def test_tag_cloud_when_no_tags
24
+ tag_cloud SpecialPost.tag_counts, %w(css1) do
25
+ assert false, "tag_cloud should not yield"
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rotuka-taggable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Viney
8
+ - Alexander Semyonov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-11-07 00:00:00 -08:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Simple Rails tags generator.
18
+ email: rotuka+taggable@rotuka.com
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files:
26
+ - README
27
+ - Rakefile
28
+ - MIT-LICENSE
29
+ - init.rb
30
+ - CHANGELOG
31
+ - generators/tags/tags_generator.rb
32
+ - generators/tags/USAGE
33
+ - generators/tags/templates/tag.rb
34
+ - generators/tags/templates/tagging.rb
35
+ - generators/tags/templates/tags_helper.rb
36
+ - generators/tags/templates/migration.rb
37
+ - lib/taggable.rb
38
+ - lib/tag_list.rb
39
+ has_rdoc: true
40
+ homepage: http://github.com/rotuka/taggable
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --main
44
+ - README
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ requirements: []
60
+
61
+ rubyforge_project:
62
+ rubygems_version: 1.2.0
63
+ signing_key:
64
+ specification_version: 2
65
+ summary: Simple Rails tags generator.
66
+ test_files:
67
+ - test/abstract_unit.rb
68
+ - test/acts_as_taggable_test.rb
69
+ - test/database.yml
70
+ - test/schema.rb
71
+ - test/tagging_test.rb
72
+ - test/tag_list_test.rb
73
+ - test/tags_helper_test.rb
74
+ - test/tag_test.rb
75
+ - test/fixtures/magazine.rb
76
+ - test/fixtures/magazines.yml
77
+ - test/fixtures/photo.rb
78
+ - test/fixtures/photos.yml
79
+ - test/fixtures/post.rb
80
+ - test/fixtures/posts.yml
81
+ - test/fixtures/special_post.rb
82
+ - test/fixtures/subscription.rb
83
+ - test/fixtures/subscriptions.yml
84
+ - test/fixtures/taggings.yml
85
+ - test/fixtures/tags.yml
86
+ - test/fixtures/user.rb
87
+ - test/fixtures/users.yml