How to run simple RSpec example

I'm trying to go through this tutorial (http://blog.davidchelimsky.net/blog/2007/05/14/an-introduction-to-rspec-part-i/) to learn RSpec.

You can see the project here: https://github.com/mhedgpeth/rspec-practice

I've created a tests folder that is marked as tests output.
I've created a lib folder that is marked as the load path

When I run it, it can't seem to resolve the user.rb file:

C:\ruby\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\ruby\bin/rspec D:/code/rspec-practice/tests --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --pattern D:/code/rspec-practice/tests/**/*_spec.rb
Testing started at 9:09 AM ...
C:/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- user (LoadError)
 from C:/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from D:/code/rspec-practice/tests/user_spec.rb:2:in `<top (required)>'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `each'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:96:in `setup'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84:in `run'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
 from C:/ruby/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec:4:in `<top (required)>'
 from C:/ruby/bin/rspec:23:in `load'
 from C:/ruby/bin/rspec:23:in `<top (required)>'
 from -e:1:in `load'
 from -e:1:in `<main>'

Process finished with exit code 1
Empty test suite.

Could you help me understand how to get it set up correctly?

2 comments
Comment actions Permalink

Hi,

you should add "lib" directory to the include path (prepend -Ilib arg to ruby args of the run configuration (Run|Editor Configurations))
it looks like the tutorial assumes that you create all files in one directory.

Regards, Oleg.

0
Comment actions Permalink

That worked; thanks for your help

0

Please sign in to leave a comment.