testinator 0.0.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.
data/bin/testinator ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/ruby
2
+ require 'testinator'
3
+ Testinator.start(ARGV)
data/lib/testinator.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'thor'
2
+ require 'fileutils'
3
+
4
+ Config = Struct.new(:name)
5
+
6
+ class Testinator < Thor
7
+ include Thor::Actions
8
+
9
+ desc "setup NAME PATH","Setup up cookbook test files for the given name and path (default: current dir)"
10
+ def setup(name,path=".")
11
+ @app = Config.new
12
+ @app.name = name
13
+ self.destination_root = File.expand_path(File.join(Dir.pwd,path))
14
+ copy_file 'Gemfile'
15
+ empty_directory 'spec'
16
+ template 'default_spec.rb.erb', 'spec/default_spec.rb'
17
+
18
+ end
19
+
20
+ def self.source_root
21
+ File.expand_path(File.join(File.dirname(__FILE__), "..", "template"))
22
+ end
23
+
24
+ end
data/template/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'chefspec'
4
+ gem 'fauxhai'
@@ -0,0 +1,29 @@
1
+ require 'chefspec'
2
+ require 'fauxhai'
3
+
4
+
5
+ describe '<%= @app.name %>::default' do
6
+
7
+ before do
8
+ Fauxhai.mock(platform: 'ubuntu', version: '12.04')
9
+ Chef::Recipe.any_instance.stub(:search).with(:users, 'groups:sysadmin').and_return({name: 'tim', ssh-key:"asd"})
10
+ end
11
+
12
+ let(:chef_run){
13
+ # one could use :log_level => :debug, as arg to _new_
14
+ ChefSpec::ChefRunner.new.converge('<%= @app.name %>::default')
15
+ }
16
+
17
+ it 'should install the required packages' do
18
+ packages = %w"apache nginx lighttpd"
19
+ packages.each do |pkg|
20
+ expect(chef_run).to install_package pkg
21
+ end
22
+ expect(chef_run).to install_gem_package "bundler"
23
+ end
24
+
25
+ it 'should create the application user' do
26
+ expect(chef_run).to create_user "tim"
27
+ end
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testinator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tim Buchwaldt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.14.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.14.0
30
+ description: A simple cookbook to create chef cookbook test
31
+ email: tim@buchwaldt.ws
32
+ executables:
33
+ - testinator
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/testinator.rb
38
+ - bin/testinator
39
+ - template/Gemfile
40
+ - template/default_spec.rb.erb
41
+ homepage: http://rubygems.org/gems/testinator
42
+ licenses: []
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 1.8.23
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: Create test for chef cookbooks
65
+ test_files: []
66
+ has_rdoc: