Sha256: 27ba62b7af1e079aaac2107d79e9b91b75ae106c9c08a43858989c093d5e2aca

Contents?: true

Size: 764 Bytes

Versions: 3

Compression:

Stored size: 764 Bytes

Contents

require 'spec_helper'

describe StringScopedOrderable do

  shared_examples_for 'string_scoped_orderable' do

    it 'uses the foreign key of the relationship as scope' do
      orderable1 = StringScopedOrderable.create!(some_scope: 1)
      orderable2 = StringScopedOrderable.create!(some_scope: 1)
      orderable3 = StringScopedOrderable.create!(some_scope: 2)
      expect(orderable1.position).to eq 1
      expect(orderable2.position).to eq 2
      expect(orderable3.position).to eq 1
    end
  end

  context 'with transactions' do
    enable_transactions!

    it_behaves_like 'string_scoped_orderable'
  end

  context 'without transactions' do
    disable_transactions!

    it_behaves_like 'string_scoped_orderable'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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