Displaying 3 results from an estimated 3 matches for "require_relative".
2011 Nov 12
1
Using require_relative to speed up rspec require time.
...of my test suite.
It boils down to Ruby 1.9''s rather slow require. I''m using 1.9.3, but
I''d still like to shave off some of the require time.
As an experiment, I went into rspec-core and rspec-expectations (the
two biggest offenders) and replaced all require calls with
require_relative. The benefits are actually quite impressive:
rspec-core:
before: 0.16s
after: 0.10s
rspec-expectations:
before: 0.16s
after: 0.05s
Applying this to rspec-mocks also, my total require time for ''rspec''
has gone from 0.5s to 0.21s.
These are just quick a nasty timings, but there&...
2010 Sep 09
3
1.9.2 why does relative_require need an additional backtrack in path
Why does Ruby-1.9.2-p0 require an additional ../ for relative paths
when compared to the same code for ruby1.8?
if RUBY_VERSION < ''1.9''
require File.dirname(__FILE__) + library
else
require_relative File.dirname(__FILE__) + ''/..'' + library
end
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to...
2011 Mar 03
1
Does RSpec interfere with Pathname#dirname or Pathname#realpath ?
...ire Pathname(__FILE__).ascend { |d| h=d+''spec_helper.rb''; break h
if h.file? }
describe B3::Bdd do
it "should indicate RVM is installed locally" do
B3::Bdd::Helpers.rvm_local_install?.should be_true
end
end
The spec helper is: require ''rspec'' ; require_relative ''../lib/b3''
Which describes this code:
class B3
module Bdd
module Helpers
def rvm_local_install?
puts ENV[''rvm_path'']
rvm_path = Pathname.new(ENV[''rvm_path''] || ''~/.rvm'')
rvm_path.dirname.r...