Last active
April 26, 2017 13:01
-
-
Save thisismydesign/9dc142f89b82a07e413a45a5d2983b07 to your computer and use it in GitHub Desktop.
Relative file path with RSpec
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
# ... | |
RSPEC_ROOT = File.dirname __FILE__ |
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
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