Cucumber question - uninitialized constant creating object in model

Sorry if this is a really basic question. Scanned the past several
months archives, didn’t see it.

When I am running “cucumber features”

I get the error:

“uninitialized constant Thing (NameError)”

With step code being executed as…

Given /^a thing consisting of “L1” $/ do
Thing.new
end

I understand that this probably a basic question but it’s like
cucumber isn’t loading my rails environment.

Many thanks in advance.

T

On Sun, Nov 23, 2008 at 11:50 AM, Tim W. [email protected] wrote:

Given /^a thing consisting of “L1” $/ do
Thing.new
end

I understand that this probably a basic question but it’s like
cucumber isn’t loading my rails environment.

Many thanks in advance.

Have you read and followed
GitHub: Let’s build from here · GitHub?

Tim W. wrote:


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Sounds like your env.rb file is either not being required or it does not
contain the rails require.

If you have a env.rb check it requires rails
@@@

Sets up the Rails environment for Cucumber

ENV[“RAILS_ENV”] = “test”
require File.expand_path(File.dirname(FILE) +
‘/…/…/…/config/environment’)

@@@

Also make sure when you run the cucumber command that it either
automatically (it will include siblings or below) or explicitly though a
–require includes your env.rb


Joseph W.

Thanks very much for this information guys. I got side-tracked with a
dev issue and hope to have time to work on this this morning. No doubt
my env.rb is jacked. What part of the install creates that? I see it
in the downloaded project but not in my development project after
installing cucumber. Should this like in config and is it specific to
cucumber? Many thanks again as I get up to speed.

Also, any chance to be a Beta read of the RSpec book?

Sincerely,

Tim
On Mon, Nov 24, 2008 at 8:50 AM, aslak hellesoy

On Sun, Nov 23, 2008 at 6:50 PM, Tim W. [email protected] wrote:

Given /^a thing consisting of “L1” $/ do
Thing.new
end

I understand that this probably a basic question but it’s like
cucumber isn’t loading my rails environment.

What version/revision of cucumber?
What’s in your features directory?
What’s the contents of your env.rb file?
What’s the full stack trace?

Aslak

Typo in last is confusing ’

“Should this LIKE in config”

should be…

“Should this LIVE in config”.

T

On Tue, Nov 25, 2008 at 8:13 AM, Tim W. [email protected] wrote:

Thanks very much for this information guys. I got side-tracked with a
dev issue and hope to have time to work on this this morning. No doubt
my env.rb is jacked. What part of the install creates that? I see it
in the downloaded project but not in my development project after
installing cucumber. Should this like in config and is it specific to
cucumber? Many thanks again as I get up to speed.

Also, any chance to be a Beta read of the RSpec book?

Coming in December.

Cheers,
David

Thank you. I have the env.rb loading the environment now and am making
progress.

Question:

In Cucumber when you’re writing code to satisfy steps and accessing
the model objects directly, what support for asserts, responses, etc.
do people use. (the equivalent of ActionController::TestCase and
ActiveSupport::TestCase), Fixtures, etc.

Many thanks,

Tim