summaryrefslogtreecommitdiff
path: root/spec/support/fixture_file_helper.rb
blob: 6905f0224a05adcf88ed3be95c3b1f76be4806f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module FixtureFileHelper
  def fixture_file_content(path, data = {})
    content = IO.read(fixture_file(path))
    return content unless path.end_with?('.erb')

    ERB
      .new(content)
      .result(OpenStruct.new(data).send(:binding))
  end

  def fixture_file(path)
    License::Management.root.join("spec/fixtures/#{path}")
  end
end