Sha256: befb59242b3470a0064c85b0b3eb025f7ebcf35b477f5f4229b4683a96e8aad0

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

# coding: utf-8
require 'helper'

describe ProperProperties::Generating::Generator do
  subject { ProperProperties::Generating::Generator }

  let(:as_hash) do
    {
      :item0 => "",
      :item1 => "item1".freeze,
      :item2 => "item2",
      :item3 => "item3",
      :"it em4".freeze => "item4",
      :"it=em5" => "item5",
      :"it:em6" => "item6",
      :item7 => "line 1 line 2 line 3",
      :item8 => "line 1 line 2 line 3",
      :item9 => "line 1 line 2 line 3",
      :item10 => "test\n\ttest×” test\n\ttest test\n\ttest = test"
    }
  end

  it "generates properties file content" do
    expected = fixture("test_out.properties")
    content  = subject.generate(as_hash)
    content.must_equal expected
  end

  it "generates properties file content but skips unicode encoding" do
    expected = fixture("test_out_skip_unicode.properties")
    content  = subject.generate(as_hash, :skip_encode_unicode => true)
    content.must_equal expected
  end

  it "generates properties file content but skips separators encoding" do
    expected = fixture("test_out_skip_separators.properties")
    content  = subject.generate(as_hash, :skip_encode_separators => true)
    content.must_equal expected
  end

  it "generates properties file content but skips special chars encoding" do
    expected = fixture("test_out_skip_special_chars.properties")
    content  = subject.generate(as_hash, :skip_encode_special_chars => true)
    content.must_equal expected
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
proper_properties-0.0.2 spec/proper_properties/generating/generator_spec.rb
proper_properties-0.0.1 spec/proper_properties/generating/generator_spec.rb