Add default for scores.score

This commit is contained in:
Thor77 2018-11-19 14:41:16 +01:00
parent 65abada8b2
commit 6e1af687ad
2 changed files with 1 additions and 5 deletions

View File

@ -92,7 +92,7 @@ class CreateSchema < ActiveRecord::Migration[5.2]
end
create_table :scores do |t|
t.integer :score, null: false
t.integer :score, default: 0
t.belongs_to :match, index: true, null: false, foreign_key: { on_delete: :cascade }
t.belongs_to :team, index: true, null: false, foreign_key: { on_delete: :cascade }

View File

@ -3,10 +3,6 @@
require 'rails_helper'
RSpec.describe Score, type: :model do
describe 'validation' do
it { should validate_presence_of :score }
end
describe 'association' do
it { should belong_to :match }
it { should belong_to :team }