Sha256: 68f94f997c1401f9ca971ece208d0e6e7d4101eebd84f26c1b8cc723cf23019e
Contents?: true
Size: 1.56 KB
Versions: 6
Compression:
Stored size: 1.56 KB
Contents
require 'abstract_unit' include ActsAsIndexed class ConfigurationTest < ActiveSupport::TestCase def test_default_index_file_should_be_set assert_equal Rails.root.join('index'), config.index_file end def test_default_index_file_depth_should_be_set assert_equal 3, config.index_file_depth end def test_default_min_word_size_should_be_set assert_equal 3, config.min_word_size end def test_index_file_should_be_writeable config.index_file = [Rails.root, 'my_index'] assert_equal Rails.root.join('my_index'), config.index_file end def test_index_file_depth_should_be_writeable config.index_file_depth = 5 assert_equal 5, config.index_file_depth end def test_index_file_depth_should_raise_on_lower_than_1_value assert_nothing_raised(ArgumentError) { config.index_file_depth = 1 } e = assert_raise(ArgumentError) { config.index_file_depth = 0 } assert_equal 'index_file_depth cannot be less than one (1)', e.message assert_raise(ArgumentError) { config.index_file_depth = -12 } end def test_min_word_size_should_be_writeable config.min_word_size = 7 assert_equal 7, config.min_word_size end def test_min_word_size_should_raise_on_lower_than_1_value assert_nothing_raised(ArgumentError) { config.min_word_size = 1 } e = assert_raise(ArgumentError) { config.min_word_size = 0 } assert_equal 'min_word_size cannot be less than one (1)', e.message assert_raise(ArgumentError) { config.min_word_size = -12 } end private def config @config ||=ActsAsIndexed::Configuration.new end end
Version data entries
6 entries across 6 versions & 1 rubygems