summaryrefslogtreecommitdiff
path: root/spec/support/fixture_file_helper.rb
blob: f21bfee7b100c1ec7f2f1d8b76eb12b4754cd9df (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).instance_eval { binding })
  end

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