Fix tests

This commit is contained in:
Urban Rotnik 2019-12-06 14:20:37 +01:00
parent e934e08c17
commit eca0c84bbd
3 changed files with 5 additions and 3 deletions

View file

@ -80,7 +80,7 @@ class RepositoryCell < ApplicationRecord
private
def repository_column_data_type
if !repository_column || value_type != repository_column.data_type
if !repository_column || value.class.name != repository_column.data_type
errors.add(:value_type, 'must match column data type')
end
end

View file

@ -1,11 +1,13 @@
# frozen_string_literal: true
FactoryBot.define do
factory :repository_date_time_value do
factory :repository_date_time_value_base do
created_by { create :user }
last_modified_by { created_by }
data { Time.zone.now }
end
factory :repository_date_time_value, parent: :repository_date_time_value_base, class: 'RepositoryDateTimeValue' do
after(:build) do |value|
value.repository_cell ||= build(:repository_cell, :date_time_value, repository_date_time_value: value)
end

View file

@ -3,7 +3,7 @@
require 'rails_helper'
describe RepositoryDateTimeValue, type: :model do
let(:repository_date_time_value) { create :repository_date_time_value }
let(:repository_date_time_value) { build :repository_date_time_value }
it 'is valid' do
expect(repository_date_time_value).to be_valid