Created
June 2, 2013 22:57
-
-
Save bartolsthoorn/5695248 to your computer and use it in GitHub Desktop.
To enable RSpec when you are using a C extension in a gem, just add something like this to your spec helper. It will build the C code every time you run `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
# Include C extension | |
puts 'Building C extension' | |
Dir.chdir('ext/hola') do | |
output = `ruby extconf.rb` | |
raise output unless $? == 0 | |
output = `make` | |
raise output unless $? == 0 | |
end | |
# Enables require 'hola/hola' in Ruby | |
$: << File.dirname(__FILE__) + '/../ext' | |
# Include Ruby code | |
require_relative '../lib/hola' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment