The rails testing framework keeps giving me errors unrelated to my test files or my test_helper file, and I'm not sure why. It seems like it's running code from other parts of the project, and I'm trying to find out how it gets there.
$ rake test
Run options: --seed 42237
Finished in 0.692285s, 4.3335 runs/s, 0.0000 assertions/s.
ActiveRecord::StatementInvalid: Mysql2::Error: Field 'created_at' doesn't have a default value: INSERT INTO `balancesheets` (`Company_ID`, `Balancesheet_date`) VALUES (1, '2015-05-12')
I tried to write tests for my User model, but even if change the test to just "assert true", it still gets the strange output. Here is my test/models/user_test.rb
class UserTest < ActiveSupport::TestCase
test "the truth" do
And here is my test/test_helper.rb
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
# Add more helper methods to be used by all tests here...
I'm new to rails, and so both files are still basically their defaults when you start a new project. Why do I see test output relating to a mysql INSERT? If you could point me in the right direction, that would be great. Also, let me know if I need to add more context. Thanks!
Here is the file in db/migrate/ where I create
class CreateBalancesheets < ActiveRecord::Migration
create_table :balancesheets do |t|
t.timestamps null: false