minitest-chef-handler 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b5d77eb9a1bf756e56fb2a9ef5b49811874ac061
4
+ data.tar.gz: f5093d6ad1bc07dd50676b3ff48e09377de90cb7
5
+ SHA512:
6
+ metadata.gz: d54cbf57e4306dec76b7932b547551c5dd7ec84c5b07429b73ba54251125d4e26295df14ef64cd0593344f89468b251e4db6a2b02f6641e76588e3b094a0f4d2
7
+ data.tar.gz: bfd208f8e79d59cc7ec1d9f729e77ecf0c8ec0d5551907f1eccdf20b473cef67a6df2dba18557851d85860eb088c67821040db082f76c1ccb7ac40c70b111d81
@@ -1,4 +1,2 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.3
4
- - 2.0
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
- gem "vagrant", ">= 1.1", :git => "git://github.com/mitchellh/vagrant.git", :ref => "11ad0392758b6b3f4b8a44332c66a79e94cef1eb" # current master has some network issues ...
3
+ gem "vagrant", :github => "mitchellh/vagrant", :tag => "v1.3.3"
@@ -1,3 +1,8 @@
1
+ === 1.0.2 / 01-02-2014
2
+ * 1 bug fix:
3
+
4
+ * Fix assert_directory returns nil instead of owner/group of the directory
5
+
1
6
  === 1.0.1 / 04-24-2013
2
7
 
3
8
  * 1 bug fix:
data/README.md CHANGED
@@ -135,7 +135,7 @@ report_handlers << handler
135
135
  ## Automatic tests detection
136
136
 
137
137
  MiniTest-chef-hander collects test paths based in the recipes ran.
138
- It loads the tests based in the name of the cookbook and the name of the recipe.
138
+ It loads the tests based on the name of the cookbook and the name of the recipe.
139
139
  The tests must be under the cookbooks directory.
140
140
 
141
141
  Examples:
@@ -7,15 +7,31 @@ unless ARGV[0] == "destroy"
7
7
  package = result[%r{pkg/.*}].sub(/\.$/,"")
8
8
  end
9
9
 
10
- Vagrant::Config.run do |config|
11
- config.vm.box = "precise64"
12
- config.vm.provision :shell, :inline => "gem install /vagrant/#{package} --no-rdoc --no-ri"
13
- config.vm.provision :chef_solo do |chef|
10
+ Vagrant.configure("2") do |config|
11
+ config.vm.box = "opscode-precise64"
12
+ config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box"
13
+
14
+ # Install required dependencies on the empty VM:
15
+ # - rubygems from apt repostitory
16
+ # - Chef 11 with Omnibus installer
17
+ # - freshly built minitest-chef-handler gem
18
+ config.vm.provision :shell, :inline => <<EOS
19
+ set -e
20
+ if ! command -V chef-solo >/dev/null 2>/dev/null; then
21
+ sudo apt-get update -qq
22
+ sudo apt-get install -qq curl rubygems
23
+ curl -L https://www.opscode.com/chef/install.sh | bash -s -- -v 11.6.0
24
+ fi
25
+ gem install /vagrant/#{package} --no-rdoc --no-ri
26
+ EOS
27
+
28
+ config.vm.provision :chef_solo do |chef|
14
29
  #chef.log_level = :debug
15
- #chef.json = {"minitest" => {"verbose" => true}}
30
+ chef.json = {"minitest" => {"verbose" => false}}
16
31
  chef.run_list = [
17
32
  "recipe[spec_examples]",
18
33
  "minitest-handler",
19
34
  ]
20
35
  end
36
+
21
37
  end
@@ -101,7 +101,7 @@ describe_recipe 'spec_examples::default' do
101
101
  it "symlinks the foo in" do
102
102
  link("/tmp/foo-symbolic").must_exist.with(
103
103
  :link_type, :symbolic).and(:to, "/tmp/foo")
104
- assert_symlinked_file "/tmp/foo-symbolic", "root", "root", 0600
104
+ assert_symlinked_file "/tmp/foo-symbolic", "root", "root", 0644
105
105
  end
106
106
  end
107
107
 
@@ -138,13 +138,14 @@ describe_recipe 'spec_examples::default' do
138
138
  describe "services" do
139
139
  # You can assert that a service must be running following the converge:
140
140
  it "runs as a daemon" do
141
- service("ntp").must_be_running
141
+ service("ssh").must_be_running
142
142
  end
143
143
 
144
144
  # And that it will start when the server boots:
145
- it "boots on startup" do
146
- service("ntp").must_be_enabled
147
- end
145
+ # Pending FIXME: Chef::Provider::Service::Upstart is not supported by default
146
+ it "boots on startup" #do
147
+ # service("ssh").must_be_enabled
148
+ #end
148
149
  end
149
150
 
150
151
  describe "users and groups" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "vagrant", ">= 1.1", :git=>"git://github.com/mitchellh/vagrant.git", :ref=>"11ad0392758b6b3f4b8a44332c66a79e94cef1eb"
5
+ gem "vagrant", :github=>"mitchellh/vagrant", :tag=>"v1.3.3"
6
6
  gem "chef", "~> 10.0"
7
7
 
8
8
  gemspec :path=>"../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "vagrant", ">= 1.1", :git=>"git://github.com/mitchellh/vagrant.git", :ref=>"11ad0392758b6b3f4b8a44332c66a79e94cef1eb"
5
+ gem "vagrant", :github=>"mitchellh/vagrant", :tag=>"v1.3.3"
6
6
  gem "chef", "~> 11.0"
7
7
 
8
8
  gemspec :path=>"../"
@@ -1,3 +1,5 @@
1
+ require 'set'
2
+
1
3
  module MiniTest
2
4
  module Chef
3
5
  module Assertions
@@ -33,14 +35,16 @@ module MiniTest
33
35
  end
34
36
 
35
37
  def assert_group_includes(members, group)
36
- members = [members] unless members.respond_to?(:&)
37
- assert group.members & members == members, "Expected group '#{group.name}' to include members: #{members.join(', ')}"
38
+ members = Set.new(Array(members))
39
+ assert Set.new(group.members) & members == members,
40
+ "Expected group '#{group.name}' to include members: #{members.to_a.join(', ')}"
38
41
  group
39
42
  end
40
43
 
41
44
  def refute_group_includes(members, group)
42
- members = [members] unless members.respond_to?(:&)
43
- refute group.members & members == members, "Expected group '#{group.name}' not to include members: #{members.join(', ')}"
45
+ members = Set.new(Array(members))
46
+ refute Set.new(group.members) & members == members,
47
+ "Expected group '#{group.name}' not to include members: #{members.to_a.join(', ')}"
44
48
  group
45
49
  end
46
50
 
@@ -125,20 +129,27 @@ module MiniTest
125
129
  end
126
130
 
127
131
  def assert_directory(dir, *args)
128
- assert File.directory?(dir), "Expected #{dir} is be a directory"
132
+ assert File.directory?(dir), "Expected #{dir} to be a directory"
129
133
  assert_acl(dir, *args)
130
134
  end
131
135
 
132
136
  def assert_file(file, *args)
133
- assert File.file?(file), "Expected #{file} is be a file"
137
+ assert File.file?(file), "Expected #{file} to be a file"
134
138
  assert_acl(file, *args)
135
139
  end
136
140
 
137
141
  def assert_acl(file, owner, group, mode)
138
- file(file).
139
- must_have(:owner, owner).
140
- must_have(:group, group).
141
- must_have(:mode, mode)
142
+ unless File.directory?(file)
143
+ file(file).
144
+ must_have(:owner, owner).
145
+ must_have(:group, group).
146
+ must_have(:mode, mode)
147
+ else
148
+ directory(file).
149
+ must_have(:owner, owner).
150
+ must_have(:group, group).
151
+ must_have(:mode, mode)
152
+ end
142
153
  end
143
154
 
144
155
  def assert_symlinked_file(file, *args)
@@ -165,6 +176,12 @@ module MiniTest
165
176
  out
166
177
  end
167
178
 
179
+ def refute_sh(command, text=nil)
180
+ text ||= "Expected #{command} not to succeed"
181
+ out = `#{command} 2>&1`
182
+ assert !$?.success?, "#{text}, but succeeded with: #{out}"
183
+ out
184
+ end
168
185
  end
169
186
  end
170
187
  end
@@ -11,16 +11,16 @@ Gem::Specification.new do |gem|
11
11
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
12
  gem.name = "minitest-chef-handler"
13
13
  gem.require_paths = ["lib"]
14
- gem.version = '1.0.1'
14
+ gem.version = '1.0.2'
15
15
 
16
16
  gem.add_dependency('minitest', '~> 4.7.3')
17
- gem.add_dependency('chef')
17
+ gem.add_dependency('chef', '>= 10.12.0')
18
18
  gem.add_dependency('ci_reporter')
19
19
  gem.add_development_dependency "rake"
20
20
  gem.add_development_dependency "mocha"
21
21
  gem.add_development_dependency "appraisal"
22
22
  gem.add_development_dependency "ffi", ">= 1"
23
- gem.add_development_dependency "vagrant", ">= 1.1"
24
- gem.add_development_dependency "berkshelf", ">= 1.3.1"
25
- gem.add_development_dependency "berkshelf-vagrant"
23
+ gem.add_development_dependency "vagrant", "~> 1.3"
24
+ gem.add_development_dependency "berkshelf", "~> 2.0"
25
+ gem.add_development_dependency "vagrant-berkshelf", "~> 1.3"
26
26
  end
@@ -187,6 +187,22 @@ describe MiniTest::Chef::Assertions do
187
187
  end
188
188
  end
189
189
 
190
+ it "ignores order when asserting group membership" do
191
+ group = resource_for({:name => 'foo', :members => ['bar', 'baz']})
192
+ assert_group_includes(['bar', 'baz'], group).must_equal group
193
+ assert_group_includes(['baz', 'bar'], group).must_equal group
194
+ end
195
+
196
+ it "ignores order when refuting group membership" do
197
+ group = resource_for({:name => 'foo', :members => ['bar', 'baz']})
198
+ assert_triggered "Expected group 'foo' not to include members: bar, baz" do
199
+ refute_group_includes(['bar', 'baz'], group).must_equal group
200
+ end
201
+ assert_triggered "Expected group 'foo' not to include members: baz, bar" do
202
+ refute_group_includes(['baz', 'bar'], group).must_equal group
203
+ end
204
+ end
205
+
190
206
  it "verifies that a file includes the specified content" do
191
207
  file = resource_for({:path => '/etc/bar'})
192
208
  assert_includes_content(file, 'Chef').must_equal file
@@ -347,7 +363,7 @@ describe MiniTest::Chef::Assertions do
347
363
  end
348
364
 
349
365
  it "verifies that it is a directory" do
350
- assert_triggered "Expected /etc/foo is be a directory" do
366
+ assert_triggered "Expected /etc/foo to be a directory" do
351
367
  assert_directory("/etc/foo", "foo", "bar", 0755)
352
368
  end
353
369
  end
@@ -365,7 +381,7 @@ describe MiniTest::Chef::Assertions do
365
381
  end
366
382
 
367
383
  it "verifies that it is a file" do
368
- assert_triggered "Expected /etc is be a file" do
384
+ assert_triggered "Expected /etc to be a file" do
369
385
  assert_file("/etc", "foo", "bar", 0755)
370
386
  end
371
387
  end
@@ -444,4 +460,16 @@ describe MiniTest::Chef::Assertions do
444
460
  end
445
461
  end
446
462
  end
463
+
464
+ describe "#refute_sh" do
465
+ it "succeeds when the command fails" do
466
+ refute_sh("false")
467
+ end
468
+
469
+ it "fails when the command succeeds" do
470
+ assert_triggered "Expected true not to succeed, but succeeded with: ABC" do
471
+ refute_sh("echo ABC && true")
472
+ end
473
+ end
474
+ end
447
475
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-chef-handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Calavera
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-25 00:00:00.000000000 Z
11
+ date: 2014-01-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: minitest
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,147 +27,129 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: chef
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
33
+ version: 10.12.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: '0'
40
+ version: 10.12.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: ci_reporter
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: mocha
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: appraisal
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: ffi
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '1'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '1'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: vagrant
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - ~>
132
116
  - !ruby/object:Gem::Version
133
- version: '1.1'
117
+ version: '1.3'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - ~>
140
123
  - !ruby/object:Gem::Version
141
- version: '1.1'
124
+ version: '1.3'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: berkshelf
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - ~>
148
130
  - !ruby/object:Gem::Version
149
- version: 1.3.1
131
+ version: '2.0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - ~>
156
137
  - !ruby/object:Gem::Version
157
- version: 1.3.1
138
+ version: '2.0'
158
139
  - !ruby/object:Gem::Dependency
159
- name: berkshelf-vagrant
140
+ name: vagrant-berkshelf
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - ~>
164
144
  - !ruby/object:Gem::Version
165
- version: '0'
145
+ version: '1.3'
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - ~>
172
151
  - !ruby/object:Gem::Version
173
- version: '0'
152
+ version: '1.3'
174
153
  description: Run minitest suites after your Chef recipes to check the status of your
175
154
  system.
176
155
  email:
@@ -216,27 +195,26 @@ files:
216
195
  - spec/spec_helper.rb
217
196
  homepage: ''
218
197
  licenses: []
198
+ metadata: {}
219
199
  post_install_message:
220
200
  rdoc_options: []
221
201
  require_paths:
222
202
  - lib
223
203
  required_ruby_version: !ruby/object:Gem::Requirement
224
- none: false
225
204
  requirements:
226
- - - ! '>='
205
+ - - '>='
227
206
  - !ruby/object:Gem::Version
228
207
  version: '0'
229
208
  required_rubygems_version: !ruby/object:Gem::Requirement
230
- none: false
231
209
  requirements:
232
- - - ! '>='
210
+ - - '>='
233
211
  - !ruby/object:Gem::Version
234
212
  version: '0'
235
213
  requirements: []
236
214
  rubyforge_project:
237
- rubygems_version: 1.8.23
215
+ rubygems_version: 2.0.3
238
216
  signing_key:
239
- specification_version: 3
217
+ specification_version: 4
240
218
  summary: Run Minitest suites as Chef report handlers
241
219
  test_files:
242
220
  - spec/minitest-chef-handler/assertions_spec.rb