spec/spec_helper.rb in dm-serializer-0.9.11 vs spec/spec_helper.rb in dm-serializer-0.10.0
- old
+ new
@@ -1,13 +1,20 @@
-require 'pathname'
require 'rubygems'
-gem 'dm-core', '0.9.11'
+# use local dm-core if running from a typical dev checkout.
+lib = File.join('..', '..', 'dm-core', 'lib')
+$LOAD_PATH.unshift(lib) if File.directory?(lib)
require 'dm-core'
-spec_dir_path = Pathname(__FILE__).dirname.expand_path
-$LOAD_PATH.unshift(spec_dir_path.parent + 'lib/')
+# use local dm-validations if running from dm-more directly
+lib = File.join('..', 'dm-validations', 'lib')
+$LOAD_PATH.unshift(lib) if File.directory?(lib)
+require 'dm-validations'
+
+# Support running specs with 'rake spec' and 'spec'
+$LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
+
require 'dm-serializer'
def load_driver(name, default_uri)
return false if ENV['ADAPTER'] != name.to_s
@@ -32,11 +39,11 @@
def test(object, *args)
deserialize(object.send(method_name, *args))
end
end
-require spec_dir_path + 'lib/serialization_method_shared_spec'
+require 'spec/lib/serialization_method_shared_spec'
# require fixture resources
-Dir[(spec_dir_path + "fixtures/*.rb").to_s].each do |fixture_file|
+Dir.glob("spec/fixtures/*.rb").each do |fixture_file|
require fixture_file
end