cirandas.net

ref: master

plugins/elasticsearch/test/unit/event_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require_relative '../test_helper'
require_relative '../../lib/nested_helper/profile'

class EventTest < ActionController::TestCase

  include ElasticsearchTestHelper

  def indexed_models
    [Event]
  end

  should 'index searchable fields for Event model' do
    Event::SEARCHABLE_FIELDS.each do |key, value|
      assert_includes indexed_fields(Event), key
    end
  end

  should 'index control fields for Event model' do
    Event::control_fields.each do |key, value|
      assert_includes indexed_fields(Event), key
      assert_equal indexed_fields(Event)[key][:type], value[:type] || 'string'
    end
  end

  should 'respond with should method to return public event' do
    assert Event.respond_to? :should
  end

  should 'respond with nested_filter' do
    assert Event.respond_to? :nested_filter
  end

  should 'have NestedProfile_filter in nested_filter' do
    assert Event.nested_filter.include? NestedProfile.filter
  end

end