
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
15 lines
464 B
Ruby
15 lines
464 B
Ruby
require ::File.expand_path('../../libraries/pacemaker/constraint/colocation',
|
|
File.dirname(__FILE__))
|
|
|
|
module Chef::RSpec
|
|
module Pacemaker
|
|
module Config
|
|
COLOCATION_CONSTRAINT = \
|
|
::Pacemaker::Constraint::Colocation.new('colocation1')
|
|
COLOCATION_CONSTRAINT.score = 'inf'
|
|
COLOCATION_CONSTRAINT.resources = ['foo']
|
|
COLOCATION_CONSTRAINT_DEFINITION = 'colocation colocation1 inf: foo'
|
|
end
|
|
end
|
|
end
|