minimart 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +21 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +13 -0
  5. data/Gemfile +3 -0
  6. data/README.md +198 -0
  7. data/Rakefile +45 -0
  8. data/bin/minimart +4 -0
  9. data/lib/minimart.rb +15 -0
  10. data/lib/minimart/cli.rb +93 -0
  11. data/lib/minimart/commands/mirror.rb +30 -0
  12. data/lib/minimart/commands/web.rb +91 -0
  13. data/lib/minimart/configuration.rb +46 -0
  14. data/lib/minimart/cookbook.rb +173 -0
  15. data/lib/minimart/download/cookbook.rb +70 -0
  16. data/lib/minimart/download/git_cache.rb +60 -0
  17. data/lib/minimart/download/git_repository.rb +41 -0
  18. data/lib/minimart/error.rb +32 -0
  19. data/lib/minimart/inventory_requirement/base_requirement.rb +81 -0
  20. data/lib/minimart/inventory_requirement/git_requirement.rb +87 -0
  21. data/lib/minimart/inventory_requirement/git_requirements_builder.rb +101 -0
  22. data/lib/minimart/inventory_requirement/local_path_requirement.rb +45 -0
  23. data/lib/minimart/inventory_requirement/local_requirements_builder.rb +31 -0
  24. data/lib/minimart/inventory_requirement/supermarket_requirements_builder.rb +35 -0
  25. data/lib/minimart/mirror.rb +12 -0
  26. data/lib/minimart/mirror/dependency_graph.rb +73 -0
  27. data/lib/minimart/mirror/download_metadata.rb +57 -0
  28. data/lib/minimart/mirror/inventory_builder.rb +143 -0
  29. data/lib/minimart/mirror/inventory_configuration.rb +74 -0
  30. data/lib/minimart/mirror/inventory_requirements.rb +104 -0
  31. data/lib/minimart/mirror/local_store.rb +107 -0
  32. data/lib/minimart/mirror/source.rb +57 -0
  33. data/lib/minimart/mirror/source_cookbook.rb +77 -0
  34. data/lib/minimart/mirror/sources.rb +37 -0
  35. data/lib/minimart/output.rb +34 -0
  36. data/lib/minimart/utils/archive.rb +39 -0
  37. data/lib/minimart/utils/file_helper.rb +34 -0
  38. data/lib/minimart/utils/http.rb +60 -0
  39. data/lib/minimart/version.rb +3 -0
  40. data/lib/minimart/web.rb +10 -0
  41. data/lib/minimart/web/cookbook_show_page_generator.rb +78 -0
  42. data/lib/minimart/web/cookbooks.rb +83 -0
  43. data/lib/minimart/web/dashboard_generator.rb +46 -0
  44. data/lib/minimart/web/html_generator.rb +52 -0
  45. data/lib/minimart/web/markdown_parser.rb +47 -0
  46. data/lib/minimart/web/template_helper.rb +132 -0
  47. data/lib/minimart/web/universe_generator.rb +109 -0
  48. data/minimart.gemspec +36 -0
  49. data/spec/fixtures/sample_cookbook.tar.gz +0 -0
  50. data/spec/fixtures/sample_cookbook/Berksfile +3 -0
  51. data/spec/fixtures/sample_cookbook/CHANGELOG.md +3 -0
  52. data/spec/fixtures/sample_cookbook/Gemfile +16 -0
  53. data/spec/fixtures/sample_cookbook/LICENSE +3 -0
  54. data/spec/fixtures/sample_cookbook/README.md +42 -0
  55. data/spec/fixtures/sample_cookbook/Thorfile +5 -0
  56. data/spec/fixtures/sample_cookbook/Vagrantfile +90 -0
  57. data/spec/fixtures/sample_cookbook/chefignore +94 -0
  58. data/spec/fixtures/sample_cookbook/metadata.rb +9 -0
  59. data/spec/fixtures/sample_cookbook/recipes/default.rb +8 -0
  60. data/spec/fixtures/sample_inventory.yml +16 -0
  61. data/spec/fixtures/simple_git_inventory.yml +8 -0
  62. data/spec/fixtures/simple_inventory.yml +6 -0
  63. data/spec/fixtures/simple_local_path_inventory.yml +5 -0
  64. data/spec/fixtures/universe.json +42 -0
  65. data/spec/fixtures/vcr_cassettes/local_path_cookbooks.yml +3316 -0
  66. data/spec/fixtures/vcr_cassettes/location_specific_cookbooks.yml +3316 -0
  67. data/spec/fixtures/vcr_cassettes/supermarket_cookbooks_graph.yml +905 -0
  68. data/spec/fixtures/vcr_cassettes/supermarket_cookbooks_installing_cookbooks.yml +4218 -0
  69. data/spec/lib/minimart/cli_spec.rb +104 -0
  70. data/spec/lib/minimart/commands/mirror_spec.rb +37 -0
  71. data/spec/lib/minimart/commands/web_spec.rb +75 -0
  72. data/spec/lib/minimart/configuration_spec.rb +54 -0
  73. data/spec/lib/minimart/cookbook_spec.rb +137 -0
  74. data/spec/lib/minimart/download/cookbook_spec.rb +135 -0
  75. data/spec/lib/minimart/download/git_cache_spec.rb +69 -0
  76. data/spec/lib/minimart/download/git_repository_spec.rb +39 -0
  77. data/spec/lib/minimart/error_spec.rb +18 -0
  78. data/spec/lib/minimart/inventory_requirement/base_requirement_spec.rb +38 -0
  79. data/spec/lib/minimart/inventory_requirement/git_requirement_spec.rb +92 -0
  80. data/spec/lib/minimart/inventory_requirement/git_requirements_builder_spec.rb +130 -0
  81. data/spec/lib/minimart/inventory_requirement/local_path_requirement_spec.rb +35 -0
  82. data/spec/lib/minimart/inventory_requirement/local_requirements_builder_spec.rb +33 -0
  83. data/spec/lib/minimart/inventory_requirement/supermarket_requirements_builder_spec.rb +69 -0
  84. data/spec/lib/minimart/mirror/dependency_graph_spec.rb +123 -0
  85. data/spec/lib/minimart/mirror/download_metadata_spec.rb +73 -0
  86. data/spec/lib/minimart/mirror/inventory_builder_spec.rb +195 -0
  87. data/spec/lib/minimart/mirror/inventory_configuration_spec.rb +86 -0
  88. data/spec/lib/minimart/mirror/inventory_requirements_spec.rb +78 -0
  89. data/spec/lib/minimart/mirror/local_store_spec.rb +64 -0
  90. data/spec/lib/minimart/mirror/source_spec.rb +54 -0
  91. data/spec/lib/minimart/mirror/sources_spec.rb +50 -0
  92. data/spec/lib/minimart/output_spec.rb +29 -0
  93. data/spec/lib/minimart/utils/archive_spec.rb +38 -0
  94. data/spec/lib/minimart/utils/file_helper_spec.rb +43 -0
  95. data/spec/lib/minimart/utils/http_spec.rb +37 -0
  96. data/spec/lib/minimart/web/cookbook_show_page_generator_spec.rb +101 -0
  97. data/spec/lib/minimart/web/cookbooks_spec.rb +70 -0
  98. data/spec/lib/minimart/web/dashboard_generator_spec.rb +33 -0
  99. data/spec/lib/minimart/web/html_generator_spec.rb +34 -0
  100. data/spec/lib/minimart/web/markdown_parser_spec.rb +54 -0
  101. data/spec/lib/minimart/web/template_helper_spec.rb +86 -0
  102. data/spec/lib/minimart/web/universe_generator_spec.rb +125 -0
  103. data/spec/spec_helper.rb +35 -0
  104. data/spec/support/file_system.rb +22 -0
  105. data/web/_assets/javascripts/app.js +164 -0
  106. data/web/_assets/javascripts/backbone.min.js +6 -0
  107. data/web/_assets/javascripts/jquery.min.js +4 -0
  108. data/web/_assets/javascripts/jquery.tabslet.min.js +9 -0
  109. data/web/_assets/javascripts/manifest.js +5 -0
  110. data/web/_assets/javascripts/underscore.min.js +5 -0
  111. data/web/_assets/stylesheets/font-awesome.min.css +4 -0
  112. data/web/_assets/stylesheets/font-mfizz.css +318 -0
  113. data/web/_assets/stylesheets/main.css +720 -0
  114. data/web/_assets/stylesheets/manifest.css +4 -0
  115. data/web/_assets/stylesheets/normalize.css +427 -0
  116. data/web/assets/fonts/FontAwesome.otf +0 -0
  117. data/web/assets/fonts/font-mfizz.eot +0 -0
  118. data/web/assets/fonts/font-mfizz.svg +1344 -0
  119. data/web/assets/fonts/font-mfizz.ttf +0 -0
  120. data/web/assets/fonts/font-mfizz.woff +0 -0
  121. data/web/assets/fonts/fontawesome-webfont.eot +0 -0
  122. data/web/assets/fonts/fontawesome-webfont.svg +520 -0
  123. data/web/assets/fonts/fontawesome-webfont.ttf +0 -0
  124. data/web/assets/fonts/fontawesome-webfont.woff +0 -0
  125. data/web/assets/images/header-slim.jpg +0 -0
  126. data/web/assets/images/icon-search.png +0 -0
  127. data/web/assets/images/mad-glory-logo.png +0 -0
  128. data/web/assets/images/main-gradient.png +0 -0
  129. data/web/assets/images/top-bar-logo.png +0 -0
  130. data/web/assets/javascripts/application.min.js +5 -0
  131. data/web/assets/stylesheets/application.min.css +4 -0
  132. data/web/templates/cookbook_show.erb +96 -0
  133. data/web/templates/dashboard.erb +81 -0
  134. data/web/templates/layout.erb +38 -0
  135. metadata +433 -0
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe Minimart::Download::GitCache do
4
+
5
+ describe '#get_repository' do
6
+ let(:stubbed_repo) { double('git_repository') }
7
+
8
+ before(:each) do
9
+ allow(Git).to receive(:clone).and_return(stubbed_repo)
10
+ end
11
+
12
+ it 'should return the repo' do
13
+ expect(subject.get_repository('git-url')).to eq stubbed_repo
14
+ end
15
+
16
+ it 'should download a bare version of the git repo' do
17
+ expect(Git).to receive(:clone).with('git-url', instance_of(String), bare: true)
18
+ subject.get_repository('git-url')
19
+ end
20
+
21
+ context 'when the repo has already been downloaded' do
22
+ before(:each) do
23
+ subject.get_repository('git-url')
24
+ end
25
+
26
+ it 'should return the repo' do
27
+ expect(subject.get_repository('git-url')).to eq stubbed_repo
28
+ end
29
+
30
+ it 'should not download the repo a second time' do
31
+ expect(Git).to_not receive(:clone)
32
+ subject.get_repository('git-url')
33
+ end
34
+ end
35
+ end
36
+
37
+ describe '#local_path_for' do
38
+ let(:stubbed_repo) { double('git_repository', repo: double('repo', path: '/path')) }
39
+
40
+ before(:each) do
41
+ allow(subject).to receive(:get_repository).and_return stubbed_repo
42
+ end
43
+
44
+ it 'should return the path' do
45
+ expect(subject.local_path_for('repo')).to eq '/path'
46
+ end
47
+ end
48
+
49
+ describe '#clear' do
50
+ let(:path) { Dir.mktmpdir }
51
+ let(:repo) { double('base', repo: double('repo', 'path' => path)) }
52
+
53
+ before(:each) do
54
+ allow(Git).to receive(:clone).and_return(repo)
55
+ subject.get_repository('git-url')
56
+ end
57
+
58
+ it 'should remove empty the cache' do
59
+ subject.clear
60
+ expect(subject.has_location?('git-url')).to eq false
61
+ end
62
+
63
+ it 'should actually remove any tmp directories' do
64
+ subject.clear
65
+ expect(Dir.exists?(path)).to eq false
66
+ end
67
+ end
68
+
69
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe Minimart::Download::GitRepository do
4
+
5
+ let(:location) { 'http://github.com' }
6
+
7
+ subject do
8
+ Minimart::Download::GitRepository.new(location)
9
+ end
10
+
11
+ describe '#fetch' do
12
+ let(:repo) do
13
+ instance_double('Git::Base',
14
+ fetch: true,
15
+ reset_hard: true,
16
+ revparse: 'master')
17
+ end
18
+
19
+ let(:path) { '/git_path' }
20
+
21
+ before(:each) do
22
+ allow_any_instance_of(Minimart::Download::GitCache).to receive(:get_repository).with(location).and_return repo
23
+ allow_any_instance_of(Minimart::Download::GitCache).to receive(:local_path_for).with(location).and_return path
24
+ allow(Git).to receive(:clone).with(path, an_instance_of(String)).and_return repo
25
+ end
26
+
27
+ it 'should clone the repo' do
28
+ expect(repo).to receive(:reset_hard).with('master')
29
+ subject.fetch('master')
30
+ end
31
+
32
+ it 'should yield the directory the repo was cloned to' do
33
+ expect { |b|
34
+ subject.fetch('master', &b)
35
+ }.to yield_with_args(an_instance_of(String))
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Minimart::Error do
4
+ describe '::handle_exception' do
5
+ let(:ex) { StandardError.new('test error msg') }
6
+
7
+ it 'should print the error' do
8
+ begin; subject.handle_exception(ex); rescue SystemExit; end
9
+ expect(Minimart::Configuration.output.io.string).to include 'test error msg'
10
+ end
11
+
12
+ it 'should exit with a failure status code' do
13
+ expect {
14
+ subject.handle_exception(ex)
15
+ }.to raise_error SystemExit
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Minimart::InventoryRequirement::BaseRequirement do
4
+
5
+ subject do
6
+ Minimart::InventoryRequirement::BaseRequirement.new(
7
+ 'mysql',
8
+ version_requirement: '> 1.0.0')
9
+ end
10
+
11
+ describe '::new' do
12
+ it 'should set the name' do
13
+ expect(subject.name).to eq 'mysql'
14
+ end
15
+
16
+ it 'should set the version requirement' do
17
+ expect(subject.version_requirement).to eq '> 1.0.0'
18
+ end
19
+ end
20
+
21
+ describe '#explicit_location?' do
22
+ it 'should return false' do
23
+ expect(subject.explicit_location?).to eq false
24
+ end
25
+ end
26
+
27
+ describe '#requirements' do
28
+ it 'should return the proper requirements' do
29
+ expect(subject.requirements).to eq 'mysql' => '> 1.0.0'
30
+ end
31
+ end
32
+
33
+ describe '#matching_source?' do
34
+ it 'should default to true' do
35
+ expect(subject.matching_source?({})).to eq true
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,92 @@
1
+ require 'spec_helper'
2
+ require 'minimart/inventory_requirement/base_requirement'
3
+ require 'minimart/inventory_requirement/git_requirement'
4
+
5
+ describe Minimart::InventoryRequirement::GitRequirement do
6
+
7
+ let(:requirement) do
8
+ Minimart::InventoryRequirement::GitRequirement.new(
9
+ 'sample_cookbook',
10
+ branch: 'new-feature-branch')
11
+ end
12
+
13
+ before(:each) do
14
+ allow_any_instance_of(Minimart::Download::GitRepository).to receive(:fetch).
15
+ with('new-feature-branch').
16
+ and_yield('spec/fixtures/sample_cookbook')
17
+ end
18
+
19
+ describe '::new' do
20
+ it 'should set the name' do
21
+ expect(requirement.name).to eq 'sample_cookbook'
22
+ end
23
+
24
+ context 'when a branch is provided' do
25
+ it 'should set the branch' do
26
+ expect(requirement.branch).to eq 'new-feature-branch'
27
+ end
28
+ end
29
+
30
+ context 'when a ref is provided' do
31
+ it 'should set the sha' do
32
+ cookbook = Minimart::InventoryRequirement::GitRequirement.new('sample_cookbook', ref: 'SHA')
33
+ expect(cookbook.ref).to eq 'SHA'
34
+ end
35
+ end
36
+
37
+ context 'when a tag is provided' do
38
+ it 'should set the tag' do
39
+ cookbook = Minimart::InventoryRequirement::GitRequirement.new('sample_cookbook', tag: 'v1.0.0')
40
+ expect(cookbook.tag).to eq 'v1.0.0'
41
+ end
42
+ end
43
+ end
44
+
45
+ describe '#explicit_location?' do
46
+ subject { requirement.explicit_location? }
47
+ it { is_expected.to eq true }
48
+ end
49
+
50
+ describe '#requirements' do
51
+ before(:each) { requirement.fetch_cookbook }
52
+ subject { requirement.requirements }
53
+ it { is_expected.to eq('yum' => '> 3.0.0') }
54
+ end
55
+
56
+ describe '#matching_source?' do
57
+ let(:metadata) do
58
+ { 'source_type' => 'git', 'commitish_type' => 'branch', 'commitish' => 'new-feature-branch'}
59
+ end
60
+
61
+ subject { requirement.matching_source?(metadata) }
62
+
63
+ it { is_expected.to eq true }
64
+
65
+ describe 'when the source type is not matching' do
66
+ before(:each) { metadata['source_type'] = 'local_path' }
67
+
68
+ it { is_expected.to eq false }
69
+ end
70
+
71
+ describe 'when the commitish type is not matching' do
72
+ before(:each) { metadata['commitish_type'] = 'tag' }
73
+
74
+ it { is_expected.to eq false }
75
+ end
76
+
77
+ describe 'when the commitish is not matching' do
78
+ before(:each) { metadata['commitish'] = 'another-branch' }
79
+
80
+ it { is_expected.to eq false }
81
+
82
+ context 'when the commitish type is a ref' do
83
+ before(:each) do
84
+ allow(requirement).to receive('commitish_type').and_return 'ref'
85
+ metadata['commitish_type'] = 'ref'
86
+ end
87
+
88
+ it { is_expected.to eq true }
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,130 @@
1
+ require 'spec_helper'
2
+
3
+ describe Minimart::InventoryRequirement::GitRequirementsBuilder do
4
+
5
+ let(:raw_requirements) do
6
+ {
7
+ 'git' => {
8
+ 'location' => 'https://github.com/mysql',
9
+ 'branches' => %w[branch-one branch-two],
10
+ 'tags' => %w[tag-one tag-two],
11
+ 'refs' => %w[ref-one ref-two],
12
+ }
13
+ }
14
+ end
15
+
16
+ subject do
17
+ Minimart::InventoryRequirement::GitRequirementsBuilder.new('mysql', raw_requirements)
18
+ end
19
+
20
+ describe '::new' do
21
+ context 'when a location is not provided' do
22
+ before(:each) { raw_requirements['git'].delete('location') }
23
+
24
+ it 'should raise an exception' do
25
+ expect {
26
+ subject
27
+ }.to raise_error Minimart::Error::InvalidInventoryError,
28
+ %{'mysql' specifies Git requirements, but does not have a location.}
29
+ end
30
+ end
31
+
32
+ context 'when no commitish is specified' do
33
+ let(:raw_requirements) do
34
+ { 'git' => {'location' => '/'} }
35
+ end
36
+
37
+ it 'should raise an exception' do
38
+ expect {
39
+ subject
40
+ }.to raise_error Minimart::Error::InvalidInventoryError,
41
+ %{'mysql' specified Git requirements, but does not provide a branch|tag|ref}
42
+ end
43
+ end
44
+ end
45
+
46
+ describe '#build' do
47
+ it 'should build a requirement for each branch' do
48
+ raw_requirements['git']['branches'].each do |branch|
49
+ expect(subject.build.any? { |r| r.branch == branch }).to eq true
50
+ end
51
+ end
52
+
53
+ it 'should build a requirement for each tag' do
54
+ raw_requirements['git']['tags'].each do |tag|
55
+ expect(subject.build.any? { |r| r.tag == tag }).to eq true
56
+ end
57
+ end
58
+
59
+ it 'should build a requirement for each ref' do
60
+ raw_requirements['git']['refs'].each do |ref|
61
+ expect(subject.build.any? { |r| r.ref == ref }).to eq true
62
+ end
63
+ end
64
+
65
+ it 'should pass the location' do
66
+ expect(subject.build.all? { |r| r.location == 'https://github.com/mysql' }).to eq true
67
+ end
68
+
69
+ context 'when branches is passed a string' do
70
+ before(:each) { raw_requirements['git'] = { 'location' => '/', 'branches' => 'master' } }
71
+
72
+ it 'should still build the proper requirement' do
73
+ expect(subject.build.first.branch).to eq 'master'
74
+ end
75
+ end
76
+
77
+ context 'when the string "branch" is used as the key' do
78
+ before(:each) { raw_requirements['git'] = { 'location' => '/', 'branch' => 'master' } }
79
+
80
+ it 'should still build the proper requirement' do
81
+ expect(subject.build.first.branch).to eq 'master'
82
+ end
83
+ end
84
+
85
+ context 'when tags is passed a string' do
86
+ before(:each) do
87
+ raw_requirements['git'] = { 'location' => '/', 'tags' => 'v0.0.0' }
88
+ end
89
+
90
+ it 'should still build the proper requirement' do
91
+ expect(subject.build.first.tag).to eq 'v0.0.0'
92
+ end
93
+ end
94
+
95
+ context 'when the string "tag" is used as the key' do
96
+ before(:each) { raw_requirements['git'] = { 'location' => '/', 'tag' => 'v0.0.0' } }
97
+
98
+ it 'should still build the proper requirement' do
99
+ expect(subject.build.first.tag).to eq 'v0.0.0'
100
+ end
101
+ end
102
+
103
+ context 'when refs is passed a string' do
104
+ before(:each) { raw_requirements['git'] = { 'location' => '/', 'refs' => 'SHA' } }
105
+
106
+ it 'should still build the proper requirement' do
107
+ expect(subject.build.first.ref).to eq 'SHA'
108
+ end
109
+ end
110
+
111
+ context 'when the string "ref" is used as the key' do
112
+ before(:each) { raw_requirements['git'] = { 'location' => '/', 'ref' => 'SHA' } }
113
+
114
+ it 'should still build the proper requirement' do
115
+ expect(subject.build.first.ref).to eq 'SHA'
116
+ end
117
+ end
118
+
119
+ context 'when there are no git requirements' do
120
+ subject do
121
+ Minimart::InventoryRequirement::GitRequirementsBuilder.new('mysql', {})
122
+ end
123
+
124
+ it 'should return an empty array' do
125
+ expect(subject.build.empty?).to eq true
126
+ end
127
+ end
128
+ end
129
+
130
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Minimart::InventoryRequirement::LocalPathRequirement do
4
+
5
+ let(:requirement) do
6
+ Minimart::InventoryRequirement::LocalPathRequirement.new('sample_cookbook',
7
+ path: 'spec/fixtures/sample_cookbook')
8
+ end
9
+
10
+ describe '::new' do
11
+ it 'should set the name' do
12
+ expect(requirement.name).to eq 'sample_cookbook'
13
+ end
14
+
15
+ it 'should set the path' do
16
+ expect(requirement.path).to eq 'spec/fixtures/sample_cookbook'
17
+ end
18
+ end
19
+
20
+ describe '#explicit_location?' do
21
+ subject { requirement.explicit_location? }
22
+ it { is_expected.to eq true }
23
+ end
24
+
25
+ describe '#matching_source?' do
26
+ let(:metadata) { { 'source_type' => 'local_path' } }
27
+ subject { requirement.matching_source?(metadata) }
28
+ it { is_expected.to eq true }
29
+
30
+ context 'when the source type is not local path' do
31
+ before(:each) { metadata['source_type'] = 'git' }
32
+ it { is_expected.to eq false }
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe Minimart::InventoryRequirement::LocalRequirementsBuilder do
4
+
5
+ describe '#build' do
6
+ subject do
7
+ Minimart::InventoryRequirement::LocalRequirementsBuilder.new('mysql', 'path' => '/my/local/path')
8
+ end
9
+
10
+ it 'should return a single requirement' do
11
+ expect(subject.build.size).to eq 1
12
+ end
13
+
14
+ it 'should give the requirement the proper name' do
15
+ expect(subject.build.first.name).to eq 'mysql'
16
+ end
17
+
18
+ it 'should give the requirement the proper path' do
19
+ expect(subject.build.first.path).to eq '/my/local/path'
20
+ end
21
+
22
+ context 'when no path is provided' do
23
+ subject do
24
+ Minimart::InventoryRequirement::LocalRequirementsBuilder.new('mysql', {})
25
+ end
26
+
27
+ it 'should return empty' do
28
+ expect(subject.build).to be_empty
29
+ end
30
+ end
31
+ end
32
+
33
+ end