15 Dec 2010, 18:23
Epe125_pragsmall

Steve Nicholson (8 posts)

I’m a Mac programmer who has dabbled in Ruby on and off over the years. I’m trying to get the code on pages 16-18 of the b2.0 PDF to work. I used RVM to set up a workspace for the book’s code. gem install jeweler and gem install rspec worked fine. jeweler --rspec twits worked after I used git config --global github.user to set my github user name (git was already installed).

Since the version of RSpec that was installed is 2.3.0, I created the directory tree autotest/.autotest in twits and created the discover.rb file in .autotest. gem install ZenTest worked fine.

When I run autotest, I get this:

loading autotest/rspec2
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/ZenTest-4.4.2/lib/autotest.rb:632: Use RbConfig instead of obsolete and deprecated Config.
bundle exec /Users/steve/.rvm/rubies/ruby-1.9.3-head/bin/ruby -S /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.3.0/bin/rspec --tty '/Users/steve/Development/ctbook/twits/spec/twits_spec.rb'
Could not find gem 'rspec (~> 2.1.0, runtime)' in any of the gem sources listed in your Gemfile.

The results of rake spec are similar:

/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
(in /Users/steve/Development/ctbook/twits)
Could not find gem 'rspec (~> 2.1.0, runtime)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems

Here’s the results of gem list:

*** LOCAL GEMS ***

bundler (1.0.7)
diff-lcs (1.1.2)
git (1.2.5)
jeweler (1.5.1)
rake (0.8.7)
rdoc (2.5.11)
rspec (2.3.0)
rspec-core (2.3.0)
rspec-expectations (2.3.0)
rspec-mocks (2.3.0)
ZenTest (4.4.2)

I can’t figure out why I’m getting the error message that rspec can’t be found.

16 Dec 2010, 00:52
Epe125_pragsmall

Steve Nicholson (8 posts)

Ok, so I’ve learned that ~> 2.1.0 means >= 2.1.0 and < 2.2.0. I removed rspec 2.3.0 and used bundle install to install rspec 2.1.0. I also moved discover.rb from autotest/.autotest to autotest and removed .autotest based on another topic in the book’s discussion forum. But I’m still getting errors. rake --trace spec gives this:

/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
(in /Users/steve/Development/ctbook/twits)
** Invoke spec (first_time)
** Execute spec
/Users/steve/.rvm/rubies/ruby-1.9.3-head/bin/ruby -S bundle exec rspec "spec/twits_spec.rb"
F

Failures:
  1) Twits fails
     Failure/Error: Unable to find matching line from backtrace
     undefined method `run_all' for []:Array
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/hooks.rb:116:in `run_hook_filtered'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:175:in `eval_before_alls'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:230:in `run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block (2 levels) in run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `map'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block in run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/reporter.rb:12:in `report'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:24:in `run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:55:in `run_in_process'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:46:in `run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:10:in `block in autorun'

Finished in 0.00019 seconds
1 example, 1 failure
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/hooks.rb:116:in `run_hook_filtered': undefined method `run_all' for []:Array (NoMethodError)
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:214:in `eval_after_alls'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:237:in `run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block (2 levels) in run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `map'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block in run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/reporter.rb:12:in `report'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:24:in `run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:55:in `run_in_process'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:46:in `run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!
ruby -S bundle exec rspec "spec/twits_spec.rb" failed
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/rake_task.rb:139:in `rescue in block (2 levels) in initialize'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/rake_task.rb:135:in `block (2 levels) in initialize'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/rake_task.rb:131:in `block in initialize'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/Users/steve/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/bin/rake:19:in `load'
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/bin/rake:19:in `<main>'

and autotest gives this:

loading autotest/rspec2
/Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/ZenTest-4.4.2/lib/autotest.rb:632: Use RbConfig instead of obsolete and deprecated Config.
bundle exec /Users/steve/.rvm/rubies/ruby-1.9.3-head/bin/ruby -S /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/bin/rspec --autotest '/Users/steve/Development/ctbook/twits/spec/twits_spec.rb'
sers/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/hooks.rb:116:in `run_hook_filtered': undefined method `run_all' for []:Array (NoMethodError)
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:214:in `eval_after_alls'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:237:in `run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block (2 levels) in run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `map'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block in run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/reporter.rb:12:in `report'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:24:in `run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:55:in `run_in_process'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:46:in `run'
	from /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:10:in `block in autorun'
1mF

Failures:
  1) Twits fails
     Failure/Error: Unable to find matching line from backtrace
     undefined method `run_all' for []:Array
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/hooks.rb:116:in `run_hook_filtered'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:175:in `eval_before_alls'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/example_group.rb:230:in `run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block (2 levels) in run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `map'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:27:in `block in run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/reporter.rb:12:in `report'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:24:in `run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:55:in `run_in_process'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:46:in `run'
     # /Users/steve/.rvm/gems/ruby-1.9.3-head@ctbook/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:10:in `block in autorun'

Finished in 0.00021 seconds
1 example, 1 failure

Judging by the “Use RbConfig instead of obsolete and deprecated Config” message I’m guessing there’s a version mismatch somewhere.

16 Dec 2010, 01:11
Epe125_pragsmall

Steve Nicholson (8 posts)

And I am now up and running under Ruby 1.8.7 instead of 1.9.3. These version requirements are going to have to be clearly specified before the book is finalized. Otherwise you’ll have a lot of frustrated readers.

27 Dec 2010, 18:51
Benrady-avatar_pragsmall

Ben Rady (9 posts)

Steve,

Sorry you had to struggle so much with this setup. Thanks for letting us know. Totally agree that the specific versions of tools need to be specific for all the examples.

Ben

27 Dec 2010, 21:33
Epe125_pragsmall

Steve Nicholson (8 posts)

No worries. I signed up for a beta book after all. I’m happy if I can help improve the final product.

30 May 2011, 03:46
Generic-user-small

Andrés N. Robalino (4 posts)

The beta book indicates to run autotest to see it working. However, it runs forever… I think it should let the reader know that run autotest on a separate terminal session. Maybe I’m doing something wrong? I simply ran autotest in the background.

After that in the same terminal session I modified the spec file to make it pass, saved. The autotest program did its job correctly and I was able to continue since it runs in the background.

25 May 2012, 17:53
Generic-user-small

George Masgras (1 post)

Can we get updated examples since they don’t work with the latest versions of RSpec and Ruby ?

  You must be logged in to comment