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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa3f126204cfefd2023bcfcfb56123f46a418c3d
4
- data.tar.gz: cc755162a6a8f4214d34256996fb2613f5e4cdfc
3
+ metadata.gz: 2e8a20742384ec36822bdcc0548065605149b145
4
+ data.tar.gz: b6c0a8868e7d162c2bc0ca93b91ab9d708349202
5
5
  SHA512:
6
- metadata.gz: 23153b26e84196ccc892f20e9c19e91de6c060989a7dbf5ec3066fcc9f5db6b841c2ffcafc848b2f72b4ca98b26f683c7e6e58c9001af813588d590003df8757
7
- data.tar.gz: 3bfdde812cd6b9c25aac2eeba4ebd22fd9e0fce00aa8efcf4b3149ea505945e183e544aea1d28c32dfd9a3340d3b436049e2f2128a5267433125ec75e19734e1
6
+ metadata.gz: 656da0912ff38bae52f26f6d6192380a14c5620e2a2355cc9acaaabcc2946392c5d8584c4d39507d1af98eead62c09e16d9e6ee7e679c525cfe3672046ba3e5c
7
+ data.tar.gz: ddf0cd635ec71b7cd507581713cbb257bb81af30d70b450fad9c3ba62fbebb31911c28b86892cd2489bbd50041773bcb73f10efb6eea8b94a6a27f2787285448
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.push File.expand_path('../../lib', __FILE__)
2
+ $:.push File.expand_path('../../lib', __FILE__)
3
3
 
4
4
  require 'teststrap'
5
5
 
@@ -1,20 +1,19 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'json', '1.7.7'
4
- gem 'berkshelf', '~> 2.0'
5
- gem 'thor-foodcritic', '~> 1.1'
3
+ gem 'json'
4
+ gem 'berkshelf'
6
5
 
7
- gem 'rubocop', '~> 0.18'
8
- gem 'strainer', '~> 3.3'
9
- gem 'foodcritic', '~> 3.0'
6
+ gem 'rubocop'
7
+ gem 'strainer'
8
+ gem 'foodcritic'
10
9
 
11
- gem 'chef', '~> 11.8'
12
- gem 'chefspec', '~> 3.2'
10
+ gem 'chef'
11
+ gem 'chefspec'
13
12
 
14
13
  group :integration do
15
- gem 'test-kitchen', '~> 1.2'
16
- gem 'kitchen-vagrant', '~> 0.14'
17
- gem 'serverspec', '~> 0.15'
14
+ gem 'test-kitchen'
15
+ gem 'kitchen-vagrant'
16
+ gem 'serverspec'
18
17
  end
19
18
 
20
19
  group :test do
@@ -1,7 +1,7 @@
1
1
  # <%= cookbook_name %> cookbook
2
2
 
3
3
  # Requirements
4
- Compatable with Scientific linux 6.
4
+ Compatible with Scientific linux 6.
5
5
 
6
6
  # Usage
7
7
 
@@ -2,7 +2,7 @@ require 'chefspec_helper'
2
2
  require 'chefspec'
3
3
  require 'chefspec/berkshelf'
4
4
 
5
- describe '<%= cookbook_name %>::default' do
5
+ describe "<%= cookbook_name %>::default" do
6
6
  let(:chef_run) do
7
7
  ChefSpec::Runner.new do |node|
8
8
  end.converge(described_recipe)
@@ -1,9 +1,4 @@
1
1
  require 'serverspec'
2
2
 
3
- include SpecInfra::Helper::Exec
4
- include SpecInfra::Helper::DetectOS
5
-
6
- RSpec.configure do |c|
7
- c.sudo_password = ENV['SUDO_PASSWORD']
8
- c.path = '/sbin:/usr/sbin'
9
- end
3
+ set :backend, :exec
4
+ set :path, '/sbin:/usr/sbin:$PATH'
@@ -9,28 +9,26 @@ module Teststrap
9
9
 
10
10
  default_task :generate_tests
11
11
 
12
- desc 'generate_tests', 'generate test files'
12
+ desc "generate_tests", "generate test files"
13
13
  def generate_tests
14
14
  @cookbook_name = current_directory_name
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
- copy_file 'Thorfile'
25
- template 'spec/default_spec.rb'
26
- template 'spec/chefspec_helper.rb'
27
- template 'test/integration/default/serverspec/localhost/default_spec.rb',
28
- "test/integration/#{@cookbook_name}/serverspec/localhost/default_spec.rb"
29
- template 'test/integration/default/serverspec/spec_helper.rb',
30
- "test/integration/#{@cookbook_name}/serverspec/spec_helper.rb"
31
- template '.kitchen.yml'
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
@@ -3,52 +3,57 @@ require 'spec_helper'
3
3
  describe Teststrap::Teststrap do
4
4
  let(:teststrap) { described_class.new }
5
5
 
6
- describe 'generate_tests' do
7
- FILES = ['Gemfile', 'Berksfile', 'Strainerfile', 'Thorfile', '.gitignore', 'LICENSE']
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/localhost/default_spec.rb',
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.stub(:copy_file)
19
- teststrap.stub(:template)
20
- teststrap.stub(:current_directory_name)
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 'should generate files' do
25
-
28
+ it "should generate files" do
26
29
  FILES.each do |file|
27
- teststrap.should_receive(:copy_file).with(file)
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 'should generate templates' do
34
-
35
+ it "should generate templates" do
35
36
  TEMPLATES.each do |template|
36
- teststrap.should_receive(:template).with(template)
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 'current_directory_name' do
44
- it 'return current working directory name' do
45
- Dir.stub('pwd').and_return('test/dir/test_cookbook')
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 'source_root' do
51
- it 'return generator file path' do
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.2.5
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/localhost/default_spec.rb
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.1
101
+ rubygems_version: 2.2.2
103
102
  signing_key:
104
103
  specification_version: 4
105
104
  summary: cookbook test framework generator
@@ -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