test/test_helper.rb in inch-0.5.0.rc5 vs test/test_helper.rb in inch-0.5.0.rc6
- old
+ new
@@ -1,14 +1,14 @@
-require "simplecov"
+require 'simplecov'
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-require "minitest/autorun"
-require "bundler"
+require 'minitest/autorun'
+require 'bundler'
Bundler.require
-require "inch"
-require "inch/cli"
+require 'inch'
+require 'inch/cli'
def assert_roles(object, expected, unexpected)
roles = object.roles.map(&:class)
unexpected.each do |role|
refute roles.include?(role), "Should not assign #{role}"
@@ -27,11 +27,11 @@
r.class == role_class && (object_name.nil? || r.object.name == object_name)
end
end
def fixture_path(language, name)
- File.join(File.dirname(__FILE__), "fixtures", language.to_s, name.to_s)
+ File.join(File.dirname(__FILE__), 'fixtures', language.to_s, name.to_s)
end
module Inch
module Test
class << self
@@ -41,15 +41,23 @@
Inch::Codebase::Proxy.new language, object_provider(language, name)
end
def object_provider(language, name)
self.object_providers ||= {}
- self.object_providers[name] ||= ::Inch::CodeObject::Provider.parse(fixture_path(language, name))
+ self.object_providers[name] ||=
+ ::Inch::CodeObject::Provider.parse(fixture_path(language, name))
end
end
end
end
-def test_codebase(name)
- codebase = Inch::Test.codebase(:ruby, name)
+def test_codebase(language, name)
+ codebase = Inch::Test.codebase(language, name)
codebase
+end
+
+def fresh_codebase(language, name, read_dump_file = nil)
+ dir = fixture_path(language, name)
+ config = Inch::Config.for(language, dir).codebase
+ config.read_dump_file = read_dump_file
+ ::Inch::Codebase.parse(dir, config)
end