Sha256: 5102f14bd0907c55954758fdbf7178af0d7bd58ca1b0665359216b2aa4dd735b

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

require_relative "../../../test_helper"
require "tempfile"

module Eye

  module Patch

    describe Settings do
      it "evaluates the yaml as ERB" do
        file = Tempfile.new("yaml")
        file.write("sum: <%= 1 + 2 %>")
        file.close
        assert_equal 3, Settings.new(file.path)[:sum]
      end

      it "exposes the config file's path within ERB" do
        file = Tempfile.new("yaml")
        file.write("working_dir: <%= __FILE__ %>/..")
        file.close

        assert_equal(
          File.join(file.path, ".."),
          Settings.new(file.path)[:working_dir],
        )
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eye-patch-1.1.0 test/lib/eye/patch/settings_test.rb
eye-patch-1.0.1 test/lib/eye/patch/settings_test.rb
eye-patch-1.0.0 test/lib/eye/patch/settings_test.rb