From c0e3907ba062e706b003f508fb177978c29fd2f8 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sat, 22 Mar 2014 14:09:43 +0000 Subject: [PATCH] tidy up requires It's really ugly to have to keep repeating File.dirname(__FILE__), so we use a temporary variable, even in the case of a single require. This minimises long "requires" lines and "requires" statements with needing line-breaks, and should make search-and-replace a bit easier if we later want to migrate to __dir__ (Ruby >= 2.0) or require_relative. http://stackoverflow.com/questions/4333286/ruby-require-vs-require-relative-best-practice-to-workaround-running-in-both I've deliberately rejected the pattern: require File.expand_path('../relative/path', __FILE__) because it relies on inconsistent semantics and inconsistent documentation in File.expand_path: http://stackoverflow.com/questions/4333286/ruby-require-vs-require-relative-best-practice-to-workaround-running-in-both#comment34147297_4333552 --- libraries/chef/mixin/pacemaker.rb | 5 +++-- libraries/chef/mixin/pacemaker/runnable_resource.rb | 2 +- .../chef/mixin/pacemaker/standard_cib_object.rb | 2 +- libraries/pacemaker/resource/clone.rb | 5 +++-- libraries/pacemaker/resource/group.rb | 5 +++-- libraries/pacemaker/resource/primitive.rb | 6 ++++-- providers/clone.rb | 6 +++--- providers/colocation.rb | 6 +++--- providers/group.rb | 6 +++--- providers/location.rb | 6 +++--- providers/ms.rb | 6 +++--- providers/primitive.rb | 6 +++--- providers/property.rb | 4 ++-- spec/fixtures/colocation_constraint.rb | 2 +- spec/fixtures/keystone_primitive.rb | 2 +- spec/fixtures/location_constraint.rb | 2 +- spec/helpers/cib_object.rb | 4 ++-- spec/helpers/provider.rb | 3 ++- spec/helpers/runnable_resource.rb | 3 ++- spec/libraries/pacemaker/cib_object_spec.rb | 8 +++++--- .../pacemaker/constraint/colocation_spec.rb | 8 +++++--- .../libraries/pacemaker/constraint/location_spec.rb | 8 +++++--- spec/libraries/pacemaker/resource/clone_spec.rb | 12 ++++++------ spec/libraries/pacemaker/resource/group_spec.rb | 1 + spec/libraries/pacemaker/resource/ms_spec.rb | 12 ++++++------ spec/libraries/pacemaker/resource/primitive_spec.rb | 13 ++++++------- spec/libraries/pacemaker/resource_spec.rb | 8 ++++---- spec/providers/clone_spec.rb | 8 +++++--- spec/providers/colocation_spec.rb | 8 +++++--- spec/providers/group_spec.rb | 8 +++++--- spec/providers/location_spec.rb | 8 +++++--- spec/providers/ms_spec.rb | 8 +++++--- spec/providers/primitive_spec.rb | 8 +++++--- 33 files changed, 112 insertions(+), 87 deletions(-) diff --git a/libraries/chef/mixin/pacemaker.rb b/libraries/chef/mixin/pacemaker.rb index 3751d07..7c936b0 100644 --- a/libraries/chef/mixin/pacemaker.rb +++ b/libraries/chef/mixin/pacemaker.rb @@ -1,2 +1,3 @@ -require File.expand_path('pacemaker/standard_cib_object.rb', File.dirname(__FILE__)) -require File.expand_path('pacemaker/runnable_resource.rb', File.dirname(__FILE__)) +this_dir = File.dirname(__FILE__) +require File.expand_path('pacemaker/standard_cib_object.rb', this_dir) +require File.expand_path('pacemaker/runnable_resource.rb', this_dir) diff --git a/libraries/chef/mixin/pacemaker/runnable_resource.rb b/libraries/chef/mixin/pacemaker/runnable_resource.rb index 7b591a0..ad09e4f 100644 --- a/libraries/chef/mixin/pacemaker/runnable_resource.rb +++ b/libraries/chef/mixin/pacemaker/runnable_resource.rb @@ -1,4 +1,4 @@ -require ::File.expand_path('standard_cib_object', ::File.dirname(__FILE__)) +require ::File.expand_path('standard_cib_object', File.dirname(__FILE__)) # Common code used by Pacemaker LWRP providers for resources supporting # the :run action. diff --git a/libraries/chef/mixin/pacemaker/standard_cib_object.rb b/libraries/chef/mixin/pacemaker/standard_cib_object.rb index a7ca14e..e34e1b6 100644 --- a/libraries/chef/mixin/pacemaker/standard_cib_object.rb +++ b/libraries/chef/mixin/pacemaker/standard_cib_object.rb @@ -1,5 +1,5 @@ require ::File.expand_path('../../../pacemaker/cib_object', - ::File.dirname(__FILE__)) + File.dirname(__FILE__)) # Common code used by Pacemaker LWRP providers diff --git a/libraries/pacemaker/resource/clone.rb b/libraries/pacemaker/resource/clone.rb index 54fc945..2252b75 100644 --- a/libraries/pacemaker/resource/clone.rb +++ b/libraries/pacemaker/resource/clone.rb @@ -1,5 +1,6 @@ -require File.expand_path('../resource', File.dirname(__FILE__)) -require File.expand_path('../mixins/resource_meta', File.dirname(__FILE__)) +this_dir = File.dirname(__FILE__) +require File.expand_path('../resource', this_dir) +require File.expand_path('../mixins/resource_meta', this_dir) class Pacemaker::Resource::Clone < Pacemaker::Resource TYPE = 'clone' diff --git a/libraries/pacemaker/resource/group.rb b/libraries/pacemaker/resource/group.rb index be72e19..bfeff8f 100644 --- a/libraries/pacemaker/resource/group.rb +++ b/libraries/pacemaker/resource/group.rb @@ -1,5 +1,6 @@ -require File.expand_path('../resource', File.dirname(__FILE__)) -require File.expand_path('../mixins/resource_meta', File.dirname(__FILE__)) +this_dir = File.dirname(__FILE__) +require File.expand_path('../resource', this_dir) +require File.expand_path('../mixins/resource_meta', this_dir) class Pacemaker::Resource::Group < Pacemaker::Resource TYPE = 'group' diff --git a/libraries/pacemaker/resource/primitive.rb b/libraries/pacemaker/resource/primitive.rb index 08d0568..59cd73a 100644 --- a/libraries/pacemaker/resource/primitive.rb +++ b/libraries/pacemaker/resource/primitive.rb @@ -1,6 +1,8 @@ require 'shellwords' -require File.expand_path('../resource', File.dirname(__FILE__)) -require File.expand_path('../mixins/resource_meta', File.dirname(__FILE__)) + +this_dir = File.dirname(__FILE__) +require File.expand_path('../resource', this_dir) +require File.expand_path('../mixins/resource_meta', this_dir) class Pacemaker::Resource::Primitive < Pacemaker::Resource TYPE = 'primitive' diff --git a/providers/clone.rb b/providers/clone.rb index 9217ca0..ebfd365 100644 --- a/providers/clone.rb +++ b/providers/clone.rb @@ -17,9 +17,9 @@ # limitations under the License. # -require ::File.expand_path('../libraries/pacemaker', ::File.dirname(__FILE__)) -require ::File.expand_path('../libraries/chef/mixin/pacemaker', - ::File.dirname(__FILE__)) +this_dir = ::File.dirname(__FILE__) +require ::File.expand_path('../libraries/pacemaker', this_dir) +require ::File.expand_path('../libraries/chef/mixin/pacemaker', this_dir) include Chef::Mixin::Pacemaker::RunnableResource diff --git a/providers/colocation.rb b/providers/colocation.rb index ffb5383..3a35355 100644 --- a/providers/colocation.rb +++ b/providers/colocation.rb @@ -17,9 +17,9 @@ # limitations under the License. # -require ::File.expand_path('../libraries/pacemaker', ::File.dirname(__FILE__)) -require ::File.expand_path('../libraries/chef/mixin/pacemaker', - ::File.dirname(__FILE__)) +this_dir = ::File.dirname(__FILE__) +require ::File.expand_path('../libraries/pacemaker', this_dir) +require ::File.expand_path('../libraries/chef/mixin/pacemaker', this_dir) include Chef::Mixin::Pacemaker::StandardCIBObject diff --git a/providers/group.rb b/providers/group.rb index 6b3cb2c..af7bc98 100644 --- a/providers/group.rb +++ b/providers/group.rb @@ -16,9 +16,9 @@ # limitations under the License. # -require ::File.expand_path('../libraries/pacemaker', ::File.dirname(__FILE__)) -require ::File.expand_path('../libraries/chef/mixin/pacemaker', - ::File.dirname(__FILE__)) +this_dir = ::File.dirname(__FILE__) +require ::File.expand_path('../libraries/pacemaker', this_dir) +require ::File.expand_path('../libraries/chef/mixin/pacemaker', this_dir) include Chef::Mixin::Pacemaker::RunnableResource diff --git a/providers/location.rb b/providers/location.rb index fcf7e1e..5df7597 100644 --- a/providers/location.rb +++ b/providers/location.rb @@ -17,9 +17,9 @@ # limitations under the License. # -require ::File.expand_path('../libraries/pacemaker', ::File.dirname(__FILE__)) -require ::File.expand_path('../libraries/chef/mixin/pacemaker', - ::File.dirname(__FILE__)) +this_dir = ::File.dirname(__FILE__) +require ::File.expand_path('../libraries/pacemaker', this_dir) +require ::File.expand_path('../libraries/chef/mixin/pacemaker', this_dir) include Chef::Mixin::Pacemaker::StandardCIBObject diff --git a/providers/ms.rb b/providers/ms.rb index 1d772fd..430e47b 100644 --- a/providers/ms.rb +++ b/providers/ms.rb @@ -17,9 +17,9 @@ # limitations under the License. # -require ::File.expand_path('../libraries/pacemaker', ::File.dirname(__FILE__)) -require ::File.expand_path('../libraries/chef/mixin/pacemaker', - ::File.dirname(__FILE__)) +this_dir = ::File.dirname(__FILE__) +require ::File.expand_path('../libraries/pacemaker', this_dir) +require ::File.expand_path('../libraries/chef/mixin/pacemaker', this_dir) include Chef::Mixin::Pacemaker::RunnableResource diff --git a/providers/primitive.rb b/providers/primitive.rb index a4a93e8..5206a35 100644 --- a/providers/primitive.rb +++ b/providers/primitive.rb @@ -17,9 +17,9 @@ # limitations under the License. # -require ::File.expand_path('../libraries/pacemaker', ::File.dirname(__FILE__)) -require ::File.expand_path('../libraries/chef/mixin/pacemaker', - ::File.dirname(__FILE__)) +this_dir = ::File.dirname(__FILE__) +require ::File.expand_path('../libraries/pacemaker', this_dir) +require ::File.expand_path('../libraries/chef/mixin/pacemaker', this_dir) include Chef::Mixin::Pacemaker::RunnableResource diff --git a/providers/property.rb b/providers/property.rb index cf27ee6..2ecd44e 100644 --- a/providers/property.rb +++ b/providers/property.rb @@ -17,8 +17,8 @@ # limitations under the License. # -require ::File.expand_path('../libraries/pacemaker/cib_object', - ::File.dirname(__FILE__)) +this_dir = ::File.dirname(__FILE__) +require ::File.expand_path('../libraries/pacemaker/cib_object', this_dir) action :create do name = new_resource.name diff --git a/spec/fixtures/colocation_constraint.rb b/spec/fixtures/colocation_constraint.rb index 7c88d29..74d99d3 100644 --- a/spec/fixtures/colocation_constraint.rb +++ b/spec/fixtures/colocation_constraint.rb @@ -1,5 +1,5 @@ require ::File.expand_path('../../libraries/pacemaker/constraint/colocation', - ::File.dirname(__FILE__)) + File.dirname(__FILE__)) module Chef::RSpec module Pacemaker diff --git a/spec/fixtures/keystone_primitive.rb b/spec/fixtures/keystone_primitive.rb index 8d25e53..fc6424d 100644 --- a/spec/fixtures/keystone_primitive.rb +++ b/spec/fixtures/keystone_primitive.rb @@ -1,5 +1,5 @@ require ::File.expand_path('../../libraries/pacemaker/resource/primitive', - ::File.dirname(__FILE__)) + File.dirname(__FILE__)) module Chef::RSpec module Pacemaker diff --git a/spec/fixtures/location_constraint.rb b/spec/fixtures/location_constraint.rb index faea088..f08159a 100644 --- a/spec/fixtures/location_constraint.rb +++ b/spec/fixtures/location_constraint.rb @@ -1,5 +1,5 @@ require ::File.expand_path('../../libraries/pacemaker/constraint/location', - ::File.dirname(__FILE__)) + File.dirname(__FILE__)) module Chef::RSpec module Pacemaker diff --git a/spec/helpers/cib_object.rb b/spec/helpers/cib_object.rb index f115018..17e9388 100644 --- a/spec/helpers/cib_object.rb +++ b/spec/helpers/cib_object.rb @@ -2,8 +2,8 @@ require 'mixlib/shellout' -require File.expand_path('../../libraries/pacemaker/cib_object', - File.dirname(__FILE__)) +this_dir = File.dirname(__FILE__) +require File.expand_path('../../libraries/pacemaker/cib_object', this_dir) module Chef::RSpec module Pacemaker diff --git a/spec/helpers/provider.rb b/spec/helpers/provider.rb index c2da081..2b6747f 100644 --- a/spec/helpers/provider.rb +++ b/spec/helpers/provider.rb @@ -1,6 +1,7 @@ # Shared code used to test providers of CIB objects -require File.expand_path('../helpers/cib_object', File.dirname(__FILE__)) +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/cib_object', this_dir) shared_context "a Pacemaker LWRP" do before(:each) do diff --git a/spec/helpers/runnable_resource.rb b/spec/helpers/runnable_resource.rb index 55b7069..c527e2d 100644 --- a/spec/helpers/runnable_resource.rb +++ b/spec/helpers/runnable_resource.rb @@ -3,7 +3,8 @@ # for primitives is runnable (since primitives can be started # and stopped) but constraints cannot. -require File.expand_path('../helpers/provider', File.dirname(__FILE__)) +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/provider', this_dir) shared_examples "a runnable resource" do |fixture| def expect_running(running) diff --git a/spec/libraries/pacemaker/cib_object_spec.rb b/spec/libraries/pacemaker/cib_object_spec.rb index 0362b3c..d27d2b9 100644 --- a/spec/libraries/pacemaker/cib_object_spec.rb +++ b/spec/libraries/pacemaker/cib_object_spec.rb @@ -1,8 +1,10 @@ -require 'spec_helper' require 'mixlib/shellout' -require File.expand_path('../../../libraries/pacemaker', File.dirname(__FILE__)) -require File.expand_path('../../fixtures/keystone_primitive', File.dirname(__FILE__)) +require 'spec_helper' + +this_dir = File.dirname(__FILE__) +require File.expand_path('../../../libraries/pacemaker', this_dir) +require File.expand_path('../../fixtures/keystone_primitive', this_dir) describe Pacemaker::CIBObject do diff --git a/spec/libraries/pacemaker/constraint/colocation_spec.rb b/spec/libraries/pacemaker/constraint/colocation_spec.rb index 51133e7..91e8256 100644 --- a/spec/libraries/pacemaker/constraint/colocation_spec.rb +++ b/spec/libraries/pacemaker/constraint/colocation_spec.rb @@ -1,8 +1,10 @@ require 'spec_helper' + +this_dir = File.dirname(__FILE__) require File.expand_path('../../../../libraries/pacemaker/constraint/colocation', - File.dirname(__FILE__)) -require File.expand_path('../../../fixtures/colocation_constraint', File.dirname(__FILE__)) -require File.expand_path('../../../helpers/cib_object', File.dirname(__FILE__)) + this_dir) +require File.expand_path('../../../fixtures/colocation_constraint', this_dir) +require File.expand_path('../../../helpers/cib_object', this_dir) describe Pacemaker::Constraint::Colocation do let(:fixture) { Chef::RSpec::Pacemaker::Config::COLOCATION_CONSTRAINT.dup } diff --git a/spec/libraries/pacemaker/constraint/location_spec.rb b/spec/libraries/pacemaker/constraint/location_spec.rb index c6a6572..6485ab4 100644 --- a/spec/libraries/pacemaker/constraint/location_spec.rb +++ b/spec/libraries/pacemaker/constraint/location_spec.rb @@ -1,8 +1,10 @@ require 'spec_helper' + +this_dir = File.dirname(__FILE__) require File.expand_path('../../../../libraries/pacemaker/constraint/location', - File.dirname(__FILE__)) -require File.expand_path('../../../fixtures/location_constraint', File.dirname(__FILE__)) -require File.expand_path('../../../helpers/cib_object', File.dirname(__FILE__)) + this_dir) +require File.expand_path('../../../fixtures/location_constraint', this_dir) +require File.expand_path('../../../helpers/cib_object', this_dir) describe Pacemaker::Constraint::Location do let(:fixture) { Chef::RSpec::Pacemaker::Config::LOCATION_CONSTRAINT.dup } diff --git a/spec/libraries/pacemaker/resource/clone_spec.rb b/spec/libraries/pacemaker/resource/clone_spec.rb index f328cca..802ddfc 100644 --- a/spec/libraries/pacemaker/resource/clone_spec.rb +++ b/spec/libraries/pacemaker/resource/clone_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -require File.expand_path('../../../../libraries/pacemaker/resource/clone', - File.dirname(__FILE__)) -require File.expand_path('../../../fixtures/clone_resource', File.dirname(__FILE__)) -require File.expand_path('../../../helpers/cib_object', File.dirname(__FILE__)) -require File.expand_path('../../../helpers/meta_examples', - File.dirname(__FILE__)) + +this_dir = File.dirname(__FILE__) +require File.expand_path('../../../../libraries/pacemaker/resource/clone', this_dir) +require File.expand_path('../../../fixtures/clone_resource', this_dir) +require File.expand_path('../../../helpers/cib_object', this_dir) +require File.expand_path('../../../helpers/meta_examples', this_dir) describe Pacemaker::Resource::Clone do let(:fixture) { Chef::RSpec::Pacemaker::Config::CLONE_RESOURCE.dup } diff --git a/spec/libraries/pacemaker/resource/group_spec.rb b/spec/libraries/pacemaker/resource/group_spec.rb index 2dc7eae..9119558 100644 --- a/spec/libraries/pacemaker/resource/group_spec.rb +++ b/spec/libraries/pacemaker/resource/group_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' + require File.expand_path('../../../../libraries/pacemaker/resource/group', File.dirname(__FILE__)) require File.expand_path('../../../fixtures/resource_group', File.dirname(__FILE__)) diff --git a/spec/libraries/pacemaker/resource/ms_spec.rb b/spec/libraries/pacemaker/resource/ms_spec.rb index cb1619f..155dd06 100644 --- a/spec/libraries/pacemaker/resource/ms_spec.rb +++ b/spec/libraries/pacemaker/resource/ms_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -require File.expand_path('../../../../libraries/pacemaker/resource/ms', - File.dirname(__FILE__)) -require File.expand_path('../../../fixtures/ms_resource', File.dirname(__FILE__)) -require File.expand_path('../../../helpers/cib_object', File.dirname(__FILE__)) -require File.expand_path('../../../helpers/meta_examples', - File.dirname(__FILE__)) + +this_dir = File.dirname(__FILE__) +require File.expand_path('../../../../libraries/pacemaker/resource/ms', this_dir) +require File.expand_path('../../../fixtures/ms_resource', this_dir) +require File.expand_path('../../../helpers/cib_object', this_dir) +require File.expand_path('../../../helpers/meta_examples', this_dir) describe Pacemaker::Resource::MasterSlave do let(:fixture) { Chef::RSpec::Pacemaker::Config::MS_RESOURCE.dup } diff --git a/spec/libraries/pacemaker/resource/primitive_spec.rb b/spec/libraries/pacemaker/resource/primitive_spec.rb index 1ec1fc7..364ac45 100644 --- a/spec/libraries/pacemaker/resource/primitive_spec.rb +++ b/spec/libraries/pacemaker/resource/primitive_spec.rb @@ -1,12 +1,11 @@ require 'spec_helper' + +this_dir = File.dirname(__FILE__) require File.expand_path('../../../../libraries/pacemaker/resource/primitive', - File.dirname(__FILE__)) -require File.expand_path('../../../fixtures/keystone_primitive', - File.dirname(__FILE__)) -require File.expand_path('../../../helpers/cib_object', - File.dirname(__FILE__)) -require File.expand_path('../../../helpers/meta_examples', - File.dirname(__FILE__)) + this_dir) +require File.expand_path('../../../fixtures/keystone_primitive', this_dir) +require File.expand_path('../../../helpers/cib_object', this_dir) +require File.expand_path('../../../helpers/meta_examples', this_dir) describe Pacemaker::Resource::Primitive do let(:fixture) { Chef::RSpec::Pacemaker::Config::KEYSTONE_PRIMITIVE.dup } diff --git a/spec/libraries/pacemaker/resource_spec.rb b/spec/libraries/pacemaker/resource_spec.rb index a49aa5f..6f82dbf 100644 --- a/spec/libraries/pacemaker/resource_spec.rb +++ b/spec/libraries/pacemaker/resource_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -require File.expand_path('../../../libraries/pacemaker/resource', - File.dirname(__FILE__)) -require File.expand_path('../../fixtures/keystone_primitive', - File.dirname(__FILE__)) + +this_dir = File.dirname(__FILE__) +require File.expand_path('../../../libraries/pacemaker/resource', this_dir) +require File.expand_path('../../fixtures/keystone_primitive', this_dir) describe Pacemaker::Resource do describe "#running?" do diff --git a/spec/providers/clone_spec.rb b/spec/providers/clone_spec.rb index 244ed4b..f4244fa 100644 --- a/spec/providers/clone_spec.rb +++ b/spec/providers/clone_spec.rb @@ -1,6 +1,8 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) -require File.expand_path('../helpers/runnable_resource', File.dirname(__FILE__)) -require File.expand_path('../fixtures/clone_resource', File.dirname(__FILE__)) +require 'spec_helper' + +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/runnable_resource', this_dir) +require File.expand_path('../fixtures/clone_resource', this_dir) describe "Chef::Provider::PacemakerClone" do # for use inside examples: diff --git a/spec/providers/colocation_spec.rb b/spec/providers/colocation_spec.rb index 381b14a..8a93116 100644 --- a/spec/providers/colocation_spec.rb +++ b/spec/providers/colocation_spec.rb @@ -1,6 +1,8 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) -require File.expand_path('../helpers/provider', File.dirname(__FILE__)) -require File.expand_path('../fixtures/colocation_constraint', File.dirname(__FILE__)) +require 'spec_helper' + +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/provider', this_dir) +require File.expand_path('../fixtures/colocation_constraint', this_dir) describe "Chef::Provider::PacemakerColocation" do # for use inside examples: diff --git a/spec/providers/group_spec.rb b/spec/providers/group_spec.rb index 20975da..9653454 100644 --- a/spec/providers/group_spec.rb +++ b/spec/providers/group_spec.rb @@ -1,6 +1,8 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) -require File.expand_path('../helpers/runnable_resource', File.dirname(__FILE__)) -require File.expand_path('../fixtures/resource_group', File.dirname(__FILE__)) +require 'spec_helper' + +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/runnable_resource', this_dir) +require File.expand_path('../fixtures/resource_group', this_dir) describe "Chef::Provider::PacemakerGroup" do # for use inside examples: diff --git a/spec/providers/location_spec.rb b/spec/providers/location_spec.rb index 9e6c958..705b115 100644 --- a/spec/providers/location_spec.rb +++ b/spec/providers/location_spec.rb @@ -1,6 +1,8 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) -require File.expand_path('../helpers/provider', File.dirname(__FILE__)) -require File.expand_path('../fixtures/location_constraint', File.dirname(__FILE__)) +require 'spec_helper' + +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/provider', this_dir) +require File.expand_path('../fixtures/location_constraint', this_dir) describe "Chef::Provider::PacemakerLocation" do # for use inside examples: diff --git a/spec/providers/ms_spec.rb b/spec/providers/ms_spec.rb index 0258ea8..582331e 100644 --- a/spec/providers/ms_spec.rb +++ b/spec/providers/ms_spec.rb @@ -1,6 +1,8 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) -require File.expand_path('../helpers/runnable_resource', File.dirname(__FILE__)) -require File.expand_path('../fixtures/ms_resource', File.dirname(__FILE__)) +require 'spec_helper' + +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/runnable_resource', this_dir) +require File.expand_path('../fixtures/ms_resource', this_dir) describe "Chef::Provider::PacemakerMs" do # for use inside examples: diff --git a/spec/providers/primitive_spec.rb b/spec/providers/primitive_spec.rb index 1add315..efa852e 100644 --- a/spec/providers/primitive_spec.rb +++ b/spec/providers/primitive_spec.rb @@ -1,6 +1,8 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) -require File.expand_path('../helpers/runnable_resource', File.dirname(__FILE__)) -require File.expand_path('../fixtures/keystone_primitive', File.dirname(__FILE__)) +require 'spec_helper' + +this_dir = File.dirname(__FILE__) +require File.expand_path('../helpers/runnable_resource', this_dir) +require File.expand_path('../fixtures/keystone_primitive', this_dir) describe "Chef::Provider::PacemakerPrimitive" do # for use inside examples: