chefspec 5.1.0 → 5.1.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: d376f934381569e658a7e85c9c1194edd9404612
4
- data.tar.gz: 2f539a603a1c25fa4981330aff25e8a243290ac9
3
+ metadata.gz: ee4f05ff2e8da02d4e67edcd08e3cb308bf275f0
4
+ data.tar.gz: 8261a3465db6774d5b5d3c5b114e3517811f4047
5
5
  SHA512:
6
- metadata.gz: f4541689bccdcd86dc55065b75cfcfb81dd8559fa5964333d368928555749377f41657d686dc552bfb85546066083fb8d0f633f973fb924804a98ac2b9a91b2f
7
- data.tar.gz: bfbbecf040eec535c4e648411a1628f66ddd0b26399a13bd3dcc7e7831501f333a154353427067403ba6e6603d0bcea8c385452210087163399c65a57e266cd8
6
+ metadata.gz: 019fc9c25a49e7e890446119b3aed4856699be9d78138dcafadee05a85703037f884d078a9f3b00d60ce64683e48f23423f7fb4eecdd9236fce2b918e16a1aba
7
+ data.tar.gz: 98c4a810505d55a203c59b055ec3e81883abe8925e0d98a87d3df4be326d1ce4b6ce340fe76832a6d063945e1a3b985674fe8f57aafce77c0baf2ea985394362
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG for ChefSpec
2
2
 
3
+ ## 5.1.1 (September 14, 2016)
4
+
5
+ BUG FIXES
6
+
7
+ - Add missing matchers for yum_repository
8
+
3
9
  ## 5.1.0 (September 14, 2016)
4
10
 
5
11
  IMPROVEMENTS
@@ -0,0 +1,8 @@
1
+ # :add is the legacy action from yum cookbook < 3.0
2
+ # :create should be used instead, but both are valid
3
+ # so we'll support both here (for now)
4
+
5
+ yum_repository 'explicit_add_action' do
6
+ baseurl 'some_url'
7
+ action :add
8
+ end
@@ -0,0 +1,3 @@
1
+ yum_repository 'explicit_delete_action' do
2
+ action :delete
3
+ end
@@ -1,3 +1,7 @@
1
+ # :remove is the legacy action from yum cookbook < 3.0
2
+ # :delete should be used instead, but both are valid
3
+ # so we'll support both here (for now)
4
+
1
5
  yum_repository 'explicit_remove_action' do
2
6
  action :remove
3
7
  end
@@ -0,0 +1,12 @@
1
+ require 'chefspec'
2
+
3
+ describe 'yum_repository::add' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'centos', version: '7.2.1511')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'creates a yum_repository with add action' do
10
+ expect(chef_run).to add_yum_repository('explicit_add_action')
11
+ end
12
+ end
@@ -11,7 +11,7 @@ describe 'yum_repository::create' do
11
11
  expect(chef_run).to_not create_yum_repository('not_default_action')
12
12
  end
13
13
 
14
- it 'creates a yum_repository with an explicit action' do
14
+ it 'creates a yum_repository with create action' do
15
15
  expect(chef_run).to create_yum_repository('explicit_action')
16
16
  end
17
17
  end
@@ -0,0 +1,12 @@
1
+ require 'chefspec'
2
+
3
+ describe 'yum_repository::delete' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'centos', version: '7.2.1511')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'removes a yum_repository with delete action' do
10
+ expect(chef_run).to delete_yum_repository('explicit_delete_action')
11
+ end
12
+ end
@@ -6,7 +6,7 @@ describe 'yum_repository::remove' do
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
9
- it 'removes a yum_repository with default action' do
9
+ it 'removes a yum_repository with remove action' do
10
10
  expect(chef_run).to remove_yum_repository('explicit_remove_action')
11
11
  end
12
12
  end
@@ -23,5 +23,7 @@ Feature: The yum_repository matcher
23
23
  Examples:
24
24
  | Matcher |
25
25
  | create |
26
+ | delete |
27
+ | add |
26
28
  | remove |
27
29
  | make_cache |
@@ -5,7 +5,7 @@ module ChefSpec::API
5
5
 
6
6
  #
7
7
  # Assert that a +yum_repository+ resource exists in the Chef run with the
8
- # action +:create+. Given a Chef Recipe that adds "epel" as an
8
+ # action +:create+. Given a Chef Recipe that creates "epel" as an
9
9
  # +yum_repository+:
10
10
  #
11
11
  # yum_repository 'epel' do
@@ -29,6 +29,56 @@ module ChefSpec::API
29
29
  resource_name)
30
30
  end
31
31
 
32
+ #
33
+ # Assert that a +yum_repository+ resource exists in the Chef run with the
34
+ # action +:add+. Given a Chef Recipe that adds "epel" as an
35
+ # +yum_repository+:
36
+ #
37
+ # yum_repository 'epel' do
38
+ # baseurl "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node['platform_version'].to_i}&arch=$basearch"
39
+ # description 'Extra Packages for $releasever - $basearch'
40
+ # action :add
41
+ # end
42
+ #
43
+ # The Examples section demonstrates the different ways to test an
44
+ # +yum_repository+ resource with ChefSpec.
45
+ #
46
+ # @example Assert that an +yum_repository+ was added
47
+ # expect(chef_run).to add_yum_repository('epel')
48
+ # @param [String, Regex] resource_name
49
+ # the name of the resource to match
50
+ #
51
+ # @return [ChefSpec::Matchers::ResourceMatcher]
52
+
53
+ def add_yum_repository(resource_name)
54
+ ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :add,
55
+ resource_name)
56
+ end
57
+
58
+ #
59
+ # Assert that a +yum_repository+ resource exists in the Chef run with the
60
+ # action +:delete+. Given a Chef Recipe that deletes "epel" as an
61
+ # +yum_repository+:
62
+ #
63
+ # yum_repository 'epel' do
64
+ # action :delete
65
+ # end
66
+ #
67
+ # The Examples section demonstrates the different ways to test an
68
+ # +yum_repository+ resource with ChefSpec.
69
+ #
70
+ # @example Assert that an +yum_repository+ was deleted
71
+ # expect(chef_run).to delete_yum_repository('epel')
72
+ # @param [String, Regex] resource_name
73
+ # the name of the resource to match
74
+ #
75
+ # @return [ChefSpec::Matchers::ResourceMatcher]
76
+
77
+ def delete_yum_repository(resource_name)
78
+ ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :delete,
79
+ resource_name)
80
+ end
81
+
32
82
  #
33
83
  # Assert that a +yum_repository+ resource exists in the Chef run with the
34
84
  # action +:remove+. Given a Chef Recipe that removes "epel" as an
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '5.1.0'
2
+ VERSION = '5.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chefspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-14 00:00:00.000000000 Z
12
+ date: 2016-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -578,10 +578,14 @@ files:
578
578
  - examples/yum_package/spec/purge_spec.rb
579
579
  - examples/yum_package/spec/remove_spec.rb
580
580
  - examples/yum_package/spec/upgrade_spec.rb
581
+ - examples/yum_repository/recipes/add.rb
581
582
  - examples/yum_repository/recipes/create.rb
583
+ - examples/yum_repository/recipes/delete.rb
582
584
  - examples/yum_repository/recipes/make_cache.rb
583
585
  - examples/yum_repository/recipes/remove.rb
586
+ - examples/yum_repository/spec/add_spec.rb
584
587
  - examples/yum_repository/spec/create_spec.rb
588
+ - examples/yum_repository/spec/delete_spec.rb
585
589
  - examples/yum_repository/spec/make_cache_spec.rb
586
590
  - examples/yum_repository/spec/remove_spec.rb
587
591
  - features/apt_package.feature