Sha256: a7574f39ab24dc56b3352edc786b323fe82536d1c996b496dd99a050dd730350

Contents?: true

Size: 932 Bytes

Versions: 7

Compression:

Stored size: 932 Bytes

Contents

require_relative 'spec_helper'

require 'libis/services/primo/search'
require 'libis-tools'

describe 'Primo search service' do
  let(:subject) { Libis::Services::Primo::Search.new }

  context 'query' do

    it 'default return result' do
      result = subject.query 'foo'
      expect(result.keys).to eq [:count, :from, :to, :step, :data]
      expect(result[:data].size).to eq [result[:count], result[:step] - 1].min
    end

  end

  context 'find' do

    it 'default return result' do
      result = subject.query 'foo'
      count = result[:count]
      result = subject.find 'foo'
      expect(result).to be_a Array
      expect(result.size).to eq count
    end

    it 'limit number of results' do
      result = subject.query 'foo', step: 1
      count = result[:count] / 2
      result = subject.find 'foo', max_count: count
      expect(result).to be_a Array
      expect(result.size).to eq count
    end

  end

  end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
libis-services-0.1.7 spec/primo_search_spec.rb
libis-services-0.1.5 spec/primo_search_spec.rb
libis-services-0.1.3 spec/primo_search_spec.rb
libis-services-0.1.2 spec/primo_search_spec.rb
libis-services-0.1.1 spec/primo_search_spec.rb
libis-services-0.1.0-java spec/primo_search_spec.rb
libis-services-0.0.3 spec/primo_search_spec.rb