omnijack 0.2.0 → 1.0.0.rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc253a8a3bc6dae6c9ab5ca28a1af127cbf8ca98
4
- data.tar.gz: 2886b763948b3e3b01d4ca1843b15588f1ee2717
3
+ metadata.gz: 9da3ed386e954d9cec3fe7af1ed98ffd922293f6
4
+ data.tar.gz: 557a27f54cda7880d16735dd6e342dc5d21a1a8c
5
5
  SHA512:
6
- metadata.gz: 8abff1f3f1bd23af2a420c9718425afc7b2adb65df2e42c5d585d56b3209a8b00a1c78bc69886ccddd1af29206ca8f29d5e2cd402b28ffa8cb43d2c5f243302d
7
- data.tar.gz: 085621d8d7d5cce42cc519b56847cfab0a80df7446a8f755adbf2d2f0ddcf8c0e458a1a3922f78cd4f48db3b1489f1c3fa656de10640fe9bb0a0e6228189ecd0
6
+ metadata.gz: 6ba750e4a5473fc133617fc87476c20e95025246de83b08b461313e9cbbe7ee284b70c790f86c7db5509adfe42a48bf4987a27ff99bb2ee270545264e87cf1f7
7
+ data.tar.gz: 2768872e886d0369fdce3b58e7f018c0a95fe2f26c32419d73f878a3c6202a5a67b1287c1df646f4f23c6687606948ec8613b17c702c063f47dc80e0ffb3fc65
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Omnijack Gem CHANGELOG
2
2
  ======================
3
3
 
4
+ v1.0.0 (????-??-??)
5
+ -------------------
6
+ - Remove dependency on `ohai`; require platform arguments for metadata
7
+ - Swap out `json` dependency for `multi_json`
8
+
4
9
  v0.2.0 (2014-09-19)
5
10
  -------------------
6
11
  - Calculate and expose version and build numbers as part of metadata
data/README.md CHANGED
@@ -3,7 +3,7 @@ Omnijack
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/omnijack.png)][fury]
5
5
  [![Build Status](http://img.shields.io/travis/RoboticCheese/omnijack-ruby.svg)][travis]
6
- [![Code Climate](http://img.shields.io/codeclimate/github/kabisaict/flow.svg)][codeclimate]
6
+ [![Code Climate](http://img.shields.io/codeclimate/github/RoboticCheese/omnijack-ruby.svg)][codeclimate]
7
7
  [![Coverage Status](http://img.shields.io/coveralls/RoboticCheese/omnijack-ruby.svg)][coveralls]
8
8
  [![Dependency Status](http://img.shields.io/gemnasium/RoboticCheese/omnijack-ruby.svg)][gemnasium]
9
9
 
@@ -36,12 +36,21 @@ Or install it yourself as:
36
36
  Usage
37
37
  -----
38
38
 
39
- Getting Chef-DK package metadata from the official Chef API:
39
+ Getting Chef-DK project data from the official Chef API:
40
40
 
41
41
  ```ruby
42
42
  require 'omnijack'
43
43
 
44
44
  chef_dk = Omnijack::Project::ChefDk.new
45
+ ```
46
+
47
+ Getting Chef-DK package metadata (requires additional target platform
48
+ information):
49
+
50
+ ```ruby
51
+ chef_dk = Omnijack::Project::ChefDk.new(platform: 'ubuntu',
52
+ platform_version: '14.04',
53
+ machine_arch: 'x86_64')
45
54
  metadata = chef_dk.metadata
46
55
 
47
56
  puts metadata
@@ -62,6 +71,7 @@ puts metadata[:yolo]
62
71
  puts metadata[:version]
63
72
  puts metadata[:build]
64
73
  ```
74
+
65
75
  Getting Chef-DK project data from an unofficial Omnitruck API:
66
76
 
67
77
  ```ruby
@@ -80,16 +90,6 @@ Omnijack::Project::ChefDk.new(
80
90
  )
81
91
  ```
82
92
 
83
- Getting Chef-DK project data for a platform other than the one running:
84
-
85
- ```ruby
86
- Omnijack::Project::ChefDk.new(
87
- platform: 'ubuntu',
88
- platform_version: '14.04',
89
- machine_arch: 'x86_64'
90
- )
91
- ```
92
-
93
93
  Getting the Chef project's list of packages:
94
94
 
95
95
  ```ruby
@@ -132,6 +132,7 @@ Contributing
132
132
 
133
133
  1. Fork it ( https://github.com/[my-github-username]/omnijack/fork )
134
134
  2. Create your feature branch (`git checkout -b my-new-feature`)
135
- 3. Commit your changes (`git commit -am 'Add some feature'`)
136
- 4. Push to the branch (`git push origin my-new-feature`)
137
- 5. Create a new Pull Request
135
+ 3. Add tests for any new code and ensure all tests pass (`rake`)
136
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
137
+ 5. Push to the branch (`git push origin my-new-feature`)
138
+ 6. Create a new Pull Request
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ RuboCop::RakeTask.new
13
13
  desc 'Display LOC stats'
14
14
  task :loc do
15
15
  puts "\n## LOC Stats"
16
- sh 'countloc -r lib/kitchen'
16
+ sh 'countloc -r lib/omnijack'
17
17
  end
18
18
 
19
19
  RSpec::Core::RakeTask.new(:spec)
@@ -1,18 +1,17 @@
1
1
  # Encoding: UTF-8
2
2
 
3
3
  Given(/^a(n)? ([\w ]+) ([0-9\.]+) node$/) do |_, platform, version|
4
- node = { platform: platform.split.join('_').downcase,
5
- platform_version: version,
6
- kernel: { machine: 'x86_64' } }
7
- allow_any_instance_of(Omnijack::Metadata).to receive(:node).and_return(node)
4
+ @args = { platform: platform.split.join('_').downcase,
5
+ platform_version: version,
6
+ machine_arch: 'x86_64' }
8
7
  end
9
8
 
10
9
  Given(/^no special arguments$/) do
11
- @args = {}
10
+ @args ||= {}
12
11
  end
13
12
 
14
13
  Given(/^nightlies enabled$/) do
15
- @args = { nightlies: true }
14
+ @args.merge!(nightlies: true)
16
15
  end
17
16
 
18
17
  When(/^I create a(n)? (\w+) project$/) do |_, project|
@@ -26,36 +26,36 @@ class Omnijack
26
26
  angry_chef: {
27
27
  endpoints: {
28
28
  metadata: '/metadata-angrychef',
29
- package_list: '/full_angrychef_list',
30
- platform_names: '/angrychef_platform_names'
29
+ list: '/full_angrychef_list',
30
+ platforms: '/angrychef_platform_names'
31
31
  }
32
32
  },
33
33
  chef: {
34
34
  endpoints: {
35
35
  metadata: '/metadata',
36
- package_list: '/full_client_list',
37
- platform_names: '/chef_platform_names'
36
+ list: '/full_client_list',
37
+ platforms: '/chef_platform_names'
38
38
  }
39
39
  },
40
40
  chef_dk: {
41
41
  endpoints: {
42
42
  metadata: '/metadata-chefdk',
43
- package_list: '/full_chefdk_list',
44
- platform_names: '/chefdk_platform_names'
43
+ list: '/full_chefdk_list',
44
+ platforms: '/chefdk_platform_names'
45
45
  }
46
46
  },
47
47
  chef_container: {
48
48
  endpoints: {
49
49
  metadata: '/metadata-container',
50
- package_list: '/full_container_list',
51
- platform_names: '/chef_container_platform_names'
50
+ list: '/full_container_list',
51
+ platforms: '/chef_container_platform_names'
52
52
  }
53
53
  },
54
54
  chef_server: {
55
55
  endpoints: {
56
56
  metadata: '/metadata-server',
57
- package_list: '/full_server_list',
58
- platform_names: '/chef_server_platform_names'
57
+ list: '/full_server_list',
58
+ platforms: '/chef_server_platform_names'
59
59
  }
60
60
  }
61
61
  }
@@ -0,0 +1,29 @@
1
+ # Encoding: UTF-8
2
+ #
3
+ # Author:: Jonathan Hartman (<j@p4nt5.com>)
4
+ #
5
+ # Copyright (C) 2014, Jonathan Hartman
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require_relative '../endpoint'
20
+
21
+ class Omnijack
22
+ class Endpoint < Omnijack
23
+ # A class for representing an Omnitruck full list object
24
+ #
25
+ # @author Jonathan Hartman <j@p4nt5.com>
26
+ class List < Endpoint
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,189 @@
1
+ # Encoding: UTF-8
2
+ #
3
+ # Author:: Jonathan Hartman (<j@p4nt5.com>)
4
+ #
5
+ # Copyright (C) 2014, Jonathan Hartman
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'open-uri'
20
+ require_relative '../config'
21
+ require_relative '../endpoint'
22
+
23
+ class Omnijack
24
+ class Endpoint < Omnijack
25
+ # A class for representing an Omnitruck metadata object
26
+ #
27
+ # @author Jonathan Hartman <j@p4nt5.com>
28
+ class Metadata < Endpoint
29
+ include ::Chef::Mixin::ParamsValidate
30
+ include Config
31
+
32
+ def initialize(name, args)
33
+ super
34
+ [:platform, :platform_version, :machine_arch].each do |i|
35
+ send(i, args[i])
36
+ args.delete(i)
37
+ end
38
+ args.each { |k, v| send(k, v) unless v.nil? } unless args.nil?
39
+ to_h
40
+ end
41
+
42
+ #
43
+ # Set up an accessor method for each piece of metadata
44
+ #
45
+ METADATA_ATTRIBUTES.each do |a|
46
+ define_method(a) { to_h[a] }
47
+ end
48
+ define_method(:filename) { to_h[:filename] }
49
+ define_method(:build) { to_h[:build] }
50
+
51
+ #
52
+ # Offer a hash representation of the metadata
53
+ #
54
+ # @return [Hash]
55
+ #
56
+ def to_h
57
+ raw_data.split("\n").each_with_object({}) do |line, hsh|
58
+ key = line.split[0].to_sym
59
+ val = line.split[1]
60
+ val = true if val == 'true'
61
+ val = false if val == 'false'
62
+ hsh[key] = val
63
+ key == :url && hsh.merge!(parse_url_data(val)) && \
64
+ version(hsh[:version])
65
+ end
66
+ end
67
+
68
+ #
69
+ # The version of the project
70
+ #
71
+ # @param [String, NilClass] arg
72
+ # @return [String]
73
+ #
74
+ def version(arg = nil)
75
+ set_or_return(:version, arg, kind_of: String, default: 'latest')
76
+ end
77
+
78
+ #
79
+ # Whether to enable prerelease and/or nightly packages
80
+ #
81
+ # @param [TrueClass, FalseClass, NilClass] arg
82
+ # @return [TrueClass, FalseClass]
83
+ #
84
+ [:prerelease, :nightlies].each do |m|
85
+ define_method(m) do |arg = nil|
86
+ set_or_return(m,
87
+ arg,
88
+ kind_of: [TrueClass, FalseClass],
89
+ default: false)
90
+ end
91
+ end
92
+
93
+ #
94
+ # The name of the desired platform
95
+ #
96
+ # @param [String, NilClass]
97
+ # @return [String]
98
+ #
99
+ def platform(arg = nil)
100
+ set_or_return(:platform, arg, kind_of: String, required: true)
101
+ end
102
+
103
+ #
104
+ # The version of the desired platform
105
+ #
106
+ # @param [String, NilClass] arg
107
+ # @return [String]
108
+ #
109
+ def platform_version(arg = nil)
110
+ !arg.nil? && arg = case platform
111
+ when 'mac_os_x' then platform_version_mac_os_x(arg)
112
+ when 'windows' then platform_version_windows(arg)
113
+ else arg
114
+ end
115
+ set_or_return(:platform_version, arg, kind_of: String, required: true)
116
+ end
117
+
118
+ #
119
+ # The machine architecture of the desired platform
120
+ #
121
+ # @param [String, NilClass]
122
+ # @return [String]
123
+ #
124
+ def machine_arch(arg = nil)
125
+ set_or_return(:machine_arch, arg, kind_of: String, required: true)
126
+ end
127
+
128
+ private
129
+
130
+ #
131
+ # Construct the full API query URL from base + endpoint + params
132
+ #
133
+ # @return [URI::HTTP, URI::HTTPS]
134
+ #
135
+ def api_url
136
+ @api_url ||= URI.parse("#{super}?#{URI.encode_www_form(query_params)}")
137
+ end
138
+
139
+ #
140
+ # Convert all the metadata attrs into params Omnitruck understands
141
+ #
142
+ # @return [Hash]
143
+ #
144
+ def query_params
145
+ { v: version, prerelease: prerelease, nightlies: nightlies,
146
+ p: platform, pv: platform_version, m: machine_arch }
147
+ end
148
+
149
+ #
150
+ # Apply special logic for the version of an OS X platform
151
+ #
152
+ # @param [String] arg
153
+ # @return [String]
154
+ #
155
+ def platform_version_mac_os_x(arg)
156
+ arg.match(/^[0-9]+\.[0-9]+/).to_s
157
+ end
158
+
159
+ #
160
+ # Apply special logic for the version of a Windows platform
161
+ #
162
+ # @param [String] arg
163
+ # @return [String]
164
+ #
165
+ def platform_version_windows(arg)
166
+ # Make a best guess and assume a server OS
167
+ # See: http://msdn.microsoft.com/en-us/library/windows/
168
+ # desktop/ms724832(v=vs.85).aspx
169
+ {
170
+ '6.3' => '2012r2', '6.2' => '2012', '6.1' => '2008r2',
171
+ '6.0' => '2008', '5.2' => '2003r2', '5.1' => 'xp', '5.0' => '2000'
172
+ }[arg.match(/^[0-9]+\.[0-9]+/).to_s]
173
+ end
174
+
175
+ #
176
+ # Extract a filename, package version, and build from a package URL
177
+ #
178
+ # @param [String] url
179
+ # @return [[String] filename, [String] version, [String] build]
180
+ #
181
+ def parse_url_data(url)
182
+ filename = URI.decode(url).split('/')[-1]
183
+ { filename: filename,
184
+ version: filename.split('-')[-2].split('_')[-1],
185
+ build: filename.split('-')[-1].split('.')[0].split('_')[0] }
186
+ end
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,29 @@
1
+ # Encoding: UTF-8
2
+ #
3
+ # Author:: Jonathan Hartman (<j@p4nt5.com>)
4
+ #
5
+ # Copyright (C) 2014, Jonathan Hartman
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require_relative '../endpoint'
20
+
21
+ class Omnijack
22
+ class Endpoint < Omnijack
23
+ # A class for representing an Omnitruck list of platform names
24
+ #
25
+ # @author Jonathan Hartman <j@p4nt5.com>
26
+ class Platforms < Endpoint
27
+ end
28
+ end
29
+ end
@@ -16,22 +16,32 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require 'json'
19
+ require 'multi_json'
20
20
  require 'open-uri'
21
- require_relative 'config'
21
+ unless Module.const_defined?(:Chef)
22
+ require_relative '../../vendor/chef/lib/chef/exceptions'
23
+ require_relative '../../vendor/chef/lib/chef/mixin/params_validate'
24
+ end
22
25
  require_relative '../omnijack'
26
+ require_relative 'endpoint/list'
27
+ require_relative 'endpoint/metadata'
28
+ require_relative 'endpoint/platforms'
23
29
 
24
30
  class Omnijack
25
- # A class for representing an Omnitruck list of platform names
31
+ # A parent class for Omnijack API endpoints
26
32
  #
27
33
  # @author Jonathan Hartman <j@p4nt5.com>
28
- class Platforms < Omnijack
34
+ class Endpoint < Omnijack
35
+ include ::Chef::Mixin::ParamsValidate
29
36
  include Config
30
37
 
31
- # TODO: Lots of duplicate code in platforms and list
38
+ def initialize(name, args = {})
39
+ super
40
+ base_url(args[:base_url])
41
+ end
32
42
 
33
43
  #
34
- # Make list items accessible via methods
44
+ # Make class items accessible via methods
35
45
  #
36
46
  # @param [Symbol] method_id
37
47
  #
@@ -40,9 +50,9 @@ class Omnijack
40
50
  end
41
51
 
42
52
  #
43
- # Make list items accessible via hash keys
53
+ # Make class items accessible via hash keys
44
54
  #
45
- # @param [Symbol] key
55
+ # @param[Symbol] key
46
56
  # @return [String, NilClass]
47
57
  #
48
58
  def [](key)
@@ -50,13 +60,13 @@ class Omnijack
50
60
  end
51
61
 
52
62
  #
53
- # Offer a hash representation of the list
63
+ # Offer a hash representation of the object
54
64
  #
55
65
  # @return [Hash]
56
66
  #
57
67
  def to_h
58
68
  # TODO: Use a Mash -- some keys are better off addressed as strings
59
- JSON.parse(raw_data, symbolize_names: true)
69
+ MultiJson.load(raw_data, symbolize_names: true)
60
70
  end
61
71
 
62
72
  #
@@ -64,10 +74,21 @@ class Omnijack
64
74
  #
65
75
  define_method(:to_s) { raw_data }
66
76
 
77
+ #
78
+ # The base URL of the Omnitruck API
79
+ #
80
+ # @param [String, NilClass] arg
81
+ # @return [String]
82
+ #
83
+ def base_url(arg = nil)
84
+ # TODO: Better URL validation
85
+ set_or_return(:base_url, arg, kind_of: String, default: DEFAULT_BASE_URL)
86
+ end
87
+
67
88
  private
68
89
 
69
90
  #
70
- # Fetch the raw list from the configured URI
91
+ # Fetch the raw data from the configured URI
71
92
  #
72
93
  # @return [String]
73
94
  #
@@ -90,7 +111,8 @@ class Omnijack
90
111
  # @return [String]
91
112
  #
92
113
  def endpoint
93
- OMNITRUCK_PROJECTS[name][:endpoints][:platform_names]
114
+ cl = self.class.to_s.split(':')[-1].downcase.to_sym
115
+ OMNITRUCK_PROJECTS[name][:endpoints][cl]
94
116
  end
95
117
  end
96
118
  end
@@ -18,9 +18,7 @@
18
18
 
19
19
  require_relative '../omnijack'
20
20
  require_relative 'config'
21
- require_relative 'list'
22
- require_relative 'metadata'
23
- require_relative 'platforms'
21
+ require_relative 'endpoint'
24
22
  require_relative 'project/metaprojects'
25
23
 
26
24
  class Omnijack
@@ -37,7 +35,7 @@ class Omnijack
37
35
  #
38
36
  def metadata
39
37
  # TODO: This requires too much knowledge of the Metadata class
40
- @metadata ||= Metadata.new(name, args)
38
+ @metadata ||= Endpoint::Metadata.new(name, args)
41
39
  end
42
40
 
43
41
  #
@@ -46,7 +44,7 @@ class Omnijack
46
44
  # @return [Omnijack::List]
47
45
  #
48
46
  def list
49
- @list ||= List.new(name, args)
47
+ @list ||= Endpoint::List.new(name, args)
50
48
  end
51
49
 
52
50
  #
@@ -55,7 +53,7 @@ class Omnijack
55
53
  # @return [Omnijack::Platforms]
56
54
  #
57
55
  def platforms
58
- @platforms ||= Platforms.new(name, args)
56
+ @platforms ||= Endpoint::Platforms.new(name, args)
59
57
  end
60
58
  end
61
59
  end
@@ -20,5 +20,5 @@
20
20
  #
21
21
  # @author Jonathan Hartman <j@p4nt5.com>
22
22
  class Omnijack
23
- VERSION = '0.2.0'
23
+ VERSION = '1.0.0.rc.1'
24
24
  end
data/lib/omnijack.rb CHANGED
@@ -16,41 +16,19 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- unless Module.const_defined?(:Chef)
20
- require_relative '../vendor/chef/lib/chef/exceptions'
21
- require_relative '../vendor/chef/lib/chef/mixin/params_validate'
22
- end
19
+ require 'open-uri'
23
20
  require_relative 'omnijack/config'
21
+ require_relative 'omnijack/endpoint'
24
22
  require_relative 'omnijack/project'
25
- require_relative 'omnijack/list'
26
- require_relative 'omnijack/metadata'
27
- require_relative 'omnijack/platforms'
28
23
  require_relative 'omnijack/version'
29
24
 
30
25
  # Provide a base class with some commons everyone can inherit
31
26
  #
32
27
  # @author Jonathan Hartman <j@p4nt5.com>
33
28
  class Omnijack
34
- include ::Chef::Mixin::ParamsValidate
35
- include Config
36
-
37
29
  def initialize(name, args = {})
38
30
  @name = name.to_sym
39
31
  @args = args
40
- base_url(args[:base_url]) if args && args[:base_url]
41
32
  end
42
33
  attr_reader :name, :args
43
-
44
- #
45
- # The base URL of the Omnitruck API
46
- #
47
- # @param [String, NilClass] arg
48
- # @return [String]
49
- #
50
- def base_url(arg = nil)
51
- # TODO: Better URL validation
52
- set_or_return(:base_url, arg, kind_of: String, default: DEFAULT_BASE_URL)
53
- end
54
-
55
- # TODO: Every class' `endpoint` method is similar enough they could go here
56
34
  end
data/omnijack.gemspec CHANGED
@@ -21,8 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = '>= 1.9.3'
23
23
 
24
- spec.add_dependency 'ohai'
25
- spec.add_dependency 'json'
24
+ spec.add_dependency 'multi_json'
26
25
 
27
26
  spec.add_development_dependency 'bundler'
28
27
  spec.add_development_dependency 'rake'
@@ -41,7 +41,7 @@ describe Omnijack::Config do
41
41
 
42
42
  # Some endpoints aren't available on Chef's public Omnitruck API
43
43
  if [:angry_chef, :chef_dk, :chef_container].include?(project) && \
44
- [:package_list, :platform_names].include?(name)
44
+ [:list, :platforms].include?(name)
45
45
  expected = 301
46
46
  else
47
47
  expected = 200
@@ -0,0 +1,33 @@
1
+ # Encoding: UTF-8
2
+ #
3
+ # Author:: Jonathan Hartman (<j@p4nt5.com>)
4
+ #
5
+ # Copyright (C) 2014, Jonathan Hartman
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require_relative '../../spec_helper'
20
+ require_relative '../../../lib/omnijack/endpoint/list'
21
+
22
+ describe Omnijack::Endpoint::List do
23
+ let(:name) { :chef_dk }
24
+ let(:obj) { described_class.new(name) }
25
+
26
+ describe '#endpoint' do
27
+ let(:name) { :chef_container }
28
+
29
+ it 'returns the appropriate metadata endpoint' do
30
+ expect(obj.send(:endpoint)).to eq('/full_container_list')
31
+ end
32
+ end
33
+ end