mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-30 08:52:29 +08:00
Small fixes for factories
This commit is contained in:
parent
1bae169ab0
commit
bbe0062bfd
5 changed files with 7 additions and 4 deletions
app/models
spec
|
@ -9,7 +9,7 @@ class Result < ApplicationRecord
|
|||
validates :user, :my_module, presence: true
|
||||
validates :name, length: { maximum: Constants::NAME_MAX_LENGTH }
|
||||
|
||||
belongs_to :user, inverse_of: :results, optional: true
|
||||
belongs_to :user, inverse_of: :results
|
||||
belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User', optional: true
|
||||
belongs_to :archived_by, foreign_key: 'archived_by_id', class_name: 'User', optional: true
|
||||
belongs_to :restored_by, foreign_key: 'restored_by_id', class_name: 'User', optional: true
|
||||
|
|
|
@ -4,5 +4,6 @@ FactoryBot.define do
|
|||
factory :repository_table_state do
|
||||
user
|
||||
repository
|
||||
state { {} }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
FactoryBot.define do
|
||||
factory :table do
|
||||
name { Faker::Name.unique.name }
|
||||
contents { Faker::Lorem.characters }
|
||||
contents { { some_data: 'needs to be here' } }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,8 @@ FactoryBot.define do
|
|||
factory :view_state do
|
||||
state {}
|
||||
user
|
||||
viewable { create :team }
|
||||
trait :team do
|
||||
viewable { create :team }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ViewState, type: :model do
|
||||
let(:view_state) { build :view_state }
|
||||
let(:view_state) { build :view_state, :team }
|
||||
|
||||
it 'is valid' do
|
||||
expect(view_state).to be_valid
|
||||
|
|
Loading…
Add table
Reference in a new issue