Sha256: fd4bfc81a2bd518bdadb8dc812574b42d7129d1d2791354f10d4227a81636675

Contents?: true

Size: 774 Bytes

Versions: 16

Compression:

Stored size: 774 Bytes

Contents

require 'spec_helper'

describe Qbrick::Searchable do
  context 'with missing includes' do
    it 'raises exteption when class does not include Qbrick::Bricklist' do
      expect do
        class Foo
          include Qbrick::Searchable
        end
      end.to raise_error(/needs Qbrick::BrickList to be included/)
    end
  end

  context 'with Bricklist included' do
    class SearchableDemo < ActiveRecord::Base
      include Qbrick::BrickList
    end

    context 'without postgresql' do
      it 'initializes scope' do
        expect(ActiveRecord::Base.connection.instance_values).not_to eq('postgresql')
        expect(SearchableDemo).to receive :scope
        SearchableDemo.class_eval do
          include Qbrick::Searchable
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
qbrick-2.7.1 spec/lib/searchable_spec.rb
qbrick-2.7 spec/lib/searchable_spec.rb
qbrick-2.6.10 spec/lib/searchable_spec.rb
qbrick-2.6.9 spec/lib/searchable_spec.rb
qbrick-2.6.8 spec/lib/searchable_spec.rb
qbrick-2.6.7 spec/lib/searchable_spec.rb
qbrick-2.6.6 spec/lib/searchable_spec.rb
qbrick-2.6.5 spec/lib/searchable_spec.rb
qbrick-2.6.4 spec/lib/searchable_spec.rb
qbrick-2.6.3 spec/lib/searchable_spec.rb
qbrick-2.6.2 spec/lib/searchable_spec.rb
qbrick-2.6.1 spec/lib/searchable_spec.rb
qbrick-2.6.0 spec/lib/searchable_spec.rb
qbrick-2.5.2 spec/lib/searchable_spec.rb
qbrick-2.5.1 spec/lib/searchable_spec.rb
qbrick-2.5.0 spec/lib/searchable_spec.rb