[rspec-users] Basic help
Zach Dennis
zach.dennis at gmail.com
Thu Mar 19 08:36:55 EDT 2009
On Thu, Mar 19, 2009 at 5:28 AM, jazzez ravi <lists at ruby-forum.com> wrote:
> Hi All,
>
> 1. Just now I installed rspec1.2.0 and dependencies
>
> 2. Tried the 2 programs mentioned in http://rspec.info/.
>
> # bowling_spec.rb
> require 'bowling'
>
> describe Bowling do
> before(:each) do
> @bowling = Bowling.new
> end
>
> it "should score 0 for gutter game" do
> 20.times { @bowling.hit(0) }
> @bowling.score.should == 0
> end
> end
>
> # bowling.rb
> class Bowling
> def hit(pins)
> end
>
> def score
> 0
> end
> end
>
>
> 3. Run the bowling_spec.rb file
>
>>ruby bowling_spec.rb --format specdoc
>
> 4. getting error like
>
> bowling_spec.rb:6: undefined method `describe' for main:Object
> (NoMethodError)
>
> 5. So i tried to add these lines,
>
> require 'rspec' --> no Such file to Load
> require 'spec' --> No Error But also no output mentioned as per that
> website.
>
> Please anyone help to continue that program.
Try to put this at the top:
require 'rubygems'
require 'spec'
I have an environment variable set to always load rubygems on my
system so I can omit the require of it explicitly in code:
RUBYOPTS=-rubygems
>
> Regards,
> P.Raveendran
> http://raveendran.wordpress.com
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
More information about the rspec-users
mailing list