Skip to content

Commit

Permalink
minor rspec cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Oct 2, 2013
1 parent 2aeebe7 commit 80373a6
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 72 deletions.
40 changes: 21 additions & 19 deletions spec/classes/selenium_config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
require 'spec_helper'

describe 'selenium::config', :type => :class do
let(:title) { 'redhat' }
let(:facts) {{ :osfamily=> 'RedHat' }}

context 'no params' do
let :pre_condition do
"class { 'selenium::server': }"
end
context 'for osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat' }}

context 'no params' do
let :pre_condition do
"class { 'selenium::server': }"
end

it do
should contain_class('selenium::config')
should contain_file('/etc/init.d/selenium').with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'mode' => '0755',
}).
with_content(/SLNM_DISPLAY=':0'/).
with_content(/SLNM_USER='selenium'/).
with_content(/SLNM_INSTALL_PATH='\/opt\/selenium'/).
with_content(/SLNM_JAR_NAME='selenium-server-standalone-2.35.0.jar'/).
with_content(/SLNM_OPTIONS='-Dwebdriver.enable.native.events=1'/)
it do
should contain_class('selenium::config')
should contain_file('/etc/init.d/selenium').with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'mode' => '0755',
}).
with_content(/SLNM_DISPLAY=':0'/).
with_content(/SLNM_USER='selenium'/).
with_content(/SLNM_INSTALL_PATH='\/opt\/selenium'/).
with_content(/SLNM_JAR_NAME='selenium-server-standalone-2.35.0.jar'/).
with_content(/SLNM_OPTIONS='-Dwebdriver.enable.native.events=1'/)
end
end
end

Expand Down
74 changes: 38 additions & 36 deletions spec/classes/selenium_install_spec.rb
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
require 'spec_helper'

describe 'selenium::install' do
let(:title) { 'redhat' }
let(:facts) {{ :osfamily=> 'RedHat' }}
describe 'selenium::install', :type => :class do

context 'no params' do
let :pre_condition do
'include selenium::server'
end
context 'for osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat' }}

context 'no params' do
let :pre_condition do
'include selenium::server'
end

it do
should include_class('wget')
should contain_class('selenium::install').with_version('2.35.0')
should contain_file('/opt/selenium').with({
'ensure' => 'directory',
'owner' => 'selenium',
'group' => 'selenium',
})
should contain_file('/opt/selenium/jars').with({
'ensure' => 'directory',
'owner' => 'selenium',
'group' => 'selenium',
})
should contain_file('/opt/selenium/log').with({
'ensure' => 'directory',
'owner' => 'selenium',
'group' => 'selenium',
})
should contain_file('/var/log/selenium').with({
'ensure' => 'link',
'owner' => 'root',
'group' => 'root',
})
should contain_wget__fetch('selenium-server-standalone').with({
'source' => 'https://selenium.googlecode.com/files/selenium-server-standalone-2.35.0.jar',
'destination' => '/opt/selenium/jars/selenium-server-standalone-2.35.0.jar',
'timeout' => '90',
'execuser' => 'selenium',
})
it do
should include_class('wget')
should contain_class('selenium::install').with_version('2.35.0')
should contain_file('/opt/selenium').with({
'ensure' => 'directory',
'owner' => 'selenium',
'group' => 'selenium',
})
should contain_file('/opt/selenium/jars').with({
'ensure' => 'directory',
'owner' => 'selenium',
'group' => 'selenium',
})
should contain_file('/opt/selenium/log').with({
'ensure' => 'directory',
'owner' => 'selenium',
'group' => 'selenium',
})
should contain_file('/var/log/selenium').with({
'ensure' => 'link',
'owner' => 'root',
'group' => 'root',
})
should contain_wget__fetch('selenium-server-standalone').with({
'source' => 'https://selenium.googlecode.com/files/selenium-server-standalone-2.35.0.jar',
'destination' => '/opt/selenium/jars/selenium-server-standalone-2.35.0.jar',
'timeout' => '90',
'execuser' => 'selenium',
})
end
end
end

Expand Down
11 changes: 4 additions & 7 deletions spec/classes/selenium_params_spec.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
require 'spec_helper'

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

context 'for osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat' }}

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

describe 'unsupported osfamily' do
context 'unsupported osfamily' do
let :facts do
{
:osfamily => 'Debian',
Expand Down
22 changes: 12 additions & 10 deletions spec/classes/selenium_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
require 'spec_helper'

describe 'selenium::service' do
let(:title) { 'redhat' }
let(:facts) {{ :osfamily=> 'RedHat' }}
describe 'selenium::service', :type => :class do

it do
should contain_service('selenium').with({
:ensure => 'running',
:hasstatus => 'true',
:hasrestart => 'true',
:enable => 'true',
})
context 'for osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat' }}

it do
should contain_service('selenium').with({
:ensure => 'running',
:hasstatus => 'true',
:hasrestart => 'true',
:enable => 'true',
})
end
end

end

0 comments on commit 80373a6

Please sign in to comment.