I'm trying to make a Hobo app with a REST api and test it with RSpec with FactoryGirl fixtures.
my user fields look like:
fields do
name :string, :required, :unique
email_address :email_address, :login => true
administrator :boolean, :default => false
api_key :string, :default=>""
timestamps
end
And I have a user factory which looks like:
FactoryGirl.define do
factory :user do
name "Joe Blow"
administrator false
api_key "nil value"
end
end
Right at the start of my first spec file I do
let(:user) { FactoryGirl.create(:user) }
And the failure I get is:
Failure/Error: let(:user) { FactoryGirl.create(:user) }
NoMethodError:
undefined method `api_key=' for #<User:0x00000103ccf098>
In development mode, the api_key can be populated (by an observer)
and generally works as expected.
Can anyone please give me a hint why this is an unknown attribute when
trying to run rspec?
Thanks in advance.
Mike K