gds-api-adapters 10.10.0 → 10.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,6 +40,11 @@ module GdsApi
40
40
  }
41
41
  end
42
42
 
43
+ def stub_artefact_registration(slug, request_details = nil)
44
+ stub = stub_http_request(:put, "#{PANOPTICON_ENDPOINT}/artefacts/#{slug}.json")
45
+ stub.with(:body => request_details.to_json) unless request_details.nil?
46
+ stub.to_return(:status => 201)
47
+ end
43
48
  end
44
49
  end
45
50
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '10.10.0'
2
+ VERSION = '10.10.1'
3
3
  end
@@ -1,8 +1,9 @@
1
1
  require_relative 'test_helper'
2
2
  require 'gds_api/panopticon'
3
+ require 'ostruct'
3
4
 
4
5
  describe GdsApi::Panopticon::Registerer do
5
-
6
+ include GdsApi::TestHelpers::Panopticon
6
7
 
7
8
  describe "creating an instance of the panopticon client" do
8
9
  describe "setting the platform" do
@@ -52,4 +53,31 @@ describe GdsApi::Panopticon::Registerer do
52
53
  assert_equal :panopticon_instance, r.send(:panopticon)
53
54
  end
54
55
  end
56
+
57
+ it "should register artefacts" do
58
+ request = stub_artefact_registration('beards',
59
+ slug: 'beards',
60
+ owning_app: 'whitehall',
61
+ kind: 'detailed-guide',
62
+ name: 'A guide to beards',
63
+ description: '5 tips for keeping your beard in check',
64
+ state: 'draft',
65
+ need_ids: ["100001", "100002"]
66
+ )
67
+
68
+ GdsApi::Panopticon::Registerer.new(
69
+ owning_app: 'whitehall',
70
+ kind: 'detailed-guide'
71
+ ).register(
72
+ OpenStruct.new(
73
+ slug: 'beards',
74
+ title: 'A guide to beards',
75
+ description: '5 tips for keeping your beard in check',
76
+ state: 'draft',
77
+ need_ids: ["100001", "100002"]
78
+ )
79
+ )
80
+
81
+ assert_requested(request)
82
+ end
55
83
  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: 10.10.0
4
+ version: 10.10.1
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: 2014-04-23 00:00:00.000000000 Z
12
+ date: 2014-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plek
@@ -376,7 +376,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
376
376
  version: '0'
377
377
  segments:
378
378
  - 0
379
- hash: -4095217778574635020
379
+ hash: -2918489896800493261
380
380
  required_rubygems_version: !ruby/object:Gem::Requirement
381
381
  none: false
382
382
  requirements:
@@ -385,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
385
  version: '0'
386
386
  segments:
387
387
  - 0
388
- hash: -4095217778574635020
388
+ hash: -2918489896800493261
389
389
  requirements: []
390
390
  rubyforge_project:
391
391
  rubygems_version: 1.8.23