Created
December 5, 2012 22:54
-
-
Save bjjb/4220252 to your computer and use it in GitHub Desktop.
How to get the path to an arbitrary file from a Rubygem
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
# Includes a file from a gem. Useful for reusing test helper files from the gems | |
# you're writing functionality for. | |
def gem_file(gem, file, *gem_requirements) | |
File.join(Gem::Dependency.new(gem, *gem_requirements).to_spec.gem_dir, file) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment