[rspec-users] problems with textmate and rspec bundle

John Paul Ashenfelter john.paul.ashenfelter at gmail.com
Fri May 18 11:16:34 EDT 2007


Folks,

I saw David's tutorial yesterday at RailsConf and started working on
RSpec lastnight and am having a *ton* of trouble with the bundle for
TextMate. I've made *some* progress, but thought I'd throw it to the
list

* I run ruby, including rb-rubygems using the MacPorts install (per
JDD's Sandboxing Rails)
* installed rspec 0.9.4 (also rcov 0.8.0.2 and ZenTest 3.5.2)
* tried the game.rb /game_spec.rb demo
* running $ spec game_spec.rb --format=specdoc works great
* installed the RSpec 0.9.4 tmbundle by downloading it and clicking --
nothing fancy

#game.rb
class Game
  def hit(pins)
  end

  def score
    0
  end
end

# game_spec.rb
require 'game'

describe Game do
  before(:each) do
    @game = Game.new
  end

  it "should score 0 for gutter game" do
    1.upto(20) { @game.hit(0) }
    @game.score.should == 0
  end
end

Then I tried running from in TextMate (1.5.5) -- argh!

My initial attempts resulting in the rubygems load error on line 1,
which I solved by adding a .MacOSX/environment.plist with my $PATH
contents to avoid the whole thing with the shebang line being a
problem.

<key>PATH</key>	<string>/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/Users/johnpaul/bin</string>

And to make everything smooth, I also set TM_RUBY to /opt/local/bin/ruby

But now I'm stuck here when I try to Cmd-R w/ RSpec, It could be user
error -- I try to command in the game_spec.rb file and I get the
following error

/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- game (LoadError) from
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`require' from ./rspec/game_spec.rb:1 from
/opt/local/lib/ruby/gems/1.8/gems/rspec-0.9.4/lib/spec/runner/behaviour_runner.rb:85:in
`load' from /opt/local/lib/ruby/gems/1.8/gems/rspec-0.9.4/lib/spec/runner/behaviour_runner.rb:85:in
`load_specs' from
/opt/local/lib/ruby/gems/1.8/gems/rspec-0.9.4/lib/spec/runner/behaviour_runner.rb:84:in
`each' from /opt/local/lib/ruby/gems/1.8/gems/rspec-0.9.4/lib/spec/runner/behaviour_runner.rb:84:in
`load_specs' from
/opt/local/lib/ruby/gems/1.8/gems/rspec-0.9.4/lib/spec/runner/behaviour_runner.rb:22:in
`run' from /opt/local/lib/ruby/gems/1.8/gems/rspec-0.9.4/lib/spec/runner/command_line.rb:17:in
`run' from /Users/johnpaul/Library/Application
Support/TextMate/Pristine
Copy/Bundles/RSpec.tmbundle/Support/lib/spec_mate.rb:47:in `run' from
/Users/johnpaul/Library/Application Support/TextMate/Pristine
Copy/Bundles/RSpec.tmbundle/Support/lib/spec_mate.rb:46:in `chdir'
from /Users/johnpaul/Library/Application Support/TextMate/Pristine
Copy/Bundles/RSpec.tmbundle/Support/lib/spec_mate.rb:46:in `run' from
/Users/johnpaul/Library/Application Support/TextMate/Pristine
Copy/Bundles/RSpec.tmbundle/Support/lib/spec_mate.rb:25:in `run_file'
from /tmp/temp_textmate.ohalvM:4

So that's saying it can't find the game.rb file?

> ls -l rspec
total 16
-rwxr--r--   1 johnpaul  johnpaul   62 May 18 08:07 game.rb*
-rwxr--r--   1 johnpaul  johnpaul  191 May 18 08:07 game_spec.rb*

That seems ok. Just for kicks, I ran rspec on the game.rb file using
cmd+r -- that gave me a green bar but said 0 examples, 0 failures so I
don't think I'm using it properly.

Any ideas/help?
-- 
John Paul Ashenfelter
CTO/Transitionpoint
(blog) http://www.ashenfelter.com
(email) ashenfelterj at transitionpoint.com


More information about the rspec-users mailing list