Commit e705c4a8abcaed6245c573795da153adf4111752

Authored by Rodrigo Souto
1 parent d2e3b9ec

Fixing plugins unit tests

app/models/comment.rb
@@ -84,12 +84,6 @@ class Comment < ActiveRecord::Base @@ -84,12 +84,6 @@ class Comment < ActiveRecord::Base
84 self.article.profile.notification_emails - [self.author_email || self.email] 84 self.article.profile.notification_emails - [self.author_email || self.email]
85 end 85 end
86 86
87 - after_save :notify_article  
88 - after_destroy :notify_article  
89 - def notify_article  
90 - article.comments_updated if article.kind_of?(Article)  
91 - end  
92 -  
93 after_create :new_follower 87 after_create :new_follower
94 def new_follower 88 def new_follower
95 if source.kind_of?(Article) 89 if source.kind_of?(Article)
plugins/solr/test/unit/article_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class ArticleTest < ActiveSupport::TestCase 4 class ArticleTest < ActiveSupport::TestCase
4 def setup 5 def setup
@@ -83,7 +84,7 @@ class ArticleTest &lt; ActiveSupport::TestCase @@ -83,7 +84,7 @@ class ArticleTest &lt; ActiveSupport::TestCase
83 TestSolr.enable 84 TestSolr.enable
84 owner = create_user('testuser').person 85 owner = create_user('testuser').person
85 art = fast_create(TinyMceArticle, :profile_id => owner.id, :name => 'ytest') 86 art = fast_create(TinyMceArticle, :profile_id => owner.id, :name => 'ytest')
86 - c1 = Comment.create(:title => 'test comment', :body => 'anything', :author => owner, :source => art); c1.save! 87 + c1 = Comment.create!(:title => 'test comment', :body => 'anything', :author => owner, :source => art)
87 88
88 assert_includes Article.find_by_contents('anything')[:results], art 89 assert_includes Article.find_by_contents('anything')[:results], art
89 end 90 end
plugins/solr/test/unit/category_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class CategoryTest < ActiveSupport::TestCase 4 class CategoryTest < ActiveSupport::TestCase
4 def setup 5 def setup
plugins/solr/test/unit/enterprise_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class EnterpriseTest < ActiveSupport::TestCase 4 class EnterpriseTest < ActiveSupport::TestCase
4 def setup 5 def setup
plugins/solr/test/unit/environment_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class EnvironmentTest < ActiveSupport::TestCase 4 class EnvironmentTest < ActiveSupport::TestCase
4 def setup 5 def setup
plugins/solr/test/unit/event_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class EventTest < ActiveSupport::TestCase 4 class EventTest < ActiveSupport::TestCase
4 def setup 5 def setup
plugins/solr/test/unit/product_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class ProductTest < ActiveSupport::TestCase 4 class ProductTest < ActiveSupport::TestCase
4 def setup 5 def setup
plugins/solr/test/unit/profile_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class ProfileTest < ActiveSupport::TestCase 4 class ProfileTest < ActiveSupport::TestCase
4 def setup 5 def setup
plugins/solr/test/unit/search_helper_test.rb
1 -require File.dirname(__FILE__) + '/../test_helper' 1 +require 'test_helper'
2 2
3 class SearchHelperTest < ActiveSupport::TestCase 3 class SearchHelperTest < ActiveSupport::TestCase
4 4
plugins/solr/test/unit/text_article_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class TextArticleTest < ActiveSupport::TestCase 4 class TextArticleTest < ActiveSupport::TestCase
4 def setup 5 def setup
plugins/solr/test/unit/textile_article_test.rb
@@ -4,7 +4,7 @@ class TextileArticleTest &lt; ActiveSupport::TestCase @@ -4,7 +4,7 @@ class TextileArticleTest &lt; ActiveSupport::TestCase
4 4
5 should 'define type facet' do 5 should 'define type facet' do
6 a = TextileArticle.new 6 a = TextileArticle.new
7 - assert_equal TextArticle.type_name, TextileArticle.send(:f_type_proc, a.send(:f_type)) 7 + assert_equal TextArticle.type_name, TextileArticle.send(:solr_plugin_f_type_proc, a.send(:solr_plugin_f_type))
8 end 8 end
9 9
10 end 10 end
plugins/solr/test/unit/tiny_mce_article_test.rb
1 require 'test_helper' 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3
3 class TinyMceArticleTest < ActiveSupport::TestCase 4 class TinyMceArticleTest < ActiveSupport::TestCase
4 def setup 5 def setup
@@ -18,6 +19,6 @@ class TinyMceArticleTest &lt; ActiveSupport::TestCase @@ -18,6 +19,6 @@ class TinyMceArticleTest &lt; ActiveSupport::TestCase
18 19
19 should 'define type facet' do 20 should 'define type facet' do
20 a = TinyMceArticle.new 21 a = TinyMceArticle.new
21 - assert_equal TextArticle.type_name, TinyMceArticle.send(:f_type_proc, a.send(:f_type)) 22 + assert_equal TextArticle.type_name, TinyMceArticle.send(:solr_plugin_f_type_proc, a.send(:solr_plugin_f_type))
22 end 23 end
23 end 24 end
test/test_helper.rb
@@ -59,14 +59,6 @@ class ActiveSupport::TestCase @@ -59,14 +59,6 @@ class ActiveSupport::TestCase
59 59
60 fixtures :environments, :roles 60 fixtures :environments, :roles
61 61
62 - def setup  
63 - TestSolr.disable  
64 - end  
65 -  
66 - def teardown  
67 - TestSolr.disable  
68 - end  
69 -  
70 def self.all_fixtures 62 def self.all_fixtures
71 Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.yml')).each do |item| 63 Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.yml')).each do |item|
72 fixtures File.basename(item).sub(/\.yml$/, '').to_s 64 fixtures File.basename(item).sub(/\.yml$/, '').to_s