From 38f8f4e9fe06c0e2733e9dbab25118a0eed4eb02 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 14 Sep 2018 13:50:37 -0500 Subject: Add fixture path argument to `MarkdownFeature.new` This default will be overridden in the EE-specific subclass that uses a different fixture path. --- spec/support/helpers/markdown_feature.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'spec/support') diff --git a/spec/support/helpers/markdown_feature.rb b/spec/support/helpers/markdown_feature.rb index 346f5b1cc4d..96401379cf0 100644 --- a/spec/support/helpers/markdown_feature.rb +++ b/spec/support/helpers/markdown_feature.rb @@ -10,6 +10,12 @@ class MarkdownFeature include FactoryBot::Syntax::Methods + attr_reader :fixture_path + + def initialize(fixture_path = Rails.root.join('spec/fixtures/markdown.md.erb')) + @fixture_path = fixture_path + end + def user @user ||= create(:user) end @@ -122,7 +128,7 @@ class MarkdownFeature end def raw_markdown - markdown = File.read(Rails.root.join('spec/fixtures/markdown.md.erb')) + markdown = File.read(fixture_path) ERB.new(markdown).result(binding) end end -- cgit v1.2.1