gds-api-adapters 12.3.0 → 12.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,13 +4,26 @@ module GdsApi
4
4
  module TestHelpers
5
5
  module Rummager
6
6
  def rummager_has_services_and_info_data_for_organisation
7
- stub_request(:get, /example.com\/unified_search/).to_return(body: search_results)
8
- client.unified_search(example_query)
7
+ stub_request_for search_results_found
8
+ run_example_query
9
+ end
10
+
11
+ def rummager_has_no_services_and_info_data_for_organisation
12
+ stub_request_for no_search_results_found
13
+ run_example_query
9
14
  end
10
15
 
11
16
  private
12
17
 
13
- def search_results
18
+ def stub_request_for(result_set)
19
+ stub_request(:get, /example.com\/unified_search/).to_return(body: result_set)
20
+ end
21
+
22
+ def run_example_query
23
+ client.unified_search(example_query)
24
+ end
25
+
26
+ def search_results_found
14
27
  File.read(
15
28
  File.expand_path(
16
29
  "../../../../test/fixtures/services_and_info_fixture.json",
@@ -19,6 +32,15 @@ module GdsApi
19
32
  )
20
33
  end
21
34
 
35
+ def no_search_results_found
36
+ File.read(
37
+ File.expand_path(
38
+ "../../../../test/fixtures/no_services_and_info_data_found_fixture.json",
39
+ __FILE__
40
+ )
41
+ )
42
+ end
43
+
22
44
  def client
23
45
  GdsApi::Rummager.new("http://example.com")
24
46
  end
@@ -26,7 +48,7 @@ module GdsApi
26
48
  def example_query
27
49
  {
28
50
  filter_organisations: ["an-organisation-slug"],
29
- facet_specialist_sectors: "1000,examples:4,example_scope:global"
51
+ facet_specialist_sectors: "1000,examples:4,example_scope:global,order:value.title"
30
52
  }
31
53
  end
32
54
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '12.3.0'
2
+ VERSION = '12.4.0'
3
3
  end
@@ -0,0 +1,14 @@
1
+ {
2
+ "results": [],
3
+ "total": 712,
4
+ "start": 0,
5
+ "facets": {
6
+ "specialist_sectors": {
7
+ "options": [],
8
+ "documents_with_no_value": 712,
9
+ "total_options": 0,
10
+ "missing_options": 0
11
+ }
12
+ },
13
+ "suggested_queries": []
14
+ }
@@ -7,54 +7,55 @@
7
7
  "options": [
8
8
  {
9
9
  "value": {
10
- "title": "Waste",
11
- "slug": "environmental-management/waste",
10
+ "link": "/environmental-management/environmental-permits",
11
+ "title": "Environmental permits",
12
+ "slug": "environmental-management/environmental-permits",
12
13
  "example_info": {
13
- "total": 49,
14
+ "total": 47,
14
15
  "examples": [
15
16
  {
16
- "title": "Register as a waste carrier, broker or dealer (England)",
17
- "link": "/waste-carrier-or-broker-registration"
17
+ "title": "Check if you need an environmental permit",
18
+ "link": "/environmental-permit-check-if-you-need-one"
18
19
  },
19
20
  {
20
- "title": "Hazardous waste producer registration (England and Wales)",
21
- "link": "/hazardous-waste-producer-registration"
21
+ "title": "Environmental permit: how to apply",
22
+ "link": "/environmental-permit-how-to-apply"
22
23
  },
23
24
  {
24
- "title": "Check if you need an environmental permit",
25
- "link": "/environmental-permit-check-if-you-need-one"
25
+ "title": "Standard rules: environmental permitting",
26
+ "link": "/government/collections/standard-rules-environmental-permitting"
26
27
  },
27
28
  {
28
- "title": "Classify different types of waste",
29
- "link": "/how-to-classify-different-types-of-waste"
29
+ "title": "Environmental permitting (EP) charges scheme: April 2014 to March 2015",
30
+ "link": "/government/publications/environmental-permitting-ep-charges-scheme-april-2014-to-march-2015"
30
31
  }
31
32
  ]
32
33
  }
33
34
  },
34
35
  "documents": 47
35
36
  },
36
- {
37
37
  "value": {
38
- "title": "Environmental permits",
39
- "slug": "environmental-management/environmental-permits",
38
+ "link": "/environmental-management/waste",
39
+ "title": "Waste",
40
+ "slug": "environmental-management/waste",
40
41
  "example_info": {
41
- "total": 47,
42
+ "total": 49,
42
43
  "examples": [
43
44
  {
44
- "title": "Check if you need an environmental permit",
45
- "link": "/environmental-permit-check-if-you-need-one"
45
+ "title": "Register as a waste carrier, broker or dealer (England)",
46
+ "link": "/waste-carrier-or-broker-registration"
46
47
  },
47
48
  {
48
- "title": "Environmental permit: how to apply",
49
- "link": "/environmental-permit-how-to-apply"
49
+ "title": "Hazardous waste producer registration (England and Wales)",
50
+ "link": "/hazardous-waste-producer-registration"
50
51
  },
51
52
  {
52
- "title": "Standard rules: environmental permitting",
53
- "link": "/government/collections/standard-rules-environmental-permitting"
53
+ "title": "Check if you need an environmental permit",
54
+ "link": "/environmental-permit-check-if-you-need-one"
54
55
  },
55
56
  {
56
- "title": "Environmental permitting (EP) charges scheme: April 2014 to March 2015",
57
- "link": "/government/publications/environmental-permitting-ep-charges-scheme-april-2014-to-march-2015"
57
+ "title": "Classify different types of waste",
58
+ "link": "/how-to-classify-different-types-of-waste"
58
59
  }
59
60
  ]
60
61
  }
@@ -10,4 +10,11 @@ class RummagerHelpersTest < MiniTest::Unit::TestCase
10
10
 
11
11
  assert_instance_of GdsApi::Response, response
12
12
  end
13
+
14
+ def test_no_services_and_info_data_found_for_organisation
15
+ response = rummager_has_no_services_and_info_data_for_organisation
16
+
17
+ assert_instance_of GdsApi::Response, response
18
+ assert_equal 0, response.facets.specialist_sectors.total_options
19
+ end
13
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.3.0
4
+ version: 12.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -381,6 +381,7 @@ files:
381
381
  - test/asset_manager_test.rb
382
382
  - test/fixtures/hello.txt
383
383
  - test/fixtures/world_organisations_australia.json
384
+ - test/fixtures/no_services_and_info_data_found_fixture.json
384
385
  - test/fixtures/services_and_info_fixture.json
385
386
  - test/fixtures/finder_api/cma-case-schema.json
386
387
  - test/router_test.rb
@@ -404,7 +405,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
404
405
  version: '0'
405
406
  segments:
406
407
  - 0
407
- hash: 2677929826004224176
408
+ hash: -1699944453814934459
408
409
  required_rubygems_version: !ruby/object:Gem::Requirement
409
410
  none: false
410
411
  requirements:
@@ -413,7 +414,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
414
  version: '0'
414
415
  segments:
415
416
  - 0
416
- hash: 2677929826004224176
417
+ hash: -1699944453814934459
417
418
  requirements: []
418
419
  rubyforge_project:
419
420
  rubygems_version: 1.8.23
@@ -447,6 +448,7 @@ test_files:
447
448
  - test/asset_manager_test.rb
448
449
  - test/fixtures/hello.txt
449
450
  - test/fixtures/world_organisations_australia.json
451
+ - test/fixtures/no_services_and_info_data_found_fixture.json
450
452
  - test/fixtures/services_and_info_fixture.json
451
453
  - test/fixtures/finder_api/cma-case-schema.json
452
454
  - test/router_test.rb