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 84 self.article.profile.notification_emails - [self.author_email || self.email]
85 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 87 after_create :new_follower
94 88 def new_follower
95 89 if source.kind_of?(Article)
... ...
plugins/solr/test/unit/article_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class ArticleTest < ActiveSupport::TestCase
4 5 def setup
... ... @@ -83,7 +84,7 @@ class ArticleTest &lt; ActiveSupport::TestCase
83 84 TestSolr.enable
84 85 owner = create_user('testuser').person
85 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 89 assert_includes Article.find_by_contents('anything')[:results], art
89 90 end
... ...
plugins/solr/test/unit/category_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class CategoryTest < ActiveSupport::TestCase
4 5 def setup
... ...
plugins/solr/test/unit/enterprise_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class EnterpriseTest < ActiveSupport::TestCase
4 5 def setup
... ...
plugins/solr/test/unit/environment_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class EnvironmentTest < ActiveSupport::TestCase
4 5 def setup
... ...
plugins/solr/test/unit/event_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class EventTest < ActiveSupport::TestCase
4 5 def setup
... ...
plugins/solr/test/unit/product_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class ProductTest < ActiveSupport::TestCase
4 5 def setup
... ...
plugins/solr/test/unit/profile_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class ProfileTest < ActiveSupport::TestCase
4 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 3 class SearchHelperTest < ActiveSupport::TestCase
4 4  
... ...
plugins/solr/test/unit/text_article_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class TextArticleTest < ActiveSupport::TestCase
4 5 def setup
... ...
plugins/solr/test/unit/textile_article_test.rb
... ... @@ -4,7 +4,7 @@ class TextileArticleTest &lt; ActiveSupport::TestCase
4 4  
5 5 should 'define type facet' do
6 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 8 end
9 9  
10 10 end
... ...
plugins/solr/test/unit/tiny_mce_article_test.rb
1 1 require 'test_helper'
  2 +require File.dirname(__FILE__) + '/../test_solr_helper'
2 3  
3 4 class TinyMceArticleTest < ActiveSupport::TestCase
4 5 def setup
... ... @@ -18,6 +19,6 @@ class TinyMceArticleTest &lt; ActiveSupport::TestCase
18 19  
19 20 should 'define type facet' do
20 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 23 end
23 24 end
... ...
test/test_helper.rb
... ... @@ -59,14 +59,6 @@ class ActiveSupport::TestCase
59 59  
60 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 62 def self.all_fixtures
71 63 Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.yml')).each do |item|
72 64 fixtures File.basename(item).sub(/\.yml$/, '').to_s
... ...