Sha256: d16506564470af7537ae0e0364c4e86dea0aca8b44fa268180dd11c4d2c196f7

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

# encoding: UTF-8

require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')

class InflectionalTest < ActiveSupport::TestCase

  setup do
    @words = %w(Lorem ipsum dolor sit amet consectetur adipisicing elit sed do)
  end

  test "instance creation" do
    label = Label::SKOSXL::Base.create!(:value => "foo",
        :origin => Iqvoc::Origin.new("foo").to_s)
    label.inflectionals.create!(:value => "bar")

    assert_equal 2, Inflectional::Base.count
    assert_equal ["foo", "bar"], Inflectional::Base.all.map(&:value)
  end

  test "hashing of values within the label callback" do
    @words.each do |word|
      Label::SKOSXL::Base.create!(:value => word,
          :origin => Iqvoc::Origin.new(word).to_s)
    end

    assert_equal @words.count, Inflectional::Base.count
    Inflectional::Base.all.each do |inflectional|
      normalized = Inflectional::Base.normalize(inflectional.value)
      assert_equal normalized, inflectional.normal_hash
    end
  end

  test "base form sanitizer extension for origin generator" do
    assert_equal "commaslashdotbracketbracket", Iqvoc::Origin.new("comma,slash/dot.bracket[bracket]").sanitize_base_form.to_s
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
iqvoc_inflectionals-2.1.0 test/unit/inflectional_test.rb
iqvoc_inflectionals-2.0.3 test/unit/inflectional_test.rb
iqvoc_inflectionals-2.0.2 test/unit/inflectional_test.rb
iqvoc_inflectionals-2.0.1 test/unit/inflectional_test.rb
iqvoc_inflectionals-2.0.0 test/unit/inflectional_test.rb
iqvoc_inflectionals-1.1.3 test/unit/inflectional_test.rb