summaryrefslogtreecommitdiff
path: root/spec/support/fixture_file_helper.rb
blob: 313ee35f14cf1ed298c74d73f659328dc7b1af6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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).instance_eval { binding })
  end

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