Sha256: 6ac0f082447d69ea9ed14c46ce0fc9a5cb5ce4d9ca55e7295f2f82ed90c7a281

Contents?: true

Size: 1.08 KB

Versions: 21

Compression:

Stored size: 1.08 KB

Contents

require_relative '../lib/depengine/processor/properties'

describe "the properties patcher" do

  it "should patch properties in a file by key/value" do
    test = Processor::Properties.new()
    test.properties_hash = { "webhost" => "www.sinnerschrader.com", "mailhost" => "mail.google.com" }
    test.assigner = "="
    test.patch("spec/properties/source/config.properties", "spec/properties/target/config.properties")


    File.open('spec/properties/target/config.properties').read.should include "webhost=www.sinnerschrader.com"

    FileUtils.rm_rf('spec/properties/target/config.properties')
  end

  it "should patch strings in file" do
    test = Processor::Properties.new()
    test.properties_hash = { "old_string" => "new_string", "even older string" => "" }
    test.substitute("spec/properties/source/random.rb", "spec/properties/target/random.rb")

    File.open('spec/properties/target/random.rb').read.should include "new_string"
    File.open('spec/properties/target/random.rb').read.should_not include "even older string"
    FileUtils.rm_rf('spec/properties/target/random.rb')
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
depengine-3.0.0 spec/properties_spec.rb