summaryrefslogtreecommitdiff
path: root/spec/support/fixture_file_helper.rb
blob: 5a9599f9ddbb06361a8c003b498d7ba34c12e167 (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).send(:binding))
  end

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