Nope, despite my efforts to repro this earlier, it’s started
happening again.
Check out the output from autotest:
/usr/local/bin/ruby -S script/spec -O spec/spec.opts /Users/matt/
Documents/projects/songkick/skweb/app/controllers/admin/
cities_controller.rb spec/controllers/admin/cities_controller_spec.rb
/Users/matt/Documents/projects/songkick/skweb/app/controllers/admin/
cities_controller.rb:1: uninitialized constant Admin (NameError)
from /Users/matt/Documents/projects/songkick/skweb/vendor/
plugins/rspec/lib/spec/runner/example_group_runner.rb:14:in load' from /Users/matt/Documents/projects/songkick/skweb/vendor/ plugins/rspec/lib/spec/runner/example_group_runner.rb:14:in
load_files’
from /Users/matt/Documents/projects/songkick/skweb/vendor/
plugins/rspec/lib/spec/runner/example_group_runner.rb:13:in each' from /Users/matt/Documents/projects/songkick/skweb/vendor/ plugins/rspec/lib/spec/runner/example_group_runner.rb:13:in
load_files’
from /Users/matt/Documents/projects/songkick/skweb/vendor/
plugins/rspec/lib/spec/runner/options.rb:98:in run_examples' from /Users/matt/Documents/projects/songkick/skweb/vendor/ plugins/rspec/lib/spec/runner/command_line.rb:19:in
run’
from script/spec:4
/usr/local/bin/ruby -S script/spec -O spec/spec.opts /Users/matt/
Documents/projects/songkick/skweb/app/controllers/admin/
cities_controller.rb spec/controllers/admin/cities_controller_spec.rb
…
Finished in 0.183342 seconds
16 examples, 0 failures
The first time, I saved the controller, and it bombed. The second
time, I switched to the spec and saved that. Each time it looks as
though the same parameters are being passed to script/spec, but
something different is happening after that…
I’ve tried variously referring to the base class ::AdminController,
as Ben suggested but it doesn’t seem to make any difference.
Right now, it looks like
class Admin::CitiesController < ::AdminController
Perhaps the reason the spec works is that it shares some behaviour
with the AdminController specs:
require File.expand_path(File.dirname(FILE) +
‘/…/…/spec_helper’)
require File.expand_path(File.dirname(FILE) + ‘/…/
admin_controller_spec’)
describe Admin::CitiesController do
it_should_behave_like "all admin controllers"
… etc
I’m using ZenTest 3.10.0 / Rails 2.1 / RSpec 1.1.4
cheers,
Matt
http://blog.mattwynne.net
In case you wondered: The opinions expressed in this email are my own
and do not necessarily reflect the views of any former, current or
future employers of mine.