I am having a problem in testing my gem which includes a lib
directory, on JRuby 1.7.4.
I want to test a file located at lib/vger/resources/account_manager.rb
My spec file is in spec/vger/resources/account_manager_spec.rb
require 'spec_helper'
describe Vger::Resources::AccountManager do
.
.
end
end
I am trying to include the file which I want to test in spec_helper.rb
require 'rubygems'
require 'bundler/setup'
require 'vger/resources/account_manager'
require 'vger'
RSpec.configure do |config|
# some (optional) config here
end
While running the test by the command rspec spec/vger/resources/account_manager_spec.rb
I am getting this error:
NameError: uninitialized constant Vger::Resources
const_missing at org/jruby/RubyModule.java:2631
I seems that the file which I want to test is not getting loaded. Please tell me where I am going wrong and where should I make corrections.
Manually update your LOAD PATH in spec_helper.rb before calling require
should do the trick. Try making this the first line of your spec_helper.rb:
$: << '../lib'
or
$LOAD_PATH << '../lib'
($:
is an alias for $LOAD_PATH
)