rspec / rspec.tmbundle

Textmate bundle for RSpec.
MIT License
196 stars 52 forks source link

Giving an error for rspec/core in Rails 2.3.8/RSpec 1 app (not using bundler) #1

Closed billturner closed 14 years ago

billturner commented 14 years ago

I have a fresh rvm gemset for the app, and when saving a _spec file or trying Cmd-R to run the individual spec, I get the following error:

/Users/xxxx/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:23:in `require': no such file to load -- rspec/core (LoadError) 
from /Users/xxxx/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:23 
from /tmp/textmate-command-56660.rb:2:in `require' 
from /tmp/textmate-command-56660.rb:2

This is a pretty fresh install of TextMate as well, as I've been reinstalling everything on a new laptop. After getting the


gem list:

actionmailer (2.3.8) actionpack (2.3.8) activerecord (2.3.8) activeresource (2.3.8) activesupport (2.3.8, 2.3.5) autotest (4.3.2) autotest-fsevent (0.2.2) autotest-growl (0.2.4) autotest-rails (4.1.0) builder (2.1.2) cucumber (0.8.3) cucumber-rails (0.3.2) database_cleaner (0.5.2) diff-lcs (1.1.2) factory_girl (1.3.1) ffaker (0.4.0) gherkin (2.0.2) json_pure (1.4.3) mysql2 (0.1.8) nokogiri (1.4.2) rack (1.1.0) rack-test (0.5.4) rails (2.3.8) rake (0.8.7) rdoc (2.5.8) redgreen (1.2.2) rspec (1.3.0) rspec-rails (1.3.2) sqlite3-ruby (1.3.1) sys-uname (0.8.4) term-ansicolor (1.0.5) trollop (1.16.2) webrat (0.7.1) will_paginate (2.3.14) ZenTest (4.3.3)


ruby -v ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10.3.1]

dchelimsky commented 14 years ago

Try setting TM_RSPEC_HOME in your TextMate settings (pointing to wherever you have rspec-1 installed). That should work, but please confirm.

cherring commented 14 years ago

What will happen with this if it is a Rspec2 app?? will we need to disable this?

dchelimsky commented 14 years ago

If you're using Bundler it'll work fine. Right now it won't work otherwise.

billturner commented 14 years ago

I tried setting TM_RSPEC_HOME to this in textmate:

/Users/xxxx/.rvm/gems/ruby-1.8.7-p299@hatch/gems/rspec-1.3.0/

Which now gives me another error:

Missing the Rails 2.3.8 gem. Please `gem install -v=2.3.8 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

I'm not sure that having a path to an rvm-installed (and gemset dependent) rspec is a great idea.

dchelimsky commented 14 years ago

I'm not sure what the best approach is here. There needs to be a reliable way for TextMate to know what version of rspec to load if both are available in the environment. If only one is, no problem (it can try one, and then the other).

Maybe a .rspec-textmate file in the project root?

billturner commented 14 years ago

Perhaps checking the presence of the autotest/ directory in an RSpec 2 project? That's not created in a RSpec 1 install, correct?

dchelimsky commented 14 years ago

No, but it's specific to Rails apps and there's nothing to stop you from deleting it.

billturner commented 14 years ago

Hmm, gotcha. I would be fine with a .rspec-textmate file in the project root, as it's something I can easily add to my global .gitignore file.

Or, maybe a comment at the top of the generated spec_helper.rb to signify the version?

Rubathas commented 14 years ago

Hi there, I got exactly the same error. And I could not find any gem named rspec-core. Apparently, the only way of getting that gem is by installing rspec as: "gem install rspec --prerelease". Thereafter I sat a "TM_RSPEC_HOME"-variable in TextMate with the value "/usr/lib/ruby/user-gems/1.8/gems/rspec-1.3.0" and then it worked completely! :)

I hope you can use this information. Enjoy!

bitcababy commented 14 years ago

I was able to fix this by adding 'include rubygems' to the mate.rb file

dchelimsky commented 14 years ago

Try setting RUBYOPT to rubygems in Shell Variables under the Advanced tab in TM setttings.

ref: http://github.com/rspec/rspec-tmbundle/issues#issue/3

billturner commented 14 years ago

Try setting RUBYOPT to rubygems in Shell Variables under the Advanced tab in TM setttings.

Thanks! That does the trick for me. Specs run just fine via Cmd-R and no more errors when saving a _spec file.

dchelimsky commented 14 years ago

I added config directions to the README

uchoaaa commented 14 years ago

Hi there, I put RUBYOPT=rubygems and now I got this error:

/Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:86:in blank_slate_method_added': stack level too deep (SystemStackError) from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:86:inblank_slate_method_added' from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in method_added' from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:104 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/basic_object.rb:21 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in require' ... 40 levels... from /Applications/TextMate.app/Contents/SharedSupport/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:36:inchdir' from /Applications/TextMate.app/Contents/SharedSupport/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:36:in run' from /Applications/TextMate.app/Contents/SharedSupport/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:14:inrun_file' from /tmp/textmate-command-4319.rb:3

weexpectedTHIS commented 13 years ago

I'm getting the same exact error/problem as uchoaaa. Any idea on how to fix this, I can't run focused tests because of this.

dchelimsky commented 13 years ago

@uchoaaa and @weexpectedTHIS - this is a separate issue from the one reported here.

There is a conflict between the builder-2.1.2 gem and the file /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb, which appears to have a fix in it for ruby-1.8.6. I removed the file and have seen no ill consequences, so you might want to give that a shot.

weexpectedTHIS commented 13 years ago

Much appreciated David, that did fix for me.

uchoaaa commented 13 years ago

Thank you David, I'll try it.

dchelimsky commented 13 years ago

I had that wrong btw - it's a fix for ruby-1.6, not 1.8.6 - I think it's pretty safe to delete it :)