Commit f5ff10a3298606c1988f01cf91583c679986b6e0

Authored by Victor Costa
Committed by Antonio Terceiro
1 parent 09330524

Update version of acts-as-taggable-on

See merge request !421

Signed-off-by: Victor Costa <vfcosta@gmail.com>
Signed-off-by: Antonio Terceiro <terceiro@colivre.coop.br>
@@ -2,7 +2,7 @@ source &quot;https://rubygems.org&quot; @@ -2,7 +2,7 @@ source &quot;https://rubygems.org&quot;
2 gem 'rails', '~> 3.2.21' 2 gem 'rails', '~> 3.2.21'
3 gem 'minitest', '~> 3.2.0' 3 gem 'minitest', '~> 3.2.0'
4 gem 'fast_gettext', '~> 0.6.8' 4 gem 'fast_gettext', '~> 0.6.8'
5 -gem 'acts-as-taggable-on', '~> 3.0.2' 5 +gem 'acts-as-taggable-on', '~> 3.4.2'
6 gem 'rails_autolink', '~> 1.1.5' 6 gem 'rails_autolink', '~> 1.1.5'
7 gem 'pg', '~> 0.13.2' 7 gem 'pg', '~> 0.13.2'
8 gem 'rmagick', '~> 2.13.1' 8 gem 'rmagick', '~> 2.13.1'
db/migrate/20150116181243_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb 0 → 100644
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +# This migration comes from acts_as_taggable_on_engine (originally 3)
  2 +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
  3 + def self.up
  4 + add_column :tags, :taggings_count, :integer, default: 0
  5 +
  6 + ActsAsTaggableOn::Tag.reset_column_information
  7 + ActsAsTaggableOn::Tag.find_each do |tag|
  8 + ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
  9 + end
  10 + end
  11 +
  12 + def self.down
  13 + remove_column :tags, :taggings_count
  14 + end
  15 +end
db/migrate/20150116181244_add_missing_taggable_index.acts_as_taggable_on_engine.rb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +# This migration comes from acts_as_taggable_on_engine (originally 4)
  2 +class AddMissingTaggableIndex < ActiveRecord::Migration
  3 + def self.up
  4 + add_index :taggings, [:taggable_id, :taggable_type, :context]
  5 + end
  6 +
  7 + def self.down
  8 + remove_index :taggings, [:taggable_id, :taggable_type, :context]
  9 + end
  10 +end
test/unit/article_test.rb
  1 +# encoding: UTF-8
1 require_relative "../test_helper" 2 require_relative "../test_helper"
2 3
3 class ArticleTest < ActiveSupport::TestCase 4 class ArticleTest < ActiveSupport::TestCase
@@ -770,6 +771,13 @@ class ArticleTest &lt; ActiveSupport::TestCase @@ -770,6 +771,13 @@ class ArticleTest &lt; ActiveSupport::TestCase
770 assert_includes as, a 771 assert_includes as, a
771 end 772 end
772 773
  774 + should 'get tagged with tag that contains special chars' do
  775 + a = create(Article, :name => 'Published at', :profile_id => profile.id, :tag_list => 'Métodos Ágeis')
  776 + as = Article.tagged_with('Métodos Ágeis')
  777 +
  778 + assert_includes as, a
  779 + end
  780 +
773 should 'not get tagged with tag from other environment' do 781 should 'not get tagged with tag from other environment' do
774 article_from_this_environment = create(Article, :profile => profile, :tag_list => 'bli') 782 article_from_this_environment = create(Article, :profile => profile, :tag_list => 'bli')
775 783