Commit 0ab82a234c4f44c462b349e7232160268506f476
1 parent
7f03323c
Exists in
elasticsearch_sort
Fixed model tests
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Showing
5 changed files
with
26 additions
and
16 deletions
Show diff stats
plugins/elasticsearch/test/test_helper.rb
| @@ -26,4 +26,8 @@ class ElasticsearchTestHelper < ActionController::TestCase | @@ -26,4 +26,8 @@ class ElasticsearchTestHelper < ActionController::TestCase | ||
| 26 | @environment.enable_plugin(ElasticsearchPlugin) | 26 | @environment.enable_plugin(ElasticsearchPlugin) |
| 27 | end | 27 | end |
| 28 | 28 | ||
| 29 | + def indexed_models | ||
| 30 | + [] | ||
| 31 | + end | ||
| 32 | + | ||
| 29 | end | 33 | end |
plugins/elasticsearch/test/unit/elasticsearch_test.rb
| 1 | require "#{File.dirname(__FILE__)}/../test_helper" | 1 | require "#{File.dirname(__FILE__)}/../test_helper" |
| 2 | 2 | ||
| 3 | -class ElasticsearchTest < ActiveSupport::TestCase | ||
| 4 | - def setup | ||
| 5 | - @environment = Environment.default | ||
| 6 | - @environment.enable_plugin(ElasticsearchPlugin) | ||
| 7 | - @profile = create_user('testing').person | ||
| 8 | - end | ||
| 9 | - | 3 | +class ElasticsearchTest < ElasticsearchTestHelper |
| 10 | 4 | ||
| 11 | should 'be return yellow for health status' do | 5 | should 'be return yellow for health status' do |
| 12 | cluster = Elasticsearch::Model.client.cluster | 6 | cluster = Elasticsearch::Model.client.cluster |
plugins/elasticsearch/test/unit/models/community_test.rb
| 1 | require "#{File.dirname(__FILE__)}/../../test_helper" | 1 | require "#{File.dirname(__FILE__)}/../../test_helper" |
| 2 | 2 | ||
| 3 | -class CommunityTest < ActiveSupport::TestCase | 3 | +class CommunityTest < ElasticsearchTestHelper |
| 4 | + | ||
| 5 | + def indexed_models | ||
| 6 | + [Community, Person] | ||
| 7 | + end | ||
| 8 | + | ||
| 4 | def setup | 9 | def setup |
| 5 | - @environment = Environment.default | ||
| 6 | - @environment.enable_plugin(ElasticsearchPlugin) | ||
| 7 | @profile = create_user('testing').person | 10 | @profile = create_user('testing').person |
| 11 | + super | ||
| 8 | end | 12 | end |
| 9 | 13 | ||
| 10 | should 'index custom fields for Event model' do | 14 | should 'index custom fields for Event model' do |
plugins/elasticsearch/test/unit/models/event_test.rb
| 1 | require "#{File.dirname(__FILE__)}/../../test_helper" | 1 | require "#{File.dirname(__FILE__)}/../../test_helper" |
| 2 | 2 | ||
| 3 | -class EventTest < ActiveSupport::TestCase | 3 | +class EventTest < ElasticsearchTestHelper |
| 4 | + | ||
| 5 | + def indexed_models | ||
| 6 | + [Event] | ||
| 7 | + end | ||
| 8 | + | ||
| 4 | def setup | 9 | def setup |
| 5 | - @environment = Environment.default | ||
| 6 | - @environment.enable_plugin(ElasticsearchPlugin) | ||
| 7 | @profile = create_user('testing').person | 10 | @profile = create_user('testing').person |
| 11 | + super | ||
| 8 | end | 12 | end |
| 9 | 13 | ||
| 10 | should 'index custom fields for Event model' do | 14 | should 'index custom fields for Event model' do |
plugins/elasticsearch/test/unit/models/person_test.rb
| 1 | require "#{File.dirname(__FILE__)}/../../test_helper" | 1 | require "#{File.dirname(__FILE__)}/../../test_helper" |
| 2 | 2 | ||
| 3 | -class PersonTest < ActiveSupport::TestCase | 3 | +class PersonTest < ElasticsearchTestHelper |
| 4 | + | ||
| 5 | + def indexed_models | ||
| 6 | + [Event] | ||
| 7 | + end | ||
| 8 | + | ||
| 4 | def setup | 9 | def setup |
| 5 | - @environment = Environment.default | ||
| 6 | - @environment.enable_plugin(ElasticsearchPlugin) | ||
| 7 | @profile = create_user('testing').person | 10 | @profile = create_user('testing').person |
| 11 | + super | ||
| 8 | end | 12 | end |
| 9 | 13 | ||
| 10 | should 'index custom fields for Event model' do | 14 | should 'index custom fields for Event model' do |