ok have to lookup what rspec/autorun does as oppose to just 'require "rspec"'
thanks, it is now working :) feels good! I've always been tied to rails, seems like I was spoiled and not sure how to do basic things in ruby.... On Mon, Apr 23, 2012 at 1:42 PM, David Chelimsky <dchelim...@gmail.com>wrote: > On Mon, Apr 23, 2012 at 12:26 PM, S Ahmed <sahmed1...@gmail.com> wrote: > > My folder structure is as follows: > > > > /myapp/ > > /myapp/lib/class1.rb > > > > /myapp/rspec/spec_helper.rb > > /myapp/rspec/lib/class1_spec.rb > > > > My spec_helper has: > > > > require 'rubygems' > > ^^ If you've installed rspec as a gem and you're running the rspec > command, you don't need to require 'rubygems'. ^^ > > > require 'rspec' > > ^^ This should be 'rspec/autorun'. ^^ > > > > > RSpec.configure do |config| > > end > > This ^^ is not necessary unless you're using it > > > My class1_spec.rb has: > > > > require 'spec_helper' > > require '../../lib/class1' > > > > describe Class1 do > > it "should do something" > > end > > > > > > How do I require my class1 correct, when I run: > > > > rspec spec/lib/class1_spec.rb I am getting: > > > > 1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file > -- > > ../../lib/class1.rb (LoadError) > > RSpec adds 'lib' to the LOAD_PATH, so you can just `require "class1"`, > but it's conventional to do this in spec_helper.rb instead. > > HTH, > David > > > > Also, in a non-rails app, what kind of things do you put in the > spec_helper > > normally? any popular config settings that I should know about? > > > > thanks! > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users