Sha256: 8046b83ac60d880e9fbdc1d583c11d5b0b39afee90b6b50bf1ddd8a373df5ec3

Contents?: true

Size: 721 Bytes

Versions: 103

Compression:

Stored size: 721 Bytes

Contents

require File.join(File.dirname(__FILE__), 'post')

module MockAdapter
  class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
    def id
      @instance.id
    end
  end

  class DataAccessor < Sunspot::Adapters::DataAccessor
    def load(id)
      @clazz.get(id.to_i)
    end

    def load_all(ids)
      all = @clazz.get_all(ids.map { |id| id.to_i })
      if @custom_title
        all.each { |item| item.title = @custom_title }
      end
      all
    end

    def custom_title=(custom_title)
      @custom_title = custom_title
    end
  end
end

Sunspot::Adapters::DataAccessor.register(MockAdapter::DataAccessor, MockRecord)
Sunspot::Adapters::InstanceAdapter.register(MockAdapter::InstanceAdapter, MockRecord)

Version data entries

103 entries across 103 versions & 20 rubygems

Version Path
sunspot-2.7.1 spec/mocks/mock_adapter.rb
sunspot-2.7.0 spec/mocks/mock_adapter.rb
sunspot-2.6.0 spec/mocks/mock_adapter.rb
sunspot-2.5.0 spec/mocks/mock_adapter.rb
sunspot-2.4.0 spec/mocks/mock_adapter.rb
sunspot-2.3.0 spec/mocks/mock_adapter.rb
sunspot-2.2.8 spec/mocks/mock_adapter.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot-2.2.7/spec/mocks/mock_adapter.rb
sunspot-2.2.7 spec/mocks/mock_adapter.rb
sunspot-2.2.6 spec/mocks/mock_adapter.rb
sunspot-2.2.5 spec/mocks/mock_adapter.rb
sunspot-2.2.4 spec/mocks/mock_adapter.rb
sunspot-2.2.3 spec/mocks/mock_adapter.rb
sunspot-2.2.2 spec/mocks/mock_adapter.rb
sunspot-2.2.1 spec/mocks/mock_adapter.rb
sunspot-2.2.0 spec/mocks/mock_adapter.rb
Chrononaut-sunspot-client-0.9.4 spec/mocks/mock_adapter.rb
UnderpantsGnome-sunspot-0.9.1.1 spec/mocks/mock_adapter.rb
UnderpantsGnome-sunspot-0.9.8.1 spec/mocks/mock_adapter.rb
benjaminkrause-sunspot-0.9.7 spec/mocks/mock_adapter.rb