summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-08-20 12:41:47 -0700
committerDouwe Maan <douwe@gitlab.com>2015-08-20 12:41:47 -0700
commit54b04f1c5b6c486a67c654ee9987e5f5ec4501fd (patch)
tree6c191226132073546adca92f259d1d17400949ba /spec/support
parentac268674edfdaa5b8232f9875481410fc5112f60 (diff)
downloadgitlab-ce-54b04f1c5b6c486a67c654ee9987e5f5ec4501fd.tar.gz
Add fixture_file helper.
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/fixture_helpers.rb11
-rw-r--r--spec/support/markdown_feature.rb4
2 files changed, 13 insertions, 2 deletions
diff --git a/spec/support/fixture_helpers.rb b/spec/support/fixture_helpers.rb
new file mode 100644
index 00000000000..a05c9d18002
--- /dev/null
+++ b/spec/support/fixture_helpers.rb
@@ -0,0 +1,11 @@
+module FixtureHelpers
+ def fixture_file(filename)
+ return '' if filename.blank?
+ file_path = File.expand_path(Rails.root.join('spec/fixtures/', filename))
+ File.read(file_path)
+ end
+end
+
+RSpec.configure do |config|
+ config.include FixtureHelpers
+end
diff --git a/spec/support/markdown_feature.rb b/spec/support/markdown_feature.rb
index c59df4e84d6..f8b2ce03e6c 100644
--- a/spec/support/markdown_feature.rb
+++ b/spec/support/markdown_feature.rb
@@ -100,7 +100,7 @@ class MarkdownFeature
end
def raw_markdown
- fixture = Rails.root.join('spec/fixtures/markdown.md.erb')
- ERB.new(File.read(fixture)).result(binding)
+ markdown = fixture_file('markdown.md.erb')
+ ERB.new(markdown).result(binding)
end
end