Add default for scores.score
This commit is contained in:
parent
65abada8b2
commit
6e1af687ad
|
|
@ -92,7 +92,7 @@ class CreateSchema < ActiveRecord::Migration[5.2]
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table :scores do |t|
|
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 :match, index: true, null: false, foreign_key: { on_delete: :cascade }
|
||||||
t.belongs_to :team, index: true, null: false, foreign_key: { on_delete: :cascade }
|
t.belongs_to :team, index: true, null: false, foreign_key: { on_delete: :cascade }
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Score, type: :model do
|
RSpec.describe Score, type: :model do
|
||||||
describe 'validation' do
|
|
||||||
it { should validate_presence_of :score }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'association' do
|
describe 'association' do
|
||||||
it { should belong_to :match }
|
it { should belong_to :match }
|
||||||
it { should belong_to :team }
|
it { should belong_to :team }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue