Rspec.describe on windows 7 results in an error?

8 views
Skip to first unread message

Mr. Kennedy

unread,
Oct 19, 2016, 2:07:26 AM10/19/16
to rspec
Hello, I just got Rspec configured on my win7 lappy after wrestling against RubyGems v2.4 (broken for Windows) and updating RubyGems to v2.6.7. I'm just going through the tutorial videos on the home page http://rspec.info/ and am wondering if it is just a Windows thing that "Rspec.describe" throws an error? E.g. the bowling example: 
require 'bowling'

# Rspec.describe Bowling, "#score" do     #<-- this throws an error
describe Bowling, "#score" do                  #<-- this works
  context "with no strikes or spares" do
    it "sums the pin count for each roll" do
      bowling = Bowling.new
      20.times { bowling.hit(4) }
      expect(bowling.score).to eq 80
    end
  end
end

Myron Marston

unread,
Oct 19, 2016, 2:10:12 AM10/19/16
to rs...@googlegroups.com
What version of RSpec are you using?  Run `rspec -v` (or look in your `Gemfile.lock` if you are using bundler) to find out.  If you're using RSpec 3.x, I would absolutely expect `RSpec.describe` to work.  But on RSpec 2.x it should not.  It was part of the move in 3.x to support a zero monkey patching mode:


HTH,
Myron

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscribe@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/2f62429d-3e21-4cc3-8b3a-2f83c210dc9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Xavier Shay

unread,
Oct 19, 2016, 10:51:12 AM10/19/16
to rs...@googlegroups.com
try RSpec not Rspec (capital S)

(what error are you getting?)
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.

Mr. Kennedy

unread,
Oct 20, 2016, 12:34:45 AM10/20/16
to rspec
Hi Myron, I have rspec 3.5.4 - per Xavier's comment, tho, the problem here was entirely mine - "Rspec.describe" instead of "RSpec.describe" - whoops! Thanks to you both for the help :)

I'm not proficient enough w/programming to fully understand the logistical considerations for when RSpec.describe vs. describe is apropos, but this answer seems like an adequate explanation: http://stackoverflow.com/questions/24747448/rspec-describe-vs-describe

Mr. Kennedy

unread,
Oct 20, 2016, 12:47:57 AM10/20/16
to rspec
On Wednesday, October 19, 2016 at 10:51:12 AM UTC-4, Xavier Shay wrote:
try RSpec not Rspec (capital S)

(what error are you getting?)

Hi Xavier,

You are correct - it was throwing a NameError: uninitialized constant Rspec (NameError)

Thank you!
Reply all
Reply to author
Forward
0 new messages