That does look rather terse – but notice that all your steps are
showing up as skipped. I’d say you’ve got a configuration issue. Check
your cucumber setup.
So it was a configuration error, having to do with my discovery that the
config/environment/cucumber.rb environment which was missing some app
specific constants, which in turn was causing my loading of fixtures to
fail
(albeit unreported).
Now another issue: I have my test::unit fixtures loading and confirmed
(this
is a legacy app). However they can not seem to be accessed from the
code.
This is what is in env.rb to load them:
Before do
Fixtures.reset_cache
fixtures_folder = File.join(RAILS_ROOT, ‘test’, ‘fixtures’)
fixtures = Dir[File.join(fixtures_folder, ‘*.yml’)].map {|f|
File.basename(f, ‘.yml’) }
Fixtures.create_fixtures(fixtures_folder, fixtures)
end
Then for example, in the cucumber step below, when I set the debugger, I
can
find, the specific users fixture through
Fixtures.all_loaded_fixtures[“users”][“sysadmin_user_one”]
But I can not get at its data (maybe you can tell me how to get at a
class
attribute inside a fixture object):
(rdb:1) Fixtures.all_loaded_fixtures[“users”][“sysadmin_user_one”]
#<Fixture:0x47776a4 @model_class=User(id: integer, login: string,
first_name: string, last_name: string, email: string, role_id: integer,
hashed_password: string, salt: string, created_at: datetime, updated_at:
datetime, enabled: boolean, account_id: integer, email_upon_upload:
boolean), @fixture={“salt”=>987654, “created_at”=>“2010-09-16
18:13:09”,
“updated_at”=>“2010-09-16 18:13:09”, “role_id”=>1033329129,
“hashed_password”=>“501d40d3a18d954855335c06bd56d47f8f5d4adc”,
“id”=>1067249891, “enabled”=>true, “last_name”=>“One”,
“login”=>“sysadminone”, “email”=>“[email protected]”,
“first_name”=>“Sysadmin”},
And using “users(:user_name)” as I would in Test::Unit does not work -
this
is where the step is failing.
I hope this is not as disgusting as I am making it… am I fighting the
universe (or in this case Cucumber::Rails::World) on this?
Given /^I am logged in as a sysadmin user$/ do
user = users(:sysadmin_user_one)
visit(’/login’)
fill_in(‘login’, user.login)
fill_in(‘password’, ‘password1’)
click_button(‘Log in’)
I should see ‘Welcome Sysadmin One’
end
Thanks,
David
On Wed, Sep 15, 2010 at 7:11 PM, Marnen Laibow-Koser