teststrap 1.2.5 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/teststrap +1 -1
- data/generator_files/Gemfile +10 -11
- data/generator_files/README.md +1 -1
- data/generator_files/spec/default_spec.rb +1 -1
- data/generator_files/test/integration/default/serverspec/{localhost/default_spec.rb → default_spec.rb} +0 -0
- data/generator_files/test/integration/default/serverspec/spec_helper.rb +2 -7
- data/lib/teststrap.rb +18 -20
- data/spec/teststrap_spec.rb +23 -18
- metadata +3 -4
- data/generator_files/Thorfile +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e8a20742384ec36822bdcc0548065605149b145
|
4
|
+
data.tar.gz: b6c0a8868e7d162c2bc0ca93b91ab9d708349202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 656da0912ff38bae52f26f6d6192380a14c5620e2a2355cc9acaaabcc2946392c5d8584c4d39507d1af98eead62c09e16d9e6ee7e679c525cfe3672046ba3e5c
|
7
|
+
data.tar.gz: ddf0cd635ec71b7cd507581713cbb257bb81af30d70b450fad9c3ba62fbebb31911c28b86892cd2489bbd50041773bcb73f10efb6eea8b94a6a27f2787285448
|
data/bin/teststrap
CHANGED
data/generator_files/Gemfile
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'json'
|
4
|
-
gem 'berkshelf'
|
5
|
-
gem 'thor-foodcritic', '~> 1.1'
|
3
|
+
gem 'json'
|
4
|
+
gem 'berkshelf'
|
6
5
|
|
7
|
-
gem 'rubocop'
|
8
|
-
gem 'strainer'
|
9
|
-
gem 'foodcritic'
|
6
|
+
gem 'rubocop'
|
7
|
+
gem 'strainer'
|
8
|
+
gem 'foodcritic'
|
10
9
|
|
11
|
-
gem 'chef'
|
12
|
-
gem 'chefspec'
|
10
|
+
gem 'chef'
|
11
|
+
gem 'chefspec'
|
13
12
|
|
14
13
|
group :integration do
|
15
|
-
gem 'test-kitchen'
|
16
|
-
gem 'kitchen-vagrant'
|
17
|
-
gem 'serverspec'
|
14
|
+
gem 'test-kitchen'
|
15
|
+
gem 'kitchen-vagrant'
|
16
|
+
gem 'serverspec'
|
18
17
|
end
|
19
18
|
|
20
19
|
group :test do
|
data/generator_files/README.md
CHANGED
File without changes
|
data/lib/teststrap.rb
CHANGED
@@ -9,28 +9,26 @@ module Teststrap
|
|
9
9
|
|
10
10
|
default_task :generate_tests
|
11
11
|
|
12
|
-
desc
|
12
|
+
desc "generate_tests", "generate test files"
|
13
13
|
def generate_tests
|
14
14
|
@cookbook_name = current_directory_name
|
15
|
-
puts
|
16
|
-
copy_file
|
17
|
-
copy_file
|
18
|
-
copy_file
|
19
|
-
copy_file
|
20
|
-
copy_file
|
21
|
-
copy_file
|
22
|
-
copy_file
|
23
|
-
copy_file
|
24
|
-
|
25
|
-
template
|
26
|
-
template
|
27
|
-
template
|
28
|
-
|
29
|
-
template
|
30
|
-
|
31
|
-
|
32
|
-
template 'metadata.rb'
|
33
|
-
template 'README.md'
|
15
|
+
puts "generating testfiles::"
|
16
|
+
copy_file ".gitignore"
|
17
|
+
copy_file ".rubocop.yml"
|
18
|
+
copy_file "Berksfile"
|
19
|
+
copy_file "chefignore"
|
20
|
+
copy_file "Gemfile"
|
21
|
+
copy_file "LICENSE"
|
22
|
+
copy_file "rubocop-disabled.yml"
|
23
|
+
copy_file "Strainerfile"
|
24
|
+
template "spec/default_spec.rb"
|
25
|
+
template "spec/chefspec_helper.rb"
|
26
|
+
template "test/integration/default/serverspec/default_spec.rb"
|
27
|
+
template "test/integration/default/serverspec/spec_helper.rb"
|
28
|
+
template ".kitchen.yml"
|
29
|
+
template "metadata.rb"
|
30
|
+
template "README.md"
|
31
|
+
remove_file "Thorfile"
|
34
32
|
end
|
35
33
|
|
36
34
|
no_commands do
|
data/spec/teststrap_spec.rb
CHANGED
@@ -3,52 +3,57 @@ require 'spec_helper'
|
|
3
3
|
describe Teststrap::Teststrap do
|
4
4
|
let(:teststrap) { described_class.new }
|
5
5
|
|
6
|
-
describe
|
7
|
-
FILES = ['Gemfile',
|
6
|
+
describe "generate_tests" do
|
7
|
+
FILES = [ 'Gemfile',
|
8
|
+
'Berksfile',
|
9
|
+
'Strainerfile',
|
10
|
+
'.gitignore',
|
11
|
+
'LICENSE']
|
8
12
|
TEMPLATES = [
|
9
13
|
'README.md',
|
10
14
|
'metadata.rb',
|
11
15
|
'.kitchen.yml',
|
12
16
|
'spec/default_spec.rb',
|
13
|
-
'test/integration/default/serverspec/
|
17
|
+
'test/integration/default/serverspec/default_spec.rb',
|
14
18
|
'test/integration/default/serverspec/spec_helper.rb'
|
15
19
|
]
|
16
20
|
|
17
21
|
before do
|
18
|
-
teststrap.
|
19
|
-
teststrap.
|
20
|
-
teststrap.
|
22
|
+
allow(teststrap).to receive(:copy_file)
|
23
|
+
allow(teststrap).to receive(:template)
|
24
|
+
allow(teststrap).to receive(:current_directory_name)
|
21
25
|
.and_return('test_cookbook')
|
22
26
|
end
|
23
27
|
|
24
|
-
it
|
25
|
-
|
28
|
+
it "should generate files" do
|
26
29
|
FILES.each do |file|
|
27
|
-
teststrap.
|
30
|
+
expect(teststrap).to receive(:copy_file).with(file)
|
28
31
|
end
|
29
|
-
|
30
32
|
teststrap.generate_tests
|
31
33
|
end
|
32
34
|
|
33
|
-
it
|
34
|
-
|
35
|
+
it "should generate templates" do
|
35
36
|
TEMPLATES.each do |template|
|
36
|
-
teststrap.
|
37
|
+
expect(teststrap).to receive(:template).with(template)
|
37
38
|
end
|
39
|
+
teststrap.generate_tests
|
40
|
+
end
|
38
41
|
|
42
|
+
it 'removes the thorfile' do
|
43
|
+
expect(teststrap).to receive(:remove_file).with('Thorfile')
|
39
44
|
teststrap.generate_tests
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
43
|
-
describe
|
44
|
-
it
|
45
|
-
Dir.
|
48
|
+
describe "current_directory_name" do
|
49
|
+
it "return current working directory name" do
|
50
|
+
allow(Dir).to receive(:pwd).and_return('test/dir/test_cookbook')
|
46
51
|
expect(teststrap.current_directory_name).to eq 'test_cookbook'
|
47
52
|
end
|
48
53
|
end
|
49
54
|
|
50
|
-
describe
|
51
|
-
it
|
55
|
+
describe "source_root" do
|
56
|
+
it "return generator file path" do
|
52
57
|
expect(described_class.source_root)
|
53
58
|
.to include 'teststrap/generator_files'
|
54
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teststrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Casecommons
|
@@ -68,13 +68,12 @@ files:
|
|
68
68
|
- generator_files/LICENSE
|
69
69
|
- generator_files/README.md
|
70
70
|
- generator_files/Strainerfile
|
71
|
-
- generator_files/Thorfile
|
72
71
|
- generator_files/chefignore
|
73
72
|
- generator_files/metadata.rb
|
74
73
|
- generator_files/rubocop-disabled.yml
|
75
74
|
- generator_files/spec/chefspec_helper.rb
|
76
75
|
- generator_files/spec/default_spec.rb
|
77
|
-
- generator_files/test/integration/default/serverspec/
|
76
|
+
- generator_files/test/integration/default/serverspec/default_spec.rb
|
78
77
|
- generator_files/test/integration/default/serverspec/spec_helper.rb
|
79
78
|
- lib/teststrap.rb
|
80
79
|
- spec/spec_helper.rb
|
@@ -99,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
98
|
version: '0'
|
100
99
|
requirements: []
|
101
100
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.2.
|
101
|
+
rubygems_version: 2.2.2
|
103
102
|
signing_key:
|
104
103
|
specification_version: 4
|
105
104
|
summary: cookbook test framework generator
|
data/generator_files/Thorfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'bundler'
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'thor/foodcritic'
|
6
|
-
require 'berkshelf/thor'
|
7
|
-
|
8
|
-
begin
|
9
|
-
require 'kitchen/thor_tasks'
|
10
|
-
Kitchen::ThorTasks.new
|
11
|
-
rescue LoadError
|
12
|
-
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
|
13
|
-
end
|