Substruct engine + rspec_on_rails not co-operating

Hi

I promised a friend of mine I’d help update his online store. To get
something up fast, I thought I’d try Substruct. But I can’t make
rspec specs run with it installed.

I’ve got the 1.2 RC 1 gem installed, and my environment.rb starts
“module Engines; EdgeRails = true; end”

I’ve succuessfully installed Engines and Substruct, got the database
set up, and managed to rub Webrick and log in to the admin section.
So the app seems fine.

I generated a controller with “script/generate rspec_controller
stock_list_import”, but I can’t run it. rspec dies with the error
below. This is the exact same error I had before I configured
everything correctly (if I remember right, before I set the EdgeRails
constant in Engines).

I don’t understand why SubstructApplicationController is not
available to the spec, because:

  • the spec requires spec/spec_helper
  • spec/spec_helper requires config/environment
  • config/environment requires config/boot AND calls
    Engines.start :substruct

surely this is near enough the same as booting Webrick?

Any ideas why it doesn’t work? And before anyone asks, I’m an rspec
whore. Using Test::Unit IS out of the question :slight_smile: (not that I’ve
tried that anyway)

Ashley

$ rake spec:controllers
(in /Users/ashleymoran/Documents/Development/Stalmine/stalmine_tech)

/opt/local/bin/ruby -I"/opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/
lib" “/opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/bin/spec” “spec/
controllers/stock_list_import_controller_spec.rb”
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/
active_support/dependencies.rb:471:in const_missing': uninitialized constant ApplicationController::SubstructApplicationController (NameError) from /Users/ashleymoran/Documents/Development/Stalmine/ stalmine_tech/config/../app/controllers/application.rb:5 from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/ custom_require.rb:27:ingem_original_require’
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/
custom_require.rb:27:in require' from /opt/local/lib/ruby/gems/1.8/gems/ activesupport-1.3.1.5618/lib/active_support/dependencies.rb:489:inrequire’
from /opt/local/lib/ruby/gems/1.8/gems/
activesupport-1.3.1.5618/lib/active_support/dependencies.rb:337:in
new_constants_in' from /opt/local/lib/ruby/gems/1.8/gems/ activesupport-1.3.1.5618/lib/active_support/dependencies.rb:489:inrequire’
from /Users/ashleymoran/Documents/Development/Stalmine/
stalmine_tech/config/…/vendor/plugins/rspec/lib/rspec_on_rails.rb:1
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/
custom_require.rb:27:in gem_original_require' ... 20 levels... from /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/ runner/command_line.rb:21:inrun’
from /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/
runner/command_line.rb:15:in each' from /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/ runner/command_line.rb:15:inrun’
from /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/bin/spec:4
rake aborted!
Command failed with status (1): [/opt/local/bin/ruby -I"/opt/local/
lib/ruby…]

On 3 Dec 2006, at 23:47, subimage interactive wrote:

I’m at a loss here because I have no clue what rspec
is…url?

RSpec is a behaviour driven development (BDD) framework - http://
rspec.rubyforge.org/

It’s like Test::Unit/TDD, but you get more benefit out of it faster,
because it forces you to think about the problem in a more productive
way. (IMHO, I’m an rspec fanboy)

Ashley

I’m at a loss here because I have no clue what rspec is…url?

On 12/3/06, Ashley M. [email protected] wrote:

I don’t understand why SubstructApplicationController is not
tried that anyway)
controllers/stock_list_import_controller_spec.rb"
from /opt/local/lib/ruby/gems/1.8/gems/
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/
Command failed with status (1): [/opt/local/bin/ruby -I"/opt/local/
lib/ruby…]


seth at subimage interactive
http://www.subimage.com/sublog/

On 3 Dec 2006, at 23:47, subimage interactive wrote:

I’m at a loss here because I have no clue what rspec
is…url?

Hmm

I had a look last night, figured out that the Engines plugin modifies
the $LOAD_PATH variable, decided that must be broken when running
rspec, so I ran it again to get the exact error message … and it
worked :-S I don’t think I even changed anything…

This reminds me of the story Tom Knight and the Lisp Machine (http://
www.catb.org/jargon/html/koans.html) I read almost ten years ago. I
didn’t think it ever actually happened!!!

Anyway as long as rspec is working I’m happy

Ashley