jeweler - wasn't too tough to set up, I'm using 1.8.3
So, run:
- $ jeweler --rspec tower_d
- $ cd tower_d
- $ rake
F Failures: 1) TowerD fails Failure/Error: fail "hey buddy, you should probably rename this file and start specing for real" RuntimeError: hey buddy, you should probably rename this file and start specing for real # ./spec/tower_d_spec.rb:5:in `block (2 levels) in' Finished in 0.00038 seconds 1 example, 1 failure Failed examples: rspec ./spec/tower_d_spec.rb:4 # TowerD fails
Ok, now to get autotest working...
- $ autotest
loading autotest/rspec2
Uhoh, it just hangs and doesn't run anything... this is where we run off the rails a bit. Time to read through page after page of conflicting advice based on which version of autotest/ZenTest/rspec/etc we're running.
$ bundle list Gems included by the bundle: * bundler (1.1.4) * diff-lcs (1.1.3) * git (1.2.5) * jeweler (1.8.3) * json (1.7.3) * multi_json (1.3.6) * rake (0.9.2.2) * rdoc (3.12) * rspec (2.8.0) * rspec-core (2.8.0) * rspec-expectations (2.8.0) * rspec-mocks (2.8.0) * simplecov (0.6.4) * simplecov-html (0.5.3) $ gem list autotest *** LOCAL GEMS *** autotest (4.4.6) autotest-fsevent (0.2.8) autotest-growl (0.2.16) autotest-rails (4.1.2, 4.1.1)Hmm... ok, well there's this (rspec wiki) that says for rspec > 2.3 (I'm using 2.8.0) to "make sure you have a .rspec file in the project root. That tells RSpec to tell Autotest to load RSpec’s autotest extension." Jeweler created one already, so that can't be it...
Turns out that you need something like this in a file called .autotest (at the root of your project). The way the wiki is formatted, it LOOKS like it applies to rspec-2.0 – 2.2 only, but it must be for all =/
Autotest.add_hook(:initialize) {|at| at.add_exception %r{^\.git} # ignore Version Control System at.add_exception %r{^./tmp} # ignore temp files, lest autotest will run again, and again... at.add_mapping(%r{^lib/.*\.rb$}) {|f, _| Dir['spec/**/*_spec.rb'] } nil }
tl;dr: Make sure you have a .autotest file that adds the mapping
No comments:
Post a Comment