Skip to content

Instantly share code, notes, and snippets.

@sergio-fry
Created July 9, 2020 13:45
Show Gist options
  • Save sergio-fry/b09a1107a629fada18129f1c378af054 to your computer and use it in GitHub Desktop.
Save sergio-fry/b09a1107a629fada18129f1c378af054 to your computer and use it in GitHub Desktop.
RSpec fixtures loader helper
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