diff --git a/spec/classes/selenium_config_spec.rb b/spec/classes/selenium_config_spec.rb index 08e348d..d4cf307 100644 --- a/spec/classes/selenium_config_spec.rb +++ b/spec/classes/selenium_config_spec.rb @@ -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 diff --git a/spec/classes/selenium_install_spec.rb b/spec/classes/selenium_install_spec.rb index 986ff57..bd77e75 100644 --- a/spec/classes/selenium_install_spec.rb +++ b/spec/classes/selenium_install_spec.rb @@ -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 diff --git a/spec/classes/selenium_params_spec.rb b/spec/classes/selenium_params_spec.rb index 4b76d36..bb091cc 100644 --- a/spec/classes/selenium_params_spec.rb +++ b/spec/classes/selenium_params_spec.rb @@ -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', diff --git a/spec/classes/selenium_service_spec.rb b/spec/classes/selenium_service_spec.rb index 11c8f1f..3db0b8e 100644 --- a/spec/classes/selenium_service_spec.rb +++ b/spec/classes/selenium_service_spec.rb @@ -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