Sha256: 1e994c489cf4033f98cab2c08595f81f1e082c2f6dca3847f59e42bd137f868c

Contents?: true

Size: 843 Bytes

Versions: 3

Compression:

Stored size: 843 Bytes

Contents

require 'test/unit'
require 'dm-sphinx-adapter'

class TestConfigParser < Test::Unit::TestCase
  def setup
    base    = Pathname(__FILE__).dirname.expand_path
    @config = base / 'files' / 'sphinx.conf'
    @log    = base / 'var' / 'sphinx.log'
  end

  def test_parse
    assert_nothing_raised{ parse }
    assert_raise(Errno::ENOENT){ parse('blah') }
    assert_raise(RuntimeError){ parse(@log) }
  end

  def test_searchd
    assert_kind_of Hash, searchd = parse
    assert_equal 'localhost',           searchd['address']
    assert_equal '3312',                searchd['port']
    assert_equal 'test/var/sphinx.pid', searchd['pid_file']
    assert_equal 'test/var/sphinx.log', searchd['log']
  end

  protected
    def parse(config = @config)
      DataMapper::Adapters::Sphinx::ConfigParser.parse(config)
    end
end # TestConfigParser

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
shanna-dm-sphinx-adapter-0.4 test/test_config_parser.rb
shanna-dm-sphinx-adapter-0.5 test/test_config_parser.rb
dm-sphinx-adapter-0.5 test/test_config_parser.rb