Update spec files to be rubocop compliant

- Update .rubocop.yml to include spec/**
- Update spec files to be rubocop compliant
- Inlcude 'chefspec/berkshelf' in spec_helper.rb for ease of use

Change-Id: Ief01cc34cc4f9f04e6ba6437f67bfd347975c3a8
Addresses: blueprint rubocop-for-network
This commit is contained in:
Andy McCrae 2014-01-28 16:02:40 +00:00
parent 7d94a7989a
commit f5f4773b7a
4 changed files with 7 additions and 6 deletions

View File

@ -3,11 +3,11 @@ AllCops:
- Gemfile
- metadata.rb
- attributes/**
- spec/**
Excludes:
- files/**
- recipes/**
- spec/**
- templates/**
# UTF-8 headers not generally in these files

View File

@ -17,7 +17,7 @@ describe 'openvswitch::build_openvswitch_source' do
node.set['openstack']['compute']['network']['service_type'] = 'nova'
chef_run.converge 'openstack-network::openvswitch'
chef_run.converge 'openstack-network::build_openvswitch_source'
['build-essential', 'pkg-config', 'fakeroot', 'libssl-dev', 'openssl', 'debhelper', 'autoconf'].each do |pkg|
%w(build-essential pkg-config fakeroot libssl-dev openssl debhelper autoconf).each do |pkg|
expect(chef_run).to_not install_package pkg
end
end
@ -25,7 +25,7 @@ describe 'openvswitch::build_openvswitch_source' do
# since our mocked version of ubuntu is precise, our compile
# utilities should be installed to build OVS from source
it 'installs openvswitch build dependencies' do
['build-essential', 'pkg-config', 'fakeroot', 'libssl-dev', 'openssl', 'debhelper', 'autoconf'].each do |pkg|
%w(build-essential pkg-config fakeroot libssl-dev openssl debhelper autoconf).each do |pkg|
expect(@chef_run).to install_package pkg
end
end

View File

@ -24,7 +24,7 @@ describe 'openstack-network::dhcp_agent' do
# since our mocked version of ubuntu is precise, our compile
# utilities should be installed to build dnsmasq
it 'installs dnsmasq build dependencies' do
['build-essential', 'pkg-config', 'libidn11-dev', 'libdbus-1-dev', 'libnetfilter-conntrack-dev', 'gettext'].each do |pkg|
%w(build-essential pkg-config libidn11-dev libdbus-1-dev libnetfilter-conntrack-dev gettext).each do |pkg|
expect(@chef_run).to install_package pkg
end
end

View File

@ -1,5 +1,6 @@
# Encoding: utf-8
require 'chefspec'
require 'chefspec/berkshelf'
require 'chef/application'
::LOG_LEVEL = :fatal
@ -44,7 +45,7 @@ MOCK_NODE_NETWORK_DATA =
}
}
def neutron_stubs
def neutron_stubs # rubocop:disable MethodLength
::Chef::Recipe.any_instance.stub(:rabbit_servers)
.and_return('1.1.1.1:5672,2.2.2.2:5672')
::Chef::Recipe.any_instance.stub(:config_by_role)
@ -61,7 +62,7 @@ def neutron_stubs
.with('secrets', 'neutron_metadata_secret')
.and_return('metadata-secret')
::Chef::Recipe.any_instance.stub(:get_password)
.with('db', anything())
.with('db', anything)
.and_return('neutron')
::Chef::Recipe.any_instance.stub(:get_password)
.with('service', 'openstack-network')