Basic help


#1

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

  1. Run the bowling_spec.rb file

ruby bowling_spec.rb --format specdoc

  1. getting error like

bowling_spec.rb:6: undefined method `describe’ for main:Object
(NoMethodError)

  1. 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.

Regards,
P.Raveendran


#2

On Thu, Mar 19, 2009 at 4:28 AM, jazzez ravi removed_email_address@domain.invalid
wrote:

before(:each) do
class Bowling

ruby bowling_spec.rb --format specdoc

Use the spec command (that’s what’s there on http://rspec.info):

spec bowling_spec.rb --format specdoc

Cheers,
David


#3

On Thu, Mar 19, 2009 at 5:28 AM, jazzez ravi removed_email_address@domain.invalid
wrote:

before(:each) do
class Bowling

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


Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com


#4

David C. wrote:

On Thu, Mar 19, 2009 at 4:28 AM, jazzez ravi removed_email_address@domain.invalid
wrote:

�before(:each) do
class Bowling

ruby bowling_spec.rb --format specdoc

Use the spec command (that’s what’s there on http://rspec.info):

spec bowling_spec.rb --format specdoc

Cheers,
David

Hi David,

spec bowling_spec.rb --format specdoc is working …

Thank you

Regards,
P.Raveendran


#5

Zach D. wrote:

On Thu, Mar 19, 2009 at 5:28 AM, jazzez ravi removed_email_address@domain.invalid
wrote:

�before(:each) do
class Bowling

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


Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com

Hi Zach,

I tried this one too. But the same error occurred.

spec bowling_spec.rb --format specdoc is working …

Thank you

Regards,
P.Raveendran