File tree Expand file tree Collapse file tree
test/integration/default/serverspec Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .vagrant
2+ Berksfile.lock
3+ * ~
4+ * #
5+ . #*
6+ \# * #
7+ . * .sw [a-z ]
8+ * .un~
9+
10+ # Bundler
11+ Gemfile.lock
12+ bin /*
13+ .bundle /*
14+
15+ .kitchen /
16+ .kitchen.local.yml
Original file line number Diff line number Diff line change 1+ ---
2+ driver :
3+ name : vagrant
4+
5+ provisioner :
6+ name : chef_zero
7+
8+ platforms :
9+ - name : ubuntu-14.04
10+ driver :
11+ box : express42/ubuntu-14.04
12+ - name : centos-7.0
13+ driver :
14+ box : parallels/centos-7.0
15+
16+ suites :
17+ - name : default
18+ run_list :
19+ - recipe[deploy-user::default]
20+ attributes :
Original file line number Diff line number Diff line change 1+ source "https://supermarket.chef.io"
2+
3+ metadata
Original file line number Diff line number Diff line change 1+ # deploy-user
2+
3+ TODO: Enter the cookbook description here.
4+
Original file line number Diff line number Diff line change 1+ default [ 'deploy-user' ] [ 'username' ] = 'deployer'
2+ default [ 'deploy-user' ] [ 'shell' ] = '/bin/bash'
3+ default [ 'deploy-user' ] [ 'home' ] = '/home/deployer'
Original file line number Diff line number Diff line change 1+ # Put files/directories that should be ignored in this file when uploading
2+ # or sharing to the community site.
3+ # Lines that start with '# ' are comments.
4+
5+ # OS generated files #
6+ ######################
7+ .DS_Store
8+ Icon?
9+ nohup.out
10+ ehthumbs.db
11+ Thumbs.db
12+
13+ # SASS #
14+ ########
15+ .sass-cache
16+
17+ # EDITORS #
18+ ###########
19+ \#*
20+ .#*
21+ *~
22+ *.sw[a-z]
23+ *.bak
24+ REVISION
25+ TAGS*
26+ tmtags
27+ *_flymake.*
28+ *_flymake
29+ *.tmproj
30+ .project
31+ .settings
32+ mkmf.log
33+
34+ ## COMPILED ##
35+ ##############
36+ a.out
37+ *.o
38+ *.pyc
39+ *.so
40+ *.com
41+ *.class
42+ *.dll
43+ *.exe
44+ */rdoc/
45+
46+ # Testing #
47+ ###########
48+ .watchr
49+ .rspec
50+ spec/*
51+ spec/fixtures/*
52+ test/*
53+ features/*
54+ Guardfile
55+ Procfile
56+
57+ # SCM #
58+ #######
59+ .git
60+ */.git
61+ .gitignore
62+ .gitmodules
63+ .gitconfig
64+ .gitattributes
65+ .svn
66+ */.bzr/*
67+ */.hg/*
68+ */.svn/*
69+
70+ # Berkshelf #
71+ #############
72+ Berksfile
73+ Berksfile.lock
74+ cookbooks/*
75+ tmp
76+
77+ # Cookbooks #
78+ #############
79+ CONTRIBUTING
80+
81+ # Strainer #
82+ ############
83+ Colanderfile
84+ Strainerfile
85+ .colander
86+ .strainer
87+
88+ # Vagrant #
89+ ###########
90+ .vagrant
91+ Vagrantfile
92+
93+ # Travis #
94+ ##########
95+ .travis.yml
Original file line number Diff line number Diff line change 1+ name 'deploy-user'
2+ maintainer 'The Authors'
3+ maintainer_email 'you@example.com'
4+ license 'all_rights'
5+ description 'Installs/Configures deploy-user'
6+ long_description 'Installs/Configures deploy-user'
7+ version '0.1.0'
Original file line number Diff line number Diff line change 1+ #
2+ # Cookbook Name:: deploy-user
3+ # Recipe:: default
4+ #
5+ # Copyright (c) 2015 The Authors, All Rights Reserved.
6+
7+ user node [ 'deploy-user' ] [ 'username' ] do
8+ shell node [ 'deploy-user' ] [ 'shell' ]
9+ home node [ 'deploy-user' ] [ 'home' ]
10+ supports manage_home : true
11+ end
Original file line number Diff line number Diff line change 1+ require 'chefspec'
2+ require 'chefspec/berkshelf'
3+
4+ at_exit { ChefSpec ::Coverage . report! }
Original file line number Diff line number Diff line change 1+ #
2+ # Cookbook Name:: deploy-user
3+ # Spec:: default
4+ #
5+ # Copyright (c) 2015 The Authors, All Rights Reserved.
6+
7+ require 'spec_helper'
8+
9+ describe 'deploy-user::default' do
10+
11+ let ( :chef_run ) do
12+ runner = ChefSpec ::ServerRunner . new
13+ runner . converge ( described_recipe )
14+ end
15+
16+ it 'converges successfully' do
17+ chef_run # This should not raise an error
18+ end
19+
20+ it 'creates a user deployer with home "/home/deployer" and shell "/bin/bash"' do
21+ expect ( chef_run ) . to create_user ( 'deployer' ) . with (
22+ home : '/home/deployer' ,
23+ shell : '/bin/bash' )
24+ end
25+
26+ end
You can’t perform that action at this time.
0 commit comments