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
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user