Sha256: d09f3b778c56d08ebead223f5250d04ecd89f2fdb288e90210bd690000b221f1
Contents?: true
Size: 818 Bytes
Versions: 18
Compression:
Stored size: 818 Bytes
Contents
# frozen_string_literal: true require_relative '../../../lib/declare_schema/field_declaration_dsl' RSpec.describe DeclareSchema::FieldDeclarationDsl do before do load File.expand_path('prepare_testapp.rb', __dir__) class TestModel < ActiveRecord::Base fields do name :string, limit: 127 timestamps end end end let(:model) { TestModel.new } subject { declared_class.new(model) } it 'has fields' do expect(TestModel.field_specs).to be_kind_of(Hash) expect(TestModel.field_specs.keys).to eq(['name', 'created_at', 'updated_at']) expect(TestModel.field_specs.values.map(&:type)).to eq([:string, :datetime, :datetime]) end it 'stores limits' do expect(TestModel.field_specs['name'].limit).to eq(127) end # TODO: fill out remaining tests end
Version data entries
18 entries across 18 versions & 1 rubygems