dm-is-taggable 0.9.9 → 0.9.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/dm-is-taggable.rb +1 -1
- data/lib/dm-is-taggable/is/taggable.rb +1 -1
- data/lib/dm-is-taggable/is/version.rb +1 -1
- data/spec/integration/taggable_spec.rb +13 -0
- metadata +5 -5
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ AUTHOR = "Maxime Guilbot"
|
|
10
10
|
EMAIL = "maxime [a] ekohe [d] com"
|
11
11
|
GEM_NAME = "dm-is-taggable"
|
12
12
|
GEM_VERSION = DataMapper::Is::Taggable::VERSION
|
13
|
-
GEM_DEPENDENCIES = [["dm-core", GEM_VERSION], ["dm-is-remixable", ">=0.9.
|
13
|
+
GEM_DEPENDENCIES = [["dm-core", GEM_VERSION], ["dm-is-remixable", ">=0.9.11"]]
|
14
14
|
GEM_CLEAN = ["log", "pkg"]
|
15
15
|
GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO ] }
|
16
16
|
|
data/lib/dm-is-taggable.rb
CHANGED
@@ -79,7 +79,7 @@ module DataMapper
|
|
79
79
|
|
80
80
|
tags.each do |tag_name|
|
81
81
|
tag_name = Tag.build(tag_name) if tag_name.class == String
|
82
|
-
next if self.send("#{Extlib::Inflection::underscore(self.class.to_s)}_tags").first(:tag_id => tag_name.id)
|
82
|
+
next if self.send("#{Extlib::Inflection::underscore(self.class.to_s)}_tags").first(:tag_id => tag_name.id, "#{Extlib::Inflection::underscore(self.class.to_s)}_id".intern => self.id)
|
83
83
|
|
84
84
|
p = Extlib::Inflection::constantize("#{self.class.to_s}Tag").new(:tag => tag_name)
|
85
85
|
self.send("#{Extlib::Inflection::underscore(self.class.to_s)}_tags") << p
|
@@ -10,6 +10,7 @@ describe 'DataMapper::Is::Taggable' do
|
|
10
10
|
|
11
11
|
Book.all.destroy!
|
12
12
|
@book = Book.create(:title => "Wonderful world", :isbn => "1234567890123", :author => "Awesome author")
|
13
|
+
@second_book = Book.create(:title => "Beautiful world", :isbn => "1234567891123", :author => "Beautiful author")
|
13
14
|
@fiction = Tag.build('fiction')
|
14
15
|
@english = Tag.build('english')
|
15
16
|
|
@@ -96,6 +97,18 @@ describe 'DataMapper::Is::Taggable' do
|
|
96
97
|
@book.tags.should include(@english)
|
97
98
|
end
|
98
99
|
|
100
|
+
it "should be able to tag another book with the same tag" do
|
101
|
+
@second_book.tag(@fiction)
|
102
|
+
@second_book.reload
|
103
|
+
@second_book.tags.should have(1).thing
|
104
|
+
@second_book.tags.should include(@fiction)
|
105
|
+
|
106
|
+
@fiction.books.should include(@second_book)
|
107
|
+
|
108
|
+
@second_book.untag(@fiction)
|
109
|
+
@fiction.reload
|
110
|
+
end
|
111
|
+
|
99
112
|
# Get books from tags
|
100
113
|
it "should be able to get books tagged with a tag" do
|
101
114
|
@english.books.should have(1).thing
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-is-taggable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxime Guilbot
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-16 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.9.
|
23
|
+
version: 0.9.11
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: dm-is-remixable
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.
|
33
|
+
version: 0.9.11
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: hoe
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.8.
|
43
|
+
version: 1.8.3
|
44
44
|
version:
|
45
45
|
description: Taggable of a DataMapper plugin
|
46
46
|
email:
|