I'm trying to do the "hello rspec" example from "The RSpec Book" and rspec complains it can't find "rails_helper". It doesn't complain in directories containg rails apps with rspec installed in the app-specific gemset. Rails is not installed in either of the gemsets in the rvm GEM_PATH for hello.
I set up the hello directory with: rspec --init.
I'm puzzled because this is not a Ruby On Rails project. I can't figure out where rspec is being told to require rails_helper. I'd appreciate any suggestions. Thanks!
**Leigh
Mingus:hello $ rspec
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rails_helper (LoadError)
from /Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1283:in `block in requires='
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1283:in `each'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1283:in `requires='
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:109:in `block in process_options_into'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:108:in `each'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:108:in `process_options_into'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:21:in `configure'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:101:in `setup'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:88:in `run'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:73:in `run'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:41:in `invoke'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/exe/rspec:4:in `<top (required)>'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/bin/rspec:23:in `load'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/bin/rspec:23:in `<main>'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/bin/ruby_executable_hooks:15:in `eval'
from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/bin/ruby_executable_hooks:15:in `<main>'
Here are the path vars from /Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1283:in `block in requires='
# @private
def requires=(paths)
directories = ['lib', default_path].select { |p| File.directory? p }
RSpec::Core::RubyProject.add_to_load_path(*directories)
STDERR.puts "paths ------>> #{paths}"
STDERR.puts "default_path ------>> #{default_path}"
STDERR.puts "$LOAD_PATH ------>> #{$LOAD_PATH}"
paths.each { |path| require path }
@requires += paths
end
paths ------>> ["spec_helper", "rails_helper", "spec_helper"]
default_path ------>> spec
$LOAD_PATH:
/Users/leigh/Programming/wapp_dev/hello/spec
/Users/leigh/.rvm/gems/ruby-2.2.1@global/gems/executable-hooks-1.3.2/lib
/Users/leigh/.rvm/gems/ruby-2.2.1@global/extensions/x86_64-darwin-14/2.2.0-static/executable-hooks-1.3.2
/Users/leigh/.rvm/gems/ruby-2.2.1@global/gems/bundler-unload-1.0.2/lib
/Users/leigh/.rvm/gems/ruby-2.2.1@global/gems/rubygems-bundler-1.4.4/lib
/Users/leigh/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.10.3/lib
/Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-support-3.3.0/lib
/Users/leigh/.rvm/gems/ruby-2.2.1@rspec-hello/gems/rspec-core-3.3.1/lib
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/x86_64-darwin14
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0/x86_64-darwin14
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0
/Users/leigh/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-darwin14
~/.rspec: --color --format documentation --require spec_helper #--require rails_helper
hello/.rspec: --color --require spec_helper
hello/greeter_spec.rb: describe "RSpec Greeter" do it "should say 'Hello RSpec!' when it receives the greet() message" do greeter = RSpecGreeter.new greeting = greeter.greet greeting.should == "Hello RSpec!" end end