puppet-blacksmith 6.1.1 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,169 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Blacksmith::Modulefile' do
4
-
5
- let(:path) { "spec/data/metadata.json" }
6
-
7
- subject { Blacksmith::Modulefile.new(path) }
8
-
9
- shared_examples_for :metadata do
10
- it { expect(subject.version).to eql("1.0.0") }
11
- it { expect(subject.name).to eql("test") }
12
- end
13
-
14
- context "using different author" do
15
- let(:path) { "spec/data/metadata-different-author.json" }
16
-
17
- subject { Blacksmith::Modulefile.new(path) }
18
-
19
- it_behaves_like :metadata
20
-
21
- describe "author and namespace" do
22
- it { expect(subject.author).to eql("MaestroDev") }
23
- it { expect(subject.namespace).to eql("maestrodev") }
24
- end
25
- end
26
-
27
- context "using no author" do
28
- let(:path) { "spec/data/metadata-no-author.json" }
29
-
30
- subject { Blacksmith::Modulefile.new(path) }
31
-
32
- it_behaves_like :metadata
33
-
34
- describe "author and namespace" do
35
- it { expect(subject.author).to eql("maestrodev") }
36
- it { expect(subject.namespace).to eql("maestrodev") }
37
- end
38
- end
39
-
40
- context "using metadata.json" do
41
-
42
- it_behaves_like :metadata
43
-
44
- describe 'replace_version' do
45
- it "should replace the version in metadata" do
46
-
47
- expected = <<-eos
48
- {
49
- "operatingsystem_support": [
50
- {
51
- "operatingsystem": "CentOS",
52
- "operatingsystemrelease": [
53
- "4",
54
- "5",
55
- "6"
56
- ]
57
- }
58
- ],
59
- "requirements": [
60
- {
61
- "name": "pe",
62
- "version_requirement": "3.2.x"
63
- },
64
- {
65
- "name": "puppet",
66
- "version_requirement": ">=2.7.20 <7.0.0"
67
- }
68
- ],
69
- "name": "maestrodev-test",
70
- "version": "1.0.1",
71
- "source": "git://github.com/puppetlabs/puppetlabs-stdlib",
72
- "author": "maestrodev",
73
- "license": "Apache 2.0",
74
- "summary": "Puppet Module Standard Library",
75
- "description": "Standard Library for Puppet Modules",
76
- "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib",
77
- "dependencies": [
78
- {
79
- "name": "puppetlabs-stdlib",
80
- "version_requirement": ">= 3.0.0"
81
- }
82
- ]
83
- }
84
- eos
85
-
86
- expect(JSON.parse(subject.replace_version(File.read(path), "1.0.1"))).to eql(JSON.parse(expected))
87
- end
88
- end
89
-
90
- describe 'replace_dependency_version' do
91
- it "should replace the version in metadata" do
92
-
93
- expected = <<-eos
94
- {
95
- "operatingsystem_support": [
96
- {
97
- "operatingsystem": "CentOS",
98
- "operatingsystemrelease": [
99
- "4",
100
- "5",
101
- "6"
102
- ]
103
- }
104
- ],
105
- "requirements": [
106
- {
107
- "name": "pe",
108
- "version_requirement": "3.2.x"
109
- },
110
- {
111
- "name": "puppet",
112
- "version_requirement": ">=2.7.20 <7.0.0"
113
- }
114
- ],
115
- "name": "maestrodev-test",
116
- "version": "1.0.0",
117
- "source": "git://github.com/puppetlabs/puppetlabs-stdlib",
118
- "author": "maestrodev",
119
- "license": "Apache 2.0",
120
- "summary": "Puppet Module Standard Library",
121
- "description": "Standard Library for Puppet Modules",
122
- "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib",
123
- "dependencies": [
124
- {
125
- "name": "puppetlabs-stdlib",
126
- "version_requirement": ">= 4.0.0"
127
- }
128
- ]
129
- }
130
- eos
131
-
132
- expect(JSON.parse(subject.replace_dependency_version(File.read(path), 'puppetlabs-stdlib', '>= 4.0.0'))).to eql(JSON.parse(expected))
133
- end
134
- end
135
-
136
- end
137
-
138
- describe 'bump_to_version' do
139
- it { expect(subject.bump_to_version!("1.0.0")).to eql("1.0.0") }
140
- end
141
-
142
- describe 'increase_version' do
143
- it { expect(subject.increase_version("1.0.0")).to eql("1.0.1") }
144
- it { expect(subject.increase_version("1.0.1")).to eql("1.0.2") }
145
- it { expect { subject.increase_version("1.0") }.to raise_error(ArgumentError) }
146
- it { expect { subject.increase_version("1.0.12qwe") }.to raise_error(ArgumentError) }
147
- end
148
-
149
- describe 'bump patch version' do
150
- it { expect(subject.increase_version("1.0.0", :patch)).to eql("1.0.1") }
151
- it { expect(subject.increase_version("1.1.0", :patch)).to eql("1.1.1") }
152
- it { expect(subject.increase_version("1.1.1", :patch)).to eql("1.1.2") }
153
- it { expect(subject.increase_version("1.1.2-rc0", :patch)).to eql("1.1.2") }
154
- end
155
-
156
- describe 'bump minor version' do
157
- it { expect(subject.increase_version("1.0.0", :minor)).to eql("1.1.0") }
158
- it { expect(subject.increase_version("1.1.0", :minor)).to eql("1.2.0") }
159
- it { expect(subject.increase_version("1.1.1", :minor)).to eql("1.2.0") }
160
- it { expect(subject.increase_version("1.1.1-rc0", :minor)).to eql("1.2.0") }
161
- end
162
-
163
- describe 'bump major version' do
164
- it { expect(subject.increase_version("1.0.0", :major)).to eql("2.0.0") }
165
- it { expect(subject.increase_version("1.1.0", :major)).to eql("2.0.0") }
166
- it { expect(subject.increase_version("1.1.1", :major)).to eql("2.0.0") }
167
- it { expect(subject.increase_version("1.1.1-rc0", :major)).to eql("2.0.0") }
168
- end
169
- end
data/spec/spec_helper.rb DELETED
@@ -1,25 +0,0 @@
1
- begin
2
- require 'simplecov'
3
- require 'simplecov-console'
4
- require 'codecov'
5
- rescue LoadError
6
- else
7
- SimpleCov.start do
8
- track_files 'lib/**/*.rb'
9
-
10
- add_filter '/spec'
11
-
12
- enable_coverage :branch
13
-
14
- # do not track vendored files
15
- add_filter '/vendor'
16
- add_filter '/.vendor'
17
- end
18
-
19
- SimpleCov.formatters = [
20
- SimpleCov::Formatter::Console,
21
- SimpleCov::Formatter::Codecov,
22
- ]
23
- end
24
-
25
- require 'puppet_blacksmith'