Sha256: 7c1f84c49073b2583a5b12dcc23771d13865258b6cfc26a2ef6ac193ad17a8e9
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require File.expand_path("../abstract_unit", __FILE__) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts_as_indexed-0.6.3 | test/configuration_test.rb |