Skip to content

Commit

Permalink
Merge pull request boxen#10 from boxen/tests
Browse files Browse the repository at this point in the history
Needs tests
  • Loading branch information
createdbypete committed Aug 22, 2013
2 parents 1052357 + c1fd98f commit b9c0720
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
script: "./script/cibuild"
gemfile: "this/does/not/exist"
rvm:
- "1.8.7"
- "1.8.7"
- "1.9.3"
32 changes: 16 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GEM
specs:
addressable (2.3.5)
ansi (1.4.3)
boxen (1.4.2)
boxen (1.5.2)
ansi (~> 1.4)
hiera (~> 1.0)
highline (~> 1.6)
Expand All @@ -17,9 +17,9 @@ GEM
puppetlabs_spec_helper (~> 0.4)
rspec-puppet (~> 0.1)
diff-lcs (1.2.4)
facter (1.7.1)
faraday (0.8.7)
multipart-post (~> 1.1)
facter (1.7.2)
faraday (0.8.8)
multipart-post (~> 1.2.0)
faraday_middleware (0.9.0)
faraday (>= 0.7.4, < 0.9)
hashie (2.0.5)
Expand All @@ -28,26 +28,26 @@ GEM
highline (1.6.19)
json (1.8.0)
json_pure (1.8.0)
librarian-puppet (0.9.9)
librarian-puppet (0.9.10)
json
thor (~> 0.15)
metaclass (0.0.1)
mocha (0.14.0)
metaclass (~> 0.0.1)
multi_json (1.7.7)
multi_json (1.7.9)
multipart-post (1.2.0)
netrc (0.7.7)
octokit (1.24.0)
octokit (1.25.0)
addressable (~> 2.2)
faraday (~> 0.8)
faraday_middleware (~> 0.9)
hashie (~> 2.0)
multi_json (~> 1.3)
netrc (~> 0.7.7)
puppet (3.2.2)
puppet (3.2.4)
facter (~> 1.6)
hiera (~> 1.0)
rgen (~> 0.6)
rgen (~> 0.6.5)
puppet-lint (0.3.2)
puppetlabs_spec_helper (0.4.1)
mocha (>= 0.10.5)
Expand All @@ -56,14 +56,14 @@ GEM
rspec-puppet (>= 0.1.1)
rake (10.1.0)
rgen (0.6.5)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.5)
rspec-expectations (2.14.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rspec-mocks (2.14.3)
rspec-puppet (0.1.6)
rspec
thor (0.18.1)
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ include java

## Required Puppet Modules

None.
* `boxen`

## Development

Write code. Run `script/cibuild` to test it. Check the `script`
directory for other useful tools.
7 changes: 0 additions & 7 deletions Rakefile

This file was deleted.

4 changes: 4 additions & 0 deletions manifests/idrac7.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Public: Dell DRAC and Java 7 Certificate Fix
# http://people.binf.ku.dk/~hanne/b2evolution/blogs/index.php/2012/08/09/dell-idrac-7-will-not
#
# Examples
#
# include java::idrac7
class java::idrac7 {
include java

Expand Down
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Public: installs java jre-7u21
#
# Examples
#
# include java
class java {
include boxen::config

$jre_url = 'https://s3.amazonaws.com/boxen-downloads/java/jre-7u21-macosx-x64.dmg'
$jdk_url = 'https://s3.amazonaws.com/boxen-downloads/java/jdk-7u21-macosx-x64.dmg'
$wrapper = "${boxen::config::bindir}/java"
Expand Down
28 changes: 28 additions & 0 deletions spec/classes/java_idrac7_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'spec_helper'

describe "java::idrac7" do
let(:facts) { default_test_facts }

it do
should include_class('java')

['.java', '.java/deployment', '.java/deployment/security'].each do |dir|
should contain_file("/Users/testuser/#{dir}").with({
:ensure => 'directory',
:mode => '0750'
})
end

should contain_file("/Users/testuser/.java/deployment/security/trusted.certs").with({
:ensure => 'file',
:mode => '0640',
:source => 'puppet:///modules/java/trusted.certs'
})

should contain_file("/Users/testuser/.java/deployment/security/trusted.jssecerts").with({
:ensure => 'file',
:mode => '0640',
:source => 'puppet:///modules/java/trusted.jssecerts'
})
end
end
29 changes: 29 additions & 0 deletions spec/classes/java_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'spec_helper'

describe "java" do
let(:facts) { default_test_facts }

it do
should include_class('boxen::config')

should contain_package('jre-7u21.dmg').with({
:ensure => 'present',
:alias => 'java-jre',
:provider => 'pkgdmg',
:source => 'https://s3.amazonaws.com/boxen-downloads/java/jre-7u21-macosx-x64.dmg'
})

should contain_package('jdk-7u21.dmg').with({
:ensure => 'present',
:alias => 'java',
:provider => 'pkgdmg',
:source => 'https://s3.amazonaws.com/boxen-downloads/java/jdk-7u21-macosx-x64.dmg'
})

should contain_file('/test/boxen/bin/java').with({
:source => 'puppet:///modules/java/java.sh',
:mode => '0755',
:require => 'Package[java]'
})
end
end
1 change: 1 addition & 0 deletions spec/fixtures/Puppetfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod 'boxen', '3.0.2', :github_tarball => 'boxen/puppet-boxen'
1 change: 1 addition & 0 deletions spec/fixtures/modules/java/files
1 change: 1 addition & 0 deletions spec/fixtures/modules/java/manifests
7 changes: 7 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
end

def default_test_facts
{
:boxen_home => "/test/boxen",
:boxen_user => "testuser"
}
end

0 comments on commit b9c0720

Please sign in to comment.