Sha256: 00afc5a302ddd46991c70759974ec34164c768ab845572a81da2bf4b4d4c9170

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

require 'spec_helper'

describe CustomizedOrderable do

  shared_examples_for 'customized_orderable' do

    it 'does not have default position field' do
      expect(CustomizedOrderable.fields).not_to have_key('position')
    end

    it 'should have custom pos field' do
      expect(CustomizedOrderable.fields).to have_key('pos')
    end

    it 'should have an alias my_position which points to pos field on Mongoid 3+' do
      expect(CustomizedOrderable.database_field_name('my_position')).to eq('pos')
    end
  end

  context 'with transactions' do
    enable_transactions!

    it_behaves_like 'customized_orderable'
  end

  context 'without transactions' do
    disable_transactions!

    it_behaves_like 'customized_orderable'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid_orderable-6.0.4 spec/integration/customized_spec.rb
mongoid_orderable-6.0.3 spec/integration/customized_spec.rb
mongoid_orderable-6.0.2 spec/integration/customized_spec.rb