tagging_along 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tagging_along/version.rb +1 -1
- data/lib/tagging_along.rb +3 -6
- data/spec/tagging_along_spec.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75da0cec20f8d7a9bd898635aa261715d9501603
|
4
|
+
data.tar.gz: 05a6a225060fb45ad51a4c19322d699eee5c1311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d51a006be2b3b4e750106770588fb196419974a2d9923f61ea1f7e4204f86f80801515119c8a21bd74245eca80403aa6b6f95aaef31fad650e52fb95c3d60573
|
7
|
+
data.tar.gz: dc1e7854feabef243b8b4bcc0a3bf6d791b530271d97a6b31888a2b0823a7768aae7274ca2c17c93be9c3068b995034df4a206e2f09c45646fb414e5c9522d30
|
data/lib/tagging_along.rb
CHANGED
@@ -21,22 +21,19 @@ module TaggingAlong
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
-
end
|
25
24
|
|
26
|
-
module InstanceMethods
|
27
25
|
def taggable_on?(attribute)
|
28
26
|
begin
|
29
|
-
send(:"#{attribute}_tags")
|
30
|
-
send(:"#{attribute}_list")
|
27
|
+
new.send(:"#{attribute}_tags")
|
28
|
+
new.send(:"#{attribute}_list")
|
31
29
|
true
|
32
30
|
rescue Exception => e
|
33
31
|
false
|
34
32
|
end
|
35
33
|
end
|
36
34
|
end
|
37
|
-
|
35
|
+
|
38
36
|
def self.included(receiver)
|
39
37
|
receiver.extend ClassMethods
|
40
|
-
receiver.send(:include, InstanceMethods)
|
41
38
|
end
|
42
39
|
end
|
data/spec/tagging_along_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe TaggingAlong do
|
|
11
11
|
instance.taggable_attribute = 'one,two'
|
12
12
|
klass.is_taggable_on(:taggable_attribute)
|
13
13
|
|
14
|
-
expect(
|
14
|
+
expect(klass).to be_taggable_on :taggable_attribute
|
15
15
|
expect(instance.taggable_attribute_tags).to eq ['one', 'two']
|
16
16
|
expect(instance.taggable_attribute_list).to eq 'one, two'
|
17
17
|
end
|
@@ -20,7 +20,7 @@ describe TaggingAlong do
|
|
20
20
|
instance.taggable_attribute = 'one:two'
|
21
21
|
klass.is_taggable_on(:taggable_attribute, separator: ':')
|
22
22
|
|
23
|
-
expect(
|
23
|
+
expect(klass).to be_taggable_on :taggable_attribute
|
24
24
|
expect(instance.taggable_attribute_tags).to eq ['one', 'two']
|
25
25
|
expect(instance.taggable_attribute_list).to eq 'one: two'
|
26
26
|
end
|
@@ -28,7 +28,7 @@ describe TaggingAlong do
|
|
28
28
|
|
29
29
|
context 'not taggable' do
|
30
30
|
it 'is not taggable on untaggable_attribute' do
|
31
|
-
expect(
|
31
|
+
expect(klass).not_to be_taggable_on :untaggable_attribute
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|