tagalong 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -2
- data/lib/tagalong/tagger.rb +4 -0
- data/lib/tagalong/version.rb +1 -1
- data/spec/lib/tagalong/tagger_spec.rb +23 -0
- data/tagalong.gemspec +2 -2
- metadata +11 -9
data/README.md
CHANGED
@@ -137,14 +137,20 @@ To check if a Taggable is tagged with a tag, call the `tagged_with?` method on a
|
|
137
137
|
@contact.tagged_with?('some_tag')
|
138
138
|
# => true
|
139
139
|
|
140
|
+
### Check if Tagger has a tag
|
141
|
+
|
142
|
+
To check if a Tagger has a specific tag, call the `has_tag?` method. This will always return a boolean representing if the Tagger has used the passed tag (and not deleted it).
|
143
|
+
|
144
|
+
@user.has_tag?('sometag')
|
145
|
+
# => true
|
146
|
+
|
140
147
|
### Tag Management
|
141
148
|
|
142
149
|
##### Creating
|
143
150
|
|
144
151
|
To create a tag on the Tagger object without applying the tag to a Taggable, call the `create_tag` method.
|
145
152
|
|
146
|
-
|
147
|
-
|
153
|
+
@user.create_tag("sometag")
|
148
154
|
|
149
155
|
##### Deleting
|
150
156
|
|
data/lib/tagalong/tagger.rb
CHANGED
data/lib/tagalong/version.rb
CHANGED
@@ -54,6 +54,20 @@ describe "Tagger" do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
describe "#has_tag?" do
|
58
|
+
context "the tagger has the tag" do
|
59
|
+
before(:each) do
|
60
|
+
@user.create_tag('tag5')
|
61
|
+
end
|
62
|
+
|
63
|
+
it {@user.has_tag?('tag5').should be_true}
|
64
|
+
end
|
65
|
+
|
66
|
+
context "the tagger does not have the tag" do
|
67
|
+
it {@user.has_tag?('tag99').should be_false}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
57
71
|
describe "#tags" do
|
58
72
|
context "without a taggable" do
|
59
73
|
it "returns list of tags the tagger has used" do
|
@@ -149,6 +163,15 @@ describe "Tagger" do
|
|
149
163
|
end
|
150
164
|
end
|
151
165
|
|
166
|
+
describe "#has_tag?" do
|
167
|
+
it "should try the list of tags for the tagger" do
|
168
|
+
tags = mock('tags')
|
169
|
+
@user.stub(:tags).and_return(tags)
|
170
|
+
tags.should_receive(:include?).with('tag5')
|
171
|
+
@user.has_tag?('tag5')
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
152
175
|
describe "#untag" do
|
153
176
|
it "creates an instance of the tag manager" do
|
154
177
|
tag_manager = stub('tag_manager', :remove_tag => nil)
|
data/tagalong.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require File.expand_path('../lib/tagalong/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["Andrew De Ponte"]
|
6
|
-
gem.email = ["cyphactor@gmail.com"]
|
5
|
+
gem.authors = ["Andrew De Ponte", "Russ Cloak"]
|
6
|
+
gem.email = ["cyphactor@gmail.com", "russcloak@gmail.com"]
|
7
7
|
gem.description = %q{A Rails tagging plugin that makes sense.}
|
8
8
|
gem.summary = %q{A Rails tagging plugin that makes sense.}
|
9
9
|
gem.homepage = "http://github.com/cyphactor/tagalong"
|
metadata
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagalong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andrew De Ponte
|
9
|
+
- Russ Cloak
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
@@ -13,7 +14,7 @@ date: 2012-05-18 00:00:00.000000000 Z
|
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activerecord
|
16
|
-
requirement: &
|
17
|
+
requirement: &70355201072020 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>='
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
version: '0'
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *70355201072020
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: sqlite3
|
27
|
-
requirement: &
|
28
|
+
requirement: &70355201071520 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
31
|
- - ! '>='
|
@@ -32,10 +33,10 @@ dependencies:
|
|
32
33
|
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
+
version_requirements: *70355201071520
|
36
37
|
- !ruby/object:Gem::Dependency
|
37
38
|
name: rspec
|
38
|
-
requirement: &
|
39
|
+
requirement: &70355201071020 !ruby/object:Gem::Requirement
|
39
40
|
none: false
|
40
41
|
requirements:
|
41
42
|
- - ! '>='
|
@@ -43,10 +44,10 @@ dependencies:
|
|
43
44
|
version: '0'
|
44
45
|
type: :development
|
45
46
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
+
version_requirements: *70355201071020
|
47
48
|
- !ruby/object:Gem::Dependency
|
48
49
|
name: rake
|
49
|
-
requirement: &
|
50
|
+
requirement: &70355201070480 !ruby/object:Gem::Requirement
|
50
51
|
none: false
|
51
52
|
requirements:
|
52
53
|
- - ! '>='
|
@@ -54,10 +55,11 @@ dependencies:
|
|
54
55
|
version: '0'
|
55
56
|
type: :development
|
56
57
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
+
version_requirements: *70355201070480
|
58
59
|
description: A Rails tagging plugin that makes sense.
|
59
60
|
email:
|
60
61
|
- cyphactor@gmail.com
|
62
|
+
- russcloak@gmail.com
|
61
63
|
executables: []
|
62
64
|
extensions: []
|
63
65
|
extra_rdoc_files: []
|