There is a nice little gem that gives you desktop notifications of your spec commands called test_noitifer (http://github.com/fnando/ test_notifier). I can get it to work by including require "test_notifier/rspec" toward the top of my spec_helper, or by manually including it in the command line like: spec <spec file> --require "test_notifier/rspec" However, if I add it to the top of my spec.opts file, I get the following error: /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- "test_notifier/ rspec" (LoadError) Any ideas on how to make it work? I don't want to add it to spec_helper because then others on my team would need to use the gem as well (which they might not want to).
on 2010-03-02 20:26
on 2010-03-02 20:37
On Tue, Mar 2, 2010 at 1:22 PM, drewB <dbatshaw@gmail.com> wrote: > > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require': no such file to load -- "test_notifier/ > rspec" (LoadError) > > Any ideas on how to make it work? I don't want to add it to > spec_helper because then others on my team would need to use the gem > as well (which they might not want to). spec.opts is not a ruby file, so you can't put it there. Why not add it to a ruby file in spec/support/ that you don't keep in source control?
on 2010-03-02 22:19
I may not have been clear. When I said if I add it to the top of my spec.opts file, I meant adding, '--require "test_notifier/rspec"'. Nevertheless, I tried you suggestion (a very good one). Unfortunately, it seems that it must be required before "require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))" or the following error appears: /usr/local/lib/site_ruby/1.8/rubygems.rb:270:in `activate': You have a nil object when you didn't expect it! (NoMethodError) You might have expected an instance of Array. The error occurred while evaluating nil.map
on 2010-03-03 00:20
If I add to spec.opts '--require test_notifier/rspec' (quotes are removed) it is finding it but I am encountering the same error as if I didn't require the file early enough in spec_helper: /usr/local/lib/site_ruby/1.8/rubygems.rb:270:in `activate': You have a nil object when you didn't expect it! (NoMethodError) You might have expected an instance of Array. The error occurred while evaluating nil.map No sure they same problem won't occur when using the option on the command line.
on 2010-03-03 15:01
On Tue, Mar 2, 2010 at 3:13 PM, drewB <dbatshaw@gmail.com> wrote: > You might have expected an instance of Array. > The error occurred while evaluating nil.map If you know where it works in the spec_helper file, then you can do what I suggested before, but in a new directory. So right now in spec_helper you've got something like: Dir['spec/support/*_.rb'].each {|f| require f} Do the same thing, but put your helpers in a separate directory, and include that _before_ the line that requires 'config/environment' Dir['spec/before_rails_loads/*_.rb'].each {|f| require f} require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) HTH, David
on 2010-03-03 20:44
Thank you. That makes perfect sense.
Just in case anyone else comes across this, for me to include spec/
before_rails_loads/test_notifer.rb I needed to remove the underscore
so:
Dir['spec/before_rails_loads/*.rb'].each {|f| require f}
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.