Reputation: 4907
I have a test suite that continues to fail because of an unknown attribute error. The unknown attribute is datetime. Below is my schema file:
create_table "posts", force: true do |t|
t.string "title", null: false
t.text "body", null: false
t.datetime "date_created", null: false
t.integer "author_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "interest_group_id", null: false
t.integer "comments_count"
end
Here is a snippet from my rspec file:
let(:post){Post.new(body: 'hello', title: 'Hello,
by the Beatles', author: author, interest_group: interest_group,
date_created: ?????)}
My question is simple what do I place in the date_created field? Its looking for a value that is datetime specific but what does that look like? I've tried putting '2012-3-13' as an example but it fails due to the value being a string? Any ideas?
Upvotes: 0
Views: 312
Reputation: 53038
How about this?
let(:post){Post.new(body: 'hello', title: 'Hello,
by the Beatles', author: author, interest_group: interest_group,
date_created: DateTime.parse('2012-3-13'))}
Upvotes: 4