Tuesday, February 3, 2009

Using --trace; cucumber & machinist order of loading files

I followed this tutorial to easily use Cucumber with a fixture replacement plugin called Machinist. It worked great on my desktop, but when I moved to my laptop, running rake features didn't work - an "uninitialized constant Sham" error popped up and I spent a day figuring it out.

Although the context of this problem is Cucumber and Machinist (which includes Sham), this is a post that talks about using --trace when you run into problems similar to this.

IF YOU'RE FAMILIAR WITH CUCUMBER & MACHINIST...
The problem occured partially because I put my blueprints.rb file where env.rb is. I believe cucumber loads everything there in alphabetical order (doesn't explain why my desktop loaded things differently). The problem is that blueprints.rb tries to call "Sham" which is something that is loaded by Machinist, which in turn is loaded during or after env.rb, not before.

IF YOU'RE NOT FAMILIAR NEITHER CUCUMBER NOR MACHINIST...
The problem occured because of the order files were loaded. I do not know why files were loaded differently in my desktop vs the laptop, but what the heck -- I found the error by using --trace and actually read the big bad ugly code that rake conveniently hides from us.

http://pastie.org/379188

So the lesson is: actually read what --trace spits out! :)

1 comment:

Thiago Pradi said...

I'm getting the same error here... What you did to fix it?