Sha256: bb1a0769c304c40778e291d44605c24db5f1a1ccd742625fe6e95abf672d391e
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
# -*- coding: utf-8 -*- require 'spec_helper' describe 'Schemaless' do it 'should respond to schemaless' do expect(ActiveRecord::Base).to respond_to :field end it 'should get all models`s fields' do expect(Bike.schemaless_fields.map(&:name)).to include('cylinders') end it 'should get a model current attributes' do expect(Bike.current_attributes.first).to be_a(::Schemaless::Field) end it 'should have a helper for timestamps' do expect(Bike.schemaless_fields.map(&:name)).to include('created_at') expect(Bike.schemaless_fields.map(&:name)).to include('updated_at') end # it 'should get attribute type string' do # expect(Bike.schemaless_fields[:attr_db]['name']).to eq(:string) # end # it 'should get attribute type integer' do # expect(Schemaless.schema['Bike'][:attr_db]['cylinders']).to eq(:integer) # end # it 'should not include primary keys' do # expect(Schemaless.schema['Bike'][:attr_db]).to_not include('id') # end # it 'should get all models`s fields' do # expect(Schemaless.schema['Bike'][:model]).to eq(Bike) # end # it 'should not include primary keys' do # expect(Schemaless.schema['Bike'][:attr_schema]).to include('cc') # end # it 'should get schemaless types' do # expect(Schemaless.schema['Bike'][:attr_schema]['cc']).to eq(:integer) # end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
schemaless-0.0.5 | spec/schemaless/ar/fields_spec.rb |
schemaless-0.0.3 | spec/schemaless/ar/fields_spec.rb |