Sha256: 403cde56ebca6e332e5bdb99bd4134c91fdfdd87e2e915983fc550bbc9e995b3

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'wovnrb/store'
require 'minitest/autorun'

class StoreTest < Minitest::Test
  def test_initialize
    s = Wovnrb::Store.new
    refute_nil(s)
  end

  def test_settings_no_parameters
    s = Wovnrb::Store.new
    assert_equal('path', s.settings['url_pattern'])
    assert_equal('/(?<lang>[^/.?]+)', s.settings['url_pattern_reg'])
  end

  def test_settings_url_pattern_path
    s = Wovnrb::Store.new
    s.settings({'url_pattern' => 'path'})
    assert_equal('path', s.settings['url_pattern'])
    assert_equal('/(?<lang>[^/.?]+)', s.settings['url_pattern_reg'])
  end

  def test_settings_url_pattern_subdomain
    s = Wovnrb::Store.new
    s.settings({'url_pattern' => 'subdomain'})
    assert_equal("^(?<lang>[^.]+)\.", s.settings['url_pattern_reg'])
    assert_equal('subdomain', s.settings['url_pattern'])
  end

  def test_settings_url_pattern_query
    s = Wovnrb::Store.new
    s.settings({'url_pattern' => 'query'})
    assert_equal('((\\?.*&)|\\?)wovn=(?<lang>[^&]+)(&|$)', s.settings['url_pattern_reg'])
    assert_equal('query', s.settings['url_pattern'])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wovnrb-0.2.01 test/lib/store_test.rb
wovnrb-0.2 test/lib/store_test.rb
wovnrb-0.1.80 test/lib/store_test.rb