Skip to content

Instantly share code, notes, and snippets.

@thisismydesign
Last active April 26, 2017 13:01
Show Gist options
  • Save thisismydesign/9dc142f89b82a07e413a45a5d2983b07 to your computer and use it in GitHub Desktop.
Save thisismydesign/9dc142f89b82a07e413a45a5d2983b07 to your computer and use it in GitHub Desktop.
Relative file path with RSpec
# ...
RSPEC_ROOT = File.dirname __FILE__
require 'spec_helper'
RSpec.describe YourFile do
describe '#method' do
context '' do
it '' do
p RSPEC_ROOT
File.open("#{RSPEC_ROOT}/resources/example_data.json")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment