Sha256: 00c4bb5c8a502c5576362f36426ef4a7c5e7ec9466f1259d692385a8271350b2
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
require 'unit_test_helper.rb' include ActsAsIndexed class ConfigurationTest < ActiveSupport::TestCase def test_default_index_file_should_be_set assert_equal Rails.root.join('tmp', '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_default_is_windows_filesystem_should_be_set assert_equal !!RUBY_PLATFORM[/mswin32|mingw|cygwin/], config.is_windows_filesystem? end def tests_is_windows_filesystem_should_be_writeable config.is_windows_filesystem = 'banana' assert config.is_windows_filesystem? 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_as_indexed-0.8.3 | test/unit/configuration_test.rb |
acts_as_indexed-0.8.2 | test/unit/configuration_test.rb |