waistband 0.16.5 → 0.16.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,10 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 1.9.3
5
4
  - 2.0.0
6
5
  - 2.1.1
7
6
 
8
- script: bundle exec rspec spec
7
+ script: bundle exec rspec spec/
9
8
 
10
9
  services:
11
10
  - elasticsearch
@@ -10,7 +10,7 @@ module Waistband
10
10
  def initialize(arr, options)
11
11
  @current_page = (options[:current_page] || 1).to_i
12
12
  @total_count = (options[:total_count] || arr.length).to_i
13
- @per_page = (options[:per_page] || ::Waistband::SearchResults::DEFAULT_PAGE_SIZE).to_i
13
+ @per_page = (options[:page_size] || options[:per_page] || ::Waistband::SearchResults::DEFAULT_PAGE_SIZE).to_i
14
14
  @num_pages = @total_pages = (options[:num_pages] || (@total_count.to_f / @per_page).ceil)
15
15
  @limit_value = options[:limit]
16
16
  super(arr)
@@ -1,3 +1,3 @@
1
1
  module Waistband
2
- VERSION = "0.16.5"
2
+ VERSION = "0.16.6"
3
3
  end
@@ -30,7 +30,7 @@ describe ::Waistband::SearchResults do
30
30
  }
31
31
  end
32
32
 
33
- let(:results) { ::Waistband::SearchResults.new(search_hash) }
33
+ let(:results) { ::Waistband::SearchResults.new(search_hash, page_size: 10) }
34
34
 
35
35
  it "provides a method interface for the results hash array" do
36
36
  expect(results.took).to eql 1
@@ -83,6 +83,7 @@ describe ::Waistband::SearchResults do
83
83
  expect(results.paginated_hits).to be_a ::Waistband::SearchResults::PaginatedArray
84
84
  expect(results.paginated_hits.total_pages).to eql 1
85
85
  expect(results.paginated_hits.current_page).to eql 1
86
+ expect(results.paginated_hits.instance_variable_get('@per_page')).to eql 10
86
87
  end
87
88
 
88
89
  end
@@ -95,6 +96,7 @@ describe ::Waistband::SearchResults do
95
96
  expect(results.paginated_results).to be_a ::Waistband::SearchResults::PaginatedArray
96
97
  expect(results.paginated_results.total_pages).to eql 1
97
98
  expect(results.paginated_results.current_page).to eql 1
99
+ expect(results.paginated_hits.instance_variable_get('@per_page')).to eql 10
98
100
  end
99
101
 
100
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waistband
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.5
4
+ version: 0.16.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-12 00:00:00.000000000 Z
12
+ date: 2017-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport