So, as far as I can see user_administrator is an attribute of users.
However, when I have this step defintion:
When /user named “(.*)” is an administrator/ do |name|
my_user = User.find_by_username!(name)
my_user.user_administrator
end
Then I see this error:
And the user named "newuser" is an administrator #
features/app/models/users/step_definitions/user_steps.rb:24
undefined method user_administrator' for #<User:0x2ac26fa83e80> (NoMethodError) /usr/lib64/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:260:inmethod_missing’
./features/app/models/users/step_definitions/user_steps.rb:26:in And /user named "(.*)" is an administrator/' features/app/models/users/user.feature:29:inAnd the user named
“newuser” is an administrator’
Have I misspelled something somewhere and just cannot see it? what is
causing this?
And the user named "newuser" is an administrator #
features/app/models/users/step_definitions/user_steps.rb:24
undefined method user_administrator' for #<User:0x2ac26fa83e80> (NoMethodError) /usr/lib64/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:260:inmethod_missing’
./features/app/models/users/step_definitions/user_steps.rb:26:in And /user named "(.*)" is an administrator/' features/app/models/users/user.feature:29:inAnd the user named
“newuser” is an administrator’
Have I misspelled something somewhere and just cannot see it? what is
causing this?
I have changed the type to string and get the same error. I have
changed the attribute name to useradministrator and still get the same
error.
I have gotten past this somehow. The only thing that I think may have
influenced this is manually preparing the test database. However, now I
have a different problem.
Here is the same step definition:
When /user named “(.*)” is an administrator/ do |name|
my_user = User.find_by_username!(name)
puts my_user.administrator.to_s
my_user.administrator
end
This produces this output in a cucumber run:
false
And the user named “newuser” is an administrator #
features/app/models/users/step_definitions/user_steps.rb:24
Notice the value reported from the puts statement. Yet, this feature
step passes. What am I doing wrong?