Error when using TDD with Ruby

1

Hello,

I'm starting to study about TDD with Ruby on Rails and I'm following a tutorial from Nando Viera [ 1 ], but when trying to execute a rake: test: units the following error is returned:

UserTest#test_truth:
ActiveRecord::StatementInvalid: Mysql::Error: Field 'name' doesn't have a default value: INSERT INTO 'users' ('id') VALUES (980190962)

Follow my migration:

  class CreateUsers < ActiveRecord::Migration
  def self.up
     create_table :users do |t|
       t.column :name, :string, :null => false
       t.column :email, :string, :null => false
       t.column :password, :string, :null => false
     end
   end

   def self.down
     drop_table :users
   end
end

And the test:

require 'test_helper'

class UserTest < ActiveSupport::TestCase
  fixtures :users

  def test_truth
    assert true
  end

end

Thank you.

    
asked by anonymous 30.11.2015 / 01:26

0 answers