cirandas.net

ref: master

test/unit/search_term_helper_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
require 'test_helper'

class SearchTermTest < ActiveSupport::TestCase

  include SearchTermHelper

  should 'register search term' do
    environment = Environment.default
    assert_difference 'SearchTerm.count', 1 do
      register_search_term('fred mercury', 10, 1, environment, 'people')
    end
  end

  should 'register search term normalized' do
    environment = Environment.default
    assert_difference 'SearchTerm.count', 1 do
      register_search_term('FrEd mErCuRy', 10, 1, environment, 'people')
      register_search_term('fReD MeRcUrY', 10, 1, environment, 'people')
      assert SearchTerm.find_or_create('fred mercury', environment, 'people')
    end
  end

end