2015-08-20 19:41:47 +00:00
|
|
|
module FixtureHelpers
|
2018-02-14 17:14:40 +00:00
|
|
|
def fixture_file(filename, dir: '')
|
2015-08-20 19:41:47 +00:00
|
|
|
return '' if filename.blank?
|
2017-11-14 09:02:39 +00:00
|
|
|
|
2018-02-14 17:14:40 +00:00
|
|
|
File.read(expand_fixture_path(filename, dir: dir))
|
2017-04-12 18:11:35 +00:00
|
|
|
end
|
|
|
|
|
2018-02-14 17:14:40 +00:00
|
|
|
def expand_fixture_path(filename, dir: '')
|
|
|
|
File.expand_path(Rails.root.join(dir, 'spec', 'fixtures', filename))
|
2015-08-20 19:41:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include FixtureHelpers
|
|
|
|
end
|