ref: master
plugins/solr/test/unit/environment_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 |
require_relative '../test_helper' class EnvironmentTest < ActiveSupport::TestCase def setup @environment = Environment.default @environment.enable_plugin(SolrPlugin) end attr_accessor :environment should 'find by contents from articles' do TestSolr.enable env = fast_create(Environment) env.enable_plugin(SolrPlugin) assert_nothing_raised do env.articles.find_by_contents('')[:results] end end should 'return more than 10 enterprises by contents' do TestSolr.enable Enterprise.destroy_all ('1'..'20').each do |n| Enterprise.create!(:name => 'test ' + n, :identifier => 'test_' + n) end assert_equal 20, environment.enterprises.find_by_contents('test')[:results].total_entries end end |