Skip to content

Commit

Permalink
stub out selenium::{server,params} classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Oct 1, 2013
1 parent edc5da0 commit eb724de
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ fixtures:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "3.0.0"
symlinks:
"module_skel": "#{source_dir}"
"selenium": "#{source_dir}"
6 changes: 3 additions & 3 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name 'jhoblitt-module_skel'
name 'jhoblitt-selenium'
version '0.0.1'

author 'Joshua Hoblitt <jhoblitt@cpan.org>'
license 'Apache'
project_page 'https://github.com/jhoblitt/puppet-module_skel'
source 'https://github.com/jhoblitt/puppet-module_skel.git'
project_page 'https://github.com/jhoblitt/puppet-selenium'
source 'https://github.com/jhoblitt/puppet-selenium.git'
summary 'module skeleton'
description 'module skeleton'
dependency 'puppetlabs/stdlib', '>= 3.0.0'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Puppet module_skel Module
Puppet selenium Module
=========================

[![Build Status](https://travis-ci.org/jhoblitt/puppet-module_skel.png)](https://travis-ci.org/jhoblitt/puppet-module_skel)
[![Build Status](https://travis-ci.org/jhoblitt/puppet-selenium.png)](https://travis-ci.org/jhoblitt/puppet-selenium)

#### Table of Contents

Expand Down Expand Up @@ -35,5 +35,5 @@ Support
-------

Please log tickets and issues at
[github](https://github.com/jhoblitt/puppet-module_skel/issues)
[github](https://github.com/jhoblitt/puppet-selenium/issues)

11 changes: 0 additions & 11 deletions manifests/init.pp

This file was deleted.

17 changes: 17 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# == Class: selenium::params
#
# This class should be considered private.
#
#
class selenium::params {
$user = 'selenium'
$group = $user

case $::osfamily {
'redhat': {}
default: {
fail("Module ${module_name} is not supported on ${::operatingsystem}")
}
}

}
22 changes: 22 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# == Class: selenium::server
#
# simple template
#
# === Examples
#
# include selenium::server
#
class selenium::server(
$user = $selenium::params::user,
$group = $selenium::params::group,
) inherits selenium::params {
validate_string($user)
validate_string($group)

user { $user:
managehome => true,
gid => [$group],
}
group { $group: }

}
28 changes: 28 additions & 0 deletions spec/classes/selenium_params_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'spec_helper'

describe 'selenium::params', :type => :class do
describe 'for osfamily RedHat' do
let :facts do
{
:osfamily => 'RedHat',
}
end

it { should include_class('selenium::params') }
end

describe 'unsupported osfamily' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
}
end

it 'should fail' do
expect { should include_class('selenium::params') }.
to raise_error(Puppet::Error, /not supported on Debian/)
end
end

end
15 changes: 15 additions & 0 deletions spec/classes/selenium_server_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'

describe 'selenium::server', :type => :class do

describe 'for osfamily RedHat' do
let :facts do
{
:osfamily => 'RedHat',
}
end

it { should contain_class('selenium::server') }
end

end
9 changes: 0 additions & 9 deletions spec/classes/selenium_spec.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/spec_helper_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
puppet_install

# Install modules and dependencies
puppet_module_install(:source => proj_root, :module_name => 'module_skel')
puppet_module_install(:source => proj_root, :module_name => 'selenium')
shell('puppet module install puppetlabs-stdlib')
end
end
8 changes: 4 additions & 4 deletions spec/system/selenium_spec.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
require 'spec_helper_system'

describe 'module_skel class' do
describe 'selenium class' do
case node.facts['osfamily']
when 'RedHat', 'Debian'
package_name = 'module_skel'
service_name = 'module_skel'
package_name = 'selenium'
service_name = 'selenium'
end

describe 'running puppet code' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOS
class { 'module_skel': }
class { 'selenium': }
EOS

# Run it twice and test for idempotency
Expand Down

0 comments on commit eb724de

Please sign in to comment.