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