summaryrefslogtreecommitdiff
path: root/spec/support/fixture_file_helper.rb
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-04-14 12:50:13 -0600
committermo khan <mo.khan@gmail.com>2020-04-14 12:50:13 -0600
commitbae02b6ae73dda47dc86590b73c21a85bb7273a5 (patch)
tree148f331085f123903cbf3635ea8b20b5c279d964 /spec/support/fixture_file_helper.rb
parent2b69afb35bd1b123e00d3efabce0d4c4aefdd008 (diff)
Migrate specs from gitlab-org/security-products/license-management
Diffstat (limited to 'spec/support/fixture_file_helper.rb')
-rw-r--r--spec/support/fixture_file_helper.rb14
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