Small fixes for factories

This commit is contained in:
Urban Rotnik 2019-06-10 12:19:10 +02:00
parent 1bae169ab0
commit bbe0062bfd
5 changed files with 7 additions and 4 deletions

View file

@ -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

View file

@ -4,5 +4,6 @@ FactoryBot.define do
factory :repository_table_state do
user
repository
state { {} }
end
end

View file

@ -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

View file

@ -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

View file

@ -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