Created
July 9, 2020 13:45
-
-
Save sergio-fry/b09a1107a629fada18129f1c378af054 to your computer and use it in GitHub Desktop.
RSpec fixtures loader helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RSpec | |
module Fixtures | |
def fixture_file(name) | |
File.open(Rails.root.join('spec', 'fixtures', name)) | |
end | |
def fixture_content(name) | |
fixture_file(name).read | |
end | |
def fixture_json(name) | |
JSON.parse fixture_content(name) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment