diff options
Diffstat (limited to 'spec/support/fixture_file_helper.rb')
| -rw-r--r-- | spec/support/fixture_file_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/support/fixture_file_helper.rb b/spec/support/fixture_file_helper.rb new file mode 100644 index 0000000..5a9599f --- /dev/null +++ b/spec/support/fixture_file_helper.rb @@ -0,0 +1,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 |
