berkshelf 5.5.0 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -3
  3. data/Gemfile +31 -31
  4. data/Gemfile.lock +3 -3
  5. data/Guardfile +13 -13
  6. data/Rakefile +1 -0
  7. data/Thorfile +16 -16
  8. data/berkshelf.gemspec +35 -35
  9. data/features/step_definitions/chef/config_steps.rb +4 -4
  10. data/features/step_definitions/chef_server_steps.rb +6 -6
  11. data/features/step_definitions/cli_steps.rb +3 -3
  12. data/features/step_definitions/config_steps.rb +5 -5
  13. data/features/step_definitions/filesystem_steps.rb +12 -11
  14. data/features/support/env.rb +21 -21
  15. data/lib/berkshelf.rb +66 -66
  16. data/lib/berkshelf/base_generator.rb +10 -11
  17. data/lib/berkshelf/berksfile.rb +38 -38
  18. data/lib/berkshelf/cached_cookbook.rb +7 -7
  19. data/lib/berkshelf/cli.rb +126 -126
  20. data/lib/berkshelf/commands/shelf.rb +19 -18
  21. data/lib/berkshelf/commands/test_command.rb +2 -2
  22. data/lib/berkshelf/community_rest.rb +38 -38
  23. data/lib/berkshelf/config.rb +42 -41
  24. data/lib/berkshelf/cookbook_generator.rb +38 -38
  25. data/lib/berkshelf/cookbook_store.rb +4 -4
  26. data/lib/berkshelf/core_ext/file_utils.rb +1 -1
  27. data/lib/berkshelf/dependency.rb +23 -21
  28. data/lib/berkshelf/downloader.rb +24 -25
  29. data/lib/berkshelf/errors.rb +17 -17
  30. data/lib/berkshelf/file_syncer.rb +9 -8
  31. data/lib/berkshelf/formatters/human.rb +3 -3
  32. data/lib/berkshelf/formatters/json.rb +2 -2
  33. data/lib/berkshelf/init_generator.rb +64 -64
  34. data/lib/berkshelf/installer.rb +103 -102
  35. data/lib/berkshelf/location.rb +9 -9
  36. data/lib/berkshelf/locations/git.rb +16 -16
  37. data/lib/berkshelf/locations/github.rb +1 -1
  38. data/lib/berkshelf/locations/path.rb +2 -2
  39. data/lib/berkshelf/lockfile.rb +309 -315
  40. data/lib/berkshelf/mixin/git.rb +3 -3
  41. data/lib/berkshelf/packager.rb +4 -4
  42. data/lib/berkshelf/resolver.rb +2 -2
  43. data/lib/berkshelf/resolver/graph.rb +1 -1
  44. data/lib/berkshelf/shell.rb +1 -1
  45. data/lib/berkshelf/source.rb +6 -6
  46. data/lib/berkshelf/source_uri.rb +2 -2
  47. data/lib/berkshelf/ssl_policies.rb +3 -3
  48. data/lib/berkshelf/thor.rb +1 -1
  49. data/lib/berkshelf/uploader.rb +48 -48
  50. data/lib/berkshelf/validator.rb +2 -2
  51. data/lib/berkshelf/version.rb +1 -1
  52. data/lib/berkshelf/visualizer.rb +11 -11
  53. data/spec/config/knife.rb +2 -2
  54. data/spec/fixtures/Berksfile +3 -3
  55. data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
  56. data/spec/fixtures/cookbook-store/jenkins-2.0.3/metadata.rb +5 -5
  57. data/spec/fixtures/cookbook-store/jenkins-2.0.4/metadata.rb +4 -4
  58. data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
  59. data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
  60. data/spec/spec_helper.rb +9 -9
  61. data/spec/support/chef_api.rb +11 -12
  62. data/spec/support/chef_server.rb +10 -10
  63. data/spec/support/git.rb +23 -23
  64. data/spec/support/kitchen.rb +2 -2
  65. data/spec/support/matchers/filepath_matchers.rb +2 -2
  66. data/spec/support/path_helpers.rb +12 -12
  67. data/spec/support/shared_examples/formatter.rb +1 -1
  68. data/spec/unit/berkshelf/berksfile_spec.rb +78 -78
  69. data/spec/unit/berkshelf/cached_cookbook_spec.rb +42 -42
  70. data/spec/unit/berkshelf/cli_spec.rb +6 -6
  71. data/spec/unit/berkshelf/community_rest_spec.rb +83 -83
  72. data/spec/unit/berkshelf/config_spec.rb +13 -13
  73. data/spec/unit/berkshelf/cookbook_generator_spec.rb +39 -39
  74. data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
  75. data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +5 -6
  76. data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
  77. data/spec/unit/berkshelf/dependency_spec.rb +43 -43
  78. data/spec/unit/berkshelf/downloader_spec.rb +20 -20
  79. data/spec/unit/berkshelf/errors_spec.rb +3 -3
  80. data/spec/unit/berkshelf/file_syncer_spec.rb +86 -86
  81. data/spec/unit/berkshelf/formatters/base_spec.rb +23 -23
  82. data/spec/unit/berkshelf/formatters/human_spec.rb +2 -2
  83. data/spec/unit/berkshelf/formatters/json_spec.rb +2 -2
  84. data/spec/unit/berkshelf/formatters/null_spec.rb +3 -3
  85. data/spec/unit/berkshelf/init_generator_spec.rb +92 -92
  86. data/spec/unit/berkshelf/installer_spec.rb +8 -8
  87. data/spec/unit/berkshelf/location_spec.rb +11 -11
  88. data/spec/unit/berkshelf/locations/base_spec.rb +35 -35
  89. data/spec/unit/berkshelf/locations/git_spec.rb +87 -87
  90. data/spec/unit/berkshelf/locations/path_spec.rb +40 -40
  91. data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
  92. data/spec/unit/berkshelf/lockfile_spec.rb +197 -197
  93. data/spec/unit/berkshelf/logger_spec.rb +3 -3
  94. data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -5
  95. data/spec/unit/berkshelf/packager_spec.rb +2 -2
  96. data/spec/unit/berkshelf/resolver/graph_spec.rb +1 -1
  97. data/spec/unit/berkshelf/resolver_spec.rb +17 -17
  98. data/spec/unit/berkshelf/shell_spec.rb +34 -34
  99. data/spec/unit/berkshelf/source_spec.rb +12 -11
  100. data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
  101. data/spec/unit/berkshelf/ssl_policies_spec.rb +25 -25
  102. data/spec/unit/berkshelf/uploader_spec.rb +54 -54
  103. data/spec/unit/berkshelf/validator_spec.rb +16 -16
  104. data/spec/unit/berkshelf/visualizer_spec.rb +17 -17
  105. data/spec/unit/berkshelf_spec.rb +18 -18
  106. metadata +5 -5
@@ -1,48 +1,48 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Berkshelf::CachedCookbook do
4
4
  describe "ClassMethods" do
5
- describe '::from_store_path' do
6
- let(:path) { fixtures_path.join('cookbooks', 'example_cookbook-0.5.0') }
5
+ describe "::from_store_path" do
6
+ let(:path) { fixtures_path.join("cookbooks", "example_cookbook-0.5.0") }
7
7
  let(:cached) { described_class.from_path(path) }
8
8
 
9
- it 'returns a CachedCookbook' do
9
+ it "returns a CachedCookbook" do
10
10
  expect(cached).to be_a(described_class)
11
11
  end
12
12
 
13
- it 'sets a version number' do
14
- expect(cached.version).to eq('0.5.0')
13
+ it "sets a version number" do
14
+ expect(cached.version).to eq("0.5.0")
15
15
  end
16
16
 
17
- it 'sets the metadata.name value to the cookbook_name' do
18
- expect(cached.metadata.name).to eq('example_cookbook')
17
+ it "sets the metadata.name value to the cookbook_name" do
18
+ expect(cached.metadata.name).to eq("example_cookbook")
19
19
  end
20
20
 
21
- context 'given a path that does not contain a cookbook' do
22
- it 'returns nil' do
21
+ context "given a path that does not contain a cookbook" do
22
+ it "returns nil" do
23
23
  expect(described_class.from_store_path(tmp_path)).to be_nil
24
24
  end
25
25
  end
26
26
 
27
- context 'given a path that does not match the CachedCookbook dirname format' do
28
- it 'returns nil' do
29
- path = fixtures_path.join('cookbooks', 'example_cookbook')
27
+ context "given a path that does not match the CachedCookbook dirname format" do
28
+ it "returns nil" do
29
+ path = fixtures_path.join("cookbooks", "example_cookbook")
30
30
  expect(described_class.from_store_path(path)).to be_nil
31
31
  end
32
32
  end
33
33
 
34
- context 'given an already cached cookbook' do
34
+ context "given an already cached cookbook" do
35
35
  let!(:cached) { described_class.from_store_path(path) }
36
36
 
37
- it 'returns the cached cookbook instance' do
37
+ it "returns the cached cookbook instance" do
38
38
  expect(described_class.from_store_path(path)).to eq(cached)
39
39
  end
40
40
  end
41
41
  end
42
42
 
43
- describe '::checksum' do
44
- it 'returns a checksum of the given filepath' do
45
- path = fixtures_path.join('cookbooks', 'example_cookbook-0.5.0', 'README.md')
43
+ describe "::checksum" do
44
+ it "returns a checksum of the given filepath" do
45
+ path = fixtures_path.join("cookbooks", "example_cookbook-0.5.0", "README.md")
46
46
  expected_md5 = if IO.binread(path).include?("\r\n")
47
47
  # On windows, with git configured for auto crlf
48
48
  "2414583f86c9eb68bdbb0be391939341"
@@ -52,48 +52,48 @@ describe Berkshelf::CachedCookbook do
52
52
  expect(described_class.checksum(path)).to eq(expected_md5)
53
53
  end
54
54
 
55
- context 'given path does not exist' do
56
- it 'raises an Errno::ENOENT error' do
57
- expect {
58
- described_class.checksum(fixtures_path.join('notexisting.file'))
59
- }.to raise_error(Errno::ENOENT)
55
+ context "given path does not exist" do
56
+ it "raises an Errno::ENOENT error" do
57
+ expect do
58
+ described_class.checksum(fixtures_path.join("notexisting.file"))
59
+ end.to raise_error(Errno::ENOENT)
60
60
  end
61
61
  end
62
62
  end
63
63
  end
64
64
 
65
- let(:dependencies) { { 'mysql' => '= 1.2.0', 'ntp' => '>= 0.0.0' } }
66
- let(:recommendations) { { 'database' => '>= 0.0.0' } }
65
+ let(:dependencies) { { "mysql" => "= 1.2.0", "ntp" => ">= 0.0.0" } }
66
+ let(:recommendations) { { "database" => ">= 0.0.0" } }
67
67
  let(:path) do
68
68
  generate_cookbook(Berkshelf.cookbook_store.storage_path,
69
- 'sparkle', '0.1.0', dependencies: dependencies, recommendations: recommendations)
69
+ "sparkle", "0.1.0", dependencies: dependencies, recommendations: recommendations)
70
70
  end
71
71
 
72
72
  subject { Berkshelf::CachedCookbook.from_store_path(path) }
73
73
 
74
- describe '#dependencies' do
75
- it 'contains depends from the cookbook metadata' do
74
+ describe "#dependencies" do
75
+ it "contains depends from the cookbook metadata" do
76
76
  expect(subject.dependencies).to include(dependencies)
77
77
  end
78
78
 
79
- it 'contains recommendations from the cookbook metadata' do
79
+ it "contains recommendations from the cookbook metadata" do
80
80
  expect(subject.dependencies).to include(recommendations)
81
81
  end
82
82
 
83
- it 'returns a hash' do
83
+ it "returns a hash" do
84
84
  expect(subject.dependencies).to be_a(Hash)
85
85
  end
86
86
  end
87
87
 
88
- describe '#pretty_hash' do
89
- shared_examples 'a pretty_hash cookbook attribute' do |attribute, key|
88
+ describe "#pretty_hash" do
89
+ shared_examples "a pretty_hash cookbook attribute" do |attribute, key|
90
90
  it "is not present when the `#{attribute}` attribute is nil" do
91
91
  allow(subject).to receive(attribute.to_sym).and_return(nil)
92
92
  expect(subject.pretty_hash).to_not have_key((key || attribute).to_sym)
93
93
  end
94
94
 
95
95
  it "is not present when the `#{attribute}` attribute is an empty string" do
96
- allow(subject).to receive(attribute.to_sym).and_return('')
96
+ allow(subject).to receive(attribute.to_sym).and_return("")
97
97
  expect(subject.pretty_hash).to_not have_key((key || attribute).to_sym)
98
98
  end
99
99
 
@@ -108,18 +108,18 @@ describe Berkshelf::CachedCookbook do
108
108
  end
109
109
 
110
110
  it "is present when the `#{attribute}` attribute has a Hash value" do
111
- allow(subject).to receive(attribute.to_sym).and_return(foo: 'bar')
111
+ allow(subject).to receive(attribute.to_sym).and_return(foo: "bar")
112
112
  expect(subject.pretty_hash).to have_key((key || attribute).to_sym)
113
113
  end
114
114
  end
115
115
 
116
- it_behaves_like 'a pretty_hash cookbook attribute', 'cookbook_name', 'name'
117
- it_behaves_like 'a pretty_hash cookbook attribute', 'version'
118
- it_behaves_like 'a pretty_hash cookbook attribute', 'description'
119
- it_behaves_like 'a pretty_hash cookbook attribute', 'maintainer', 'author'
120
- it_behaves_like 'a pretty_hash cookbook attribute', 'maintainer_email', 'email'
121
- it_behaves_like 'a pretty_hash cookbook attribute', 'license'
122
- it_behaves_like 'a pretty_hash cookbook attribute', 'platforms'
123
- it_behaves_like 'a pretty_hash cookbook attribute', 'dependencies'
116
+ it_behaves_like "a pretty_hash cookbook attribute", "cookbook_name", "name"
117
+ it_behaves_like "a pretty_hash cookbook attribute", "version"
118
+ it_behaves_like "a pretty_hash cookbook attribute", "description"
119
+ it_behaves_like "a pretty_hash cookbook attribute", "maintainer", "author"
120
+ it_behaves_like "a pretty_hash cookbook attribute", "maintainer_email", "email"
121
+ it_behaves_like "a pretty_hash cookbook attribute", "license"
122
+ it_behaves_like "a pretty_hash cookbook attribute", "platforms"
123
+ it_behaves_like "a pretty_hash cookbook attribute", "dependencies"
124
124
  end
125
125
  end
@@ -1,24 +1,24 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Berkshelf
4
4
  describe Cli do
5
5
  let(:subject) { described_class.new }
6
- let(:berksfile) { double('Berksfile') }
7
- let(:cookbooks) { ['mysql'] }
6
+ let(:berksfile) { double("Berksfile") }
7
+ let(:cookbooks) { ["mysql"] }
8
8
 
9
9
  before do
10
10
  allow(Berksfile).to receive(:from_options).and_return(berksfile)
11
11
  end
12
12
 
13
- describe '#upload' do
14
- it 'calls to upload with params if passed in cli' do
13
+ describe "#upload" do
14
+ it "calls to upload with params if passed in cli" do
15
15
  expect(berksfile).to receive(:upload).with(cookbooks,
16
16
  include(skip_syntax_check: true, freeze: false)
17
17
  )
18
18
 
19
19
  subject.options[:skip_syntax_check] = true
20
20
  subject.options[:no_freeze] = true
21
- subject.upload('mysql')
21
+ subject.upload("mysql")
22
22
  end
23
23
  end
24
24
  end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Berkshelf::CommunityREST do
4
4
  describe "ClassMethods" do
5
5
  describe "::unpack" do
6
- let(:target) { '/foo/bar' }
7
- let(:destination) { '/destination/bar' }
8
- let(:file) { double('file') }
9
- let(:gzip_reader) { double('gzip_reader') }
10
- let(:archive) { double('mixlib_archive') }
6
+ let(:target) { "/foo/bar" }
7
+ let(:destination) { "/destination/bar" }
8
+ let(:file) { double("file") }
9
+ let(:gzip_reader) { double("gzip_reader") }
10
+ let(:archive) { double("mixlib_archive") }
11
11
 
12
12
  before do
13
- allow(File).to receive(:open).with(target, 'rb').and_return(file)
13
+ allow(File).to receive(:open).with(target, "rb").and_return(file)
14
14
  allow(archive).to receive(:extract).with(destination)
15
15
  allow(Mixlib::Archive).to receive(:new).with(target).and_return(archive)
16
16
  end
17
17
 
18
- it 'unpacks the tar' do
18
+ it "unpacks the tar" do
19
19
  expect(::IO).to receive(:binread).with(target, 2).and_return([0x1F, 0x8B].pack("C*"))
20
20
  expect(Mixlib::Archive).to receive(:new).with(target).and_return(archive)
21
21
  expect(archive).to receive(:extract).with(destination)
@@ -25,38 +25,38 @@ describe Berkshelf::CommunityREST do
25
25
  end
26
26
 
27
27
  describe "::uri_escape_version" do
28
- it 'returns a string' do
28
+ it "returns a string" do
29
29
  expect(Berkshelf::CommunityREST.uri_escape_version(nil)).to be_a(String)
30
30
  end
31
31
 
32
32
  it 'converts a version to it\'s underscored version' do
33
- expect(Berkshelf::CommunityREST.uri_escape_version('1.1.2')).to eq('1_1_2')
33
+ expect(Berkshelf::CommunityREST.uri_escape_version("1.1.2")).to eq("1_1_2")
34
34
  end
35
35
 
36
- it 'works when the version has more than three points' do
37
- expect(Berkshelf::CommunityREST.uri_escape_version('1.1.1.2')).to eq('1_1_1_2')
36
+ it "works when the version has more than three points" do
37
+ expect(Berkshelf::CommunityREST.uri_escape_version("1.1.1.2")).to eq("1_1_1_2")
38
38
  end
39
39
 
40
- it 'works when the version has less than three points' do
41
- expect(Berkshelf::CommunityREST.uri_escape_version('1.2')).to eq('1_2')
40
+ it "works when the version has less than three points" do
41
+ expect(Berkshelf::CommunityREST.uri_escape_version("1.2")).to eq("1_2")
42
42
  end
43
43
  end
44
44
 
45
45
  describe "::version_from_uri" do
46
- it 'returns a string' do
46
+ it "returns a string" do
47
47
  expect(Berkshelf::CommunityREST.version_from_uri(nil)).to be_a(String)
48
48
  end
49
49
 
50
- it 'extracts the version from the URL' do
51
- expect(Berkshelf::CommunityREST.version_from_uri('/api/v1/cookbooks/nginx/versions/1_1_2')).to eq('1.1.2')
50
+ it "extracts the version from the URL" do
51
+ expect(Berkshelf::CommunityREST.version_from_uri("/api/v1/cookbooks/nginx/versions/1_1_2")).to eq("1.1.2")
52
52
  end
53
53
 
54
- it 'works when the version has more than three points' do
55
- expect(Berkshelf::CommunityREST.version_from_uri('/api/v1/cookbooks/nginx/versions/1_1_1_2')).to eq('1.1.1.2')
54
+ it "works when the version has more than three points" do
55
+ expect(Berkshelf::CommunityREST.version_from_uri("/api/v1/cookbooks/nginx/versions/1_1_1_2")).to eq("1.1.1.2")
56
56
  end
57
57
 
58
- it 'works when the version has less than three points' do
59
- expect(Berkshelf::CommunityREST.version_from_uri('/api/v1/cookbooks/nginx/versions/1_2')).to eq('1.2')
58
+ it "works when the version has less than three points" do
59
+ expect(Berkshelf::CommunityREST.version_from_uri("/api/v1/cookbooks/nginx/versions/1_2")).to eq("1.2")
60
60
  end
61
61
  end
62
62
  end
@@ -64,161 +64,161 @@ describe Berkshelf::CommunityREST do
64
64
  let(:api_uri) { Berkshelf::CommunityREST::V1_API }
65
65
  subject { Berkshelf::CommunityREST.new(api_uri) }
66
66
 
67
- describe '#initialize' do
68
- context 'Faraday handlers' do
69
- it 'includes follow_redirects to prevent 301 from community, stopping some cookbooks installing' do
67
+ describe "#initialize" do
68
+ context "Faraday handlers" do
69
+ it "includes follow_redirects to prevent 301 from community, stopping some cookbooks installing" do
70
70
  expect(subject.builder.handlers).to include(Ridley::Middleware::FollowRedirects)
71
71
  end
72
72
  end
73
73
  end
74
74
 
75
- describe '#download' do
76
- let(:archive) { double('archive', path: '/foo/bar', unlink: true) }
75
+ describe "#download" do
76
+ let(:archive) { double("archive", path: "/foo/bar", unlink: true) }
77
77
 
78
78
  before do
79
79
  allow(subject).to receive(:stream).with(any_args()).and_return(archive)
80
80
  allow(Berkshelf::CommunityREST).to receive(:unpack)
81
- .and_return('/some/path')
81
+ .and_return("/some/path")
82
82
  end
83
83
 
84
- it 'unpacks the archive' do
84
+ it "unpacks the archive" do
85
85
  stub_request(:get, "#{api_uri}/cookbooks/bacon/versions/1_0_0").to_return(
86
86
  status: 200,
87
87
  body: '{ "cookbook": "/path/to/cookbook", "version": "1.0.0" }',
88
- headers: { 'Content-Type' => 'application/json' },
88
+ headers: { "Content-Type" => "application/json" }
89
89
  )
90
90
 
91
91
  expect(Berkshelf::CommunityREST).to receive(:unpack)
92
- .with('/foo/bar', String)
93
- .and_return('/foo/nginx')
92
+ .with("/foo/bar", String)
93
+ .and_return("/foo/nginx")
94
94
  .once
95
95
  expect(archive).to receive(:unlink).once
96
96
 
97
- subject.download('bacon', '1.0.0')
97
+ subject.download("bacon", "1.0.0")
98
98
  end
99
99
  end
100
100
 
101
- describe '#find' do
102
- it 'returns the cookbook and version information' do
101
+ describe "#find" do
102
+ it "returns the cookbook and version information" do
103
103
  stub_request(:get, "#{api_uri}/cookbooks/bacon/versions/1_0_0").to_return(
104
104
  status: 200,
105
105
  body: '{ "cookbook": "/path/to/cookbook", "version": "1.0.0" }',
106
- headers: { 'Content-Type' => 'application/json' },
106
+ headers: { "Content-Type" => "application/json" }
107
107
  )
108
108
 
109
- result = subject.find('bacon', '1.0.0')
109
+ result = subject.find("bacon", "1.0.0")
110
110
 
111
- expect(result.cookbook).to eq('/path/to/cookbook')
112
- expect(result.version).to eq('1.0.0')
111
+ expect(result.cookbook).to eq("/path/to/cookbook")
112
+ expect(result.version).to eq("1.0.0")
113
113
  end
114
114
 
115
- it 'raises a CookbookNotFound error on a 404 response for a non-existent cookbook' do
115
+ it "raises a CookbookNotFound error on a 404 response for a non-existent cookbook" do
116
116
  stub_request(:get, "#{api_uri}/cookbooks/not_real/versions/1_0_0").to_return(
117
117
  status: 404,
118
- body: nil,
118
+ body: nil
119
119
  )
120
120
 
121
- expect {
122
- subject.find('not_real', '1.0.0')
123
- }.to raise_error(Berkshelf::CookbookNotFound)
121
+ expect do
122
+ subject.find("not_real", "1.0.0")
123
+ end.to raise_error(Berkshelf::CookbookNotFound)
124
124
  end
125
125
 
126
- it 'raises a CommunitySiteError error on any non 200 or 404 response' do
126
+ it "raises a CommunitySiteError error on any non 200 or 404 response" do
127
127
  stub_request(:get, "#{api_uri}/cookbooks/not_real/versions/1_0_0").to_return(
128
128
  status: 500,
129
- body: nil,
129
+ body: nil
130
130
  )
131
131
 
132
- expect {
133
- subject.find('not_real', '1.0.0')
134
- }.to raise_error(Berkshelf::CommunitySiteError)
132
+ expect do
133
+ subject.find("not_real", "1.0.0")
134
+ end.to raise_error(Berkshelf::CommunitySiteError)
135
135
  end
136
136
  end
137
137
 
138
- describe '#latest_version' do
139
- it 'returns the version number of the latest version of the cookbook' do
138
+ describe "#latest_version" do
139
+ it "returns the version number of the latest version of the cookbook" do
140
140
  stub_request(:get, "#{api_uri}/cookbooks/bacon").to_return(
141
141
  status: 200,
142
142
  body: '{ "latest_version": "1.0.0" }',
143
- headers: { 'Content-Type' => 'application/json' }
143
+ headers: { "Content-Type" => "application/json" }
144
144
  )
145
145
 
146
- latest = subject.latest_version('bacon')
147
- expect(latest).to eq('1.0.0')
146
+ latest = subject.latest_version("bacon")
147
+ expect(latest).to eq("1.0.0")
148
148
  end
149
149
 
150
- it 'raises a CookbookNotFound error on a 404 response' do
150
+ it "raises a CookbookNotFound error on a 404 response" do
151
151
  stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return(
152
152
  status: 404,
153
- body: nil,
153
+ body: nil
154
154
  )
155
155
 
156
- expect {
157
- subject.latest_version('not_real')
158
- }.to raise_error(Berkshelf::CookbookNotFound)
156
+ expect do
157
+ subject.latest_version("not_real")
158
+ end.to raise_error(Berkshelf::CookbookNotFound)
159
159
  end
160
160
 
161
- it 'raises a CommunitySiteError error on any non 200 or 404 response' do
161
+ it "raises a CommunitySiteError error on any non 200 or 404 response" do
162
162
  stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return(
163
163
  status: 500,
164
- body: nil,
164
+ body: nil
165
165
  )
166
166
 
167
- expect {
168
- subject.latest_version('not_real')
169
- }.to raise_error(Berkshelf::CommunitySiteError)
167
+ expect do
168
+ subject.latest_version("not_real")
169
+ end.to raise_error(Berkshelf::CommunitySiteError)
170
170
  end
171
171
  end
172
172
 
173
- describe '#versions' do
174
- it 'returns an array containing an item for each version' do
173
+ describe "#versions" do
174
+ it "returns an array containing an item for each version" do
175
175
  stub_request(:get, "#{api_uri}/cookbooks/bacon").to_return(
176
176
  status: 200,
177
177
  body: '{ "versions": ["/bacon/versions/1_0_0", "/bacon/versions/2_0_0"] }',
178
- headers: { 'Content-Type' => 'application/json' }
178
+ headers: { "Content-Type" => "application/json" }
179
179
  )
180
180
 
181
- versions = subject.versions('bacon')
181
+ versions = subject.versions("bacon")
182
182
  expect(versions.size).to eq(2)
183
183
  end
184
184
 
185
- it 'raises a CookbookNotFound error on a 404 response' do
185
+ it "raises a CookbookNotFound error on a 404 response" do
186
186
  stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return(
187
187
  status: 404,
188
- body: nil,
188
+ body: nil
189
189
  )
190
190
 
191
- expect {
192
- subject.versions('not_real')
193
- }.to raise_error(Berkshelf::CookbookNotFound)
191
+ expect do
192
+ subject.versions("not_real")
193
+ end.to raise_error(Berkshelf::CookbookNotFound)
194
194
  end
195
195
 
196
- it 'raises a CommunitySiteError error on any non 200 or 404 response' do
196
+ it "raises a CommunitySiteError error on any non 200 or 404 response" do
197
197
  stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return(
198
198
  status: 500,
199
- body: nil,
199
+ body: nil
200
200
  )
201
201
 
202
- expect {
203
- subject.versions('not_real')
204
- }.to raise_error(Berkshelf::CommunitySiteError)
202
+ expect do
203
+ subject.versions("not_real")
204
+ end.to raise_error(Berkshelf::CommunitySiteError)
205
205
  end
206
206
  end
207
207
 
208
- describe '#satisfy' do
209
- it 'returns the version number of the best solution' do
208
+ describe "#satisfy" do
209
+ it "returns the version number of the best solution" do
210
210
  stub_request(:get, "#{api_uri}/cookbooks/bacon").to_return(
211
211
  status: 200,
212
212
  body: '{ "versions": ["/bacon/versions/1_0_0", "/bacon/versions/2_0_0"] }',
213
- headers: { 'Content-Type' => 'application/json' }
213
+ headers: { "Content-Type" => "application/json" }
214
214
  )
215
215
 
216
- result = subject.satisfy('bacon', '= 1.0.0')
217
- expect(result).to eq('1.0.0')
216
+ result = subject.satisfy("bacon", "= 1.0.0")
217
+ expect(result).to eq("1.0.0")
218
218
  end
219
219
  end
220
220
 
221
- describe '#stream' do
221
+ describe "#stream" do
222
222
  skip
223
223
  end
224
224
  end