File tree 2 files changed +16
-5
lines changed
lib/pact_broker/ui/controllers
spec/lib/pact_broker/ui/controllers
2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,16 @@ class Index < Base
15
15
tags = params [ :tags ] == 'true' ? true : [ *params [ :tags ] ] . compact
16
16
end
17
17
page_number = params [ :page ] &.to_i || 1
18
- page_size = params [ :pageSize ] &.to_i || 30
18
+ # Make page size smaller for data intensive query
19
+ page_size = params [ :pageSize ] &.to_i || ( params [ :tags ] == true ? 30 : 100 )
19
20
options = {
20
21
tags : tags ,
21
22
page_number : page_number ,
22
23
page_size : page_size
23
24
}
24
25
25
- options [ :optimised ] = true if params [ :optimised ] == 'true'
26
+ # TODO remove this code when verified
27
+ options [ :optimised ] = true unless params [ :optimised ] == 'false'
26
28
index_items = ViewDomain ::IndexItems . new ( index_service . find_index_items ( options ) )
27
29
28
30
page = tags ? :'index/show-with-tags' : :'index/show'
Original file line number Diff line number Diff line change @@ -38,9 +38,18 @@ module Controllers
38
38
end
39
39
40
40
context "when pagination parameters are not present" do
41
- it "passes through default pagination parameters to the search" do
42
- expect ( PactBroker ::Index ::Service ) . to receive ( :find_index_items ) . with ( hash_including ( page_number : 1 , page_size : 30 ) )
43
- get "/"
41
+ context "when tags=true" do
42
+ it "passes through default pagination parameters to the search with page_size=30" do
43
+ expect ( PactBroker ::Index ::Service ) . to receive ( :find_index_items ) . with ( hash_including ( page_number : 1 , page_size : 30 ) )
44
+ get "/" , { tags : 'true' }
45
+ end
46
+ end
47
+
48
+ context "when not tags=true" do
49
+ it "passes through default pagination parameters to the search with page_size=100" do
50
+ expect ( PactBroker ::Index ::Service ) . to receive ( :find_index_items ) . with ( hash_including ( page_number : 1 , page_size : 100 ) )
51
+ get "/"
52
+ end
44
53
end
45
54
end
46
55
You can’t perform that action at this time.
0 commit comments