Sha256: 15e91f29a3f05da287cfd2df970ee163de04162d68db1824a266c9db2f22d5ea
Contents?: true
Size: 1.12 KB
Versions: 7
Compression:
Stored size: 1.12 KB
Contents
require 'spec_helper' describe ROM::Model::Attributes do let(:attributes) do Class.new do include ROM::Model::Attributes attribute :name, String timestamps end end describe '.timestamps' do it 'provides a way to specify timestamps with default values' do expect(attributes.new.created_at).to be_a(DateTime) expect(attributes.new.updated_at).to be_a(DateTime) end context 'passing in arbritrary names' do it 'excludes :created_at when passing in :updated_at' do attributes = Class.new { include ROM::Model::Attributes timestamps(:updated_at) } model = attributes.new expect(model).not_to respond_to(:created_at) expect(model).to respond_to(:updated_at) end it 'accepts multiple timestamp attribute names' do attributes = Class.new { include ROM::Model::Attributes timestamps(:published_at, :revised_at) } model = attributes.new expect(model).to respond_to(:published_at) expect(model).to respond_to(:revised_at) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems