governor_tags 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/app/views/governor/articles/_tags.html.erb +8 -6
- data/governor_tags.gemspec +1 -1
- data/lib/governor_tags/instance_methods.rb +1 -1
- data/spec/models/article_spec.rb +8 -0
- data/spec/rails_app/Gemfile.lock +1 -1
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<% if article.tags.present? %>
|
2
|
+
<div class="tags">
|
3
|
+
Tags:
|
4
|
+
<% article.tags.each do |tag| %>
|
5
|
+
<span class="tag"><%= link_to tag.name, tag %></span>
|
6
|
+
<% end %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
data/governor_tags.gemspec
CHANGED
@@ -4,7 +4,7 @@ module GovernorTags
|
|
4
4
|
self.tags.map{|t| t.name }.join(GovernorTags.delimiter)
|
5
5
|
end
|
6
6
|
def tag_list=(tag_names)
|
7
|
-
self.tags = tag_names.split(GovernorTags.delimiter).map{|t| Tag.find_or_create_by_name(t.strip) }
|
7
|
+
self.tags = tag_names.split(GovernorTags.delimiter).reject{|t| t.blank? }.map{|t| Tag.find_or_create_by_name(t.strip) }
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/spec/models/article_spec.rb
CHANGED
@@ -10,6 +10,14 @@ describe Article do
|
|
10
10
|
article.tags.map(&:name).should == ['i fell in love again', 'all things go']
|
11
11
|
end
|
12
12
|
|
13
|
+
it "trims blank tags" do
|
14
|
+
expect {
|
15
|
+
article.tag_list = 'drove to chicago, , all things know, all things know, '
|
16
|
+
article.save
|
17
|
+
}.to change{Tag.count}.from(0).to(2)
|
18
|
+
article.tags.map(&:name).should == ['drove to chicago', 'all things know']
|
19
|
+
end
|
20
|
+
|
13
21
|
it "displays the list of tags" do
|
14
22
|
article.tags = [Tag.create(:name => 'kicking ass'), Tag.create(:name => 'chewing bubblegum')]
|
15
23
|
article.save
|
data/spec/rails_app/Gemfile.lock
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: governor_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Liam Morley
|