# Substruct engine + rspec\_on\_rails not co-operating

**URL:** <https://www.ruby-forum.com/t/substruct-engine-rspec-on-rails-not-co-operating/78200>\
**Category:** Rails\
**Created:** [December 3, 2006, 11:31pm UTC](https://www.ruby-forum.com/t/substruct-engine-rspec-on-rails-not-co-operating/78200 "2006-12-03T23:31:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashley\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Post date:** [December 3, 2006, 11:31pm UTC](https://www.ruby-forum.com/t/substruct-engine-rspec-on-rails-not-co-operating/78200/1 "2006-12-03T23:31:42Z")

</div>

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 🙂 (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:in`gem\_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:in`require’  
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:in`require’  
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:in`run’  
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:in`run’  
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…]

---

<div class="post-metadata">

**Author:** ![Ashley\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Post date:** [December 4, 2006, 11:12am UTC](https://www.ruby-forum.com/t/substruct-engine-rspec-on-rails-not-co-operating/78200/2 "2006-12-04T11:12:51Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![Ashley\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Post date:** [December 4, 2006, 12:47am UTC](https://www.ruby-forum.com/t/substruct-engine-rspec-on-rails-not-co-operating/78200/3 "2006-12-04T00:47:50Z")

</div>

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

On 12/3/06, Ashley M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](http://www.subimage.com/sublog/)

---

<div class="post-metadata">

**Author:** ![Ashley\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Post date:** [December 5, 2006, 10:40am UTC](https://www.ruby-forum.com/t/substruct-engine-rspec-on-rails-not-co-operating/78200/4 "2006-12-05T10:40:44Z")

</div>

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://  
[Some AI Koans](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
