spec/spec_helper.rb in axiom-0.1.0 vs spec/spec_helper.rb in axiom-0.1.1
- old
+ new
@@ -1,46 +1,54 @@
# encoding: utf-8
-require 'backports'
-require 'backports/basic_object' unless defined?(::BasicObject)
-require 'devtools/spec_helper'
-require 'ice_nine'
-
if ENV['COVERAGE'] == 'true'
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
- command_name 'spec:unit'
- add_filter 'config'
- add_filter 'spec'
+ command_name 'spec:unit'
+
+ add_filter 'config'
+ add_filter 'spec'
+ add_filter 'vendor'
+
minimum_coverage 100
end
end
+require 'devtools/spec_helper'
require 'axiom'
include Axiom
-# require spec support files and shared behavior
-Dir[File.expand_path('../{support,shared}/**/*.rb', __FILE__)].each do |file|
- require file
-end
-
RSpec.configure do |config|
+ config.expect_with :rspec do |expect_with|
+ expect_with.syntax = [:expect, :should]
+ end
# Record the original Attribute descendants
config.before do
- @original_descendants = Attribute.descendants.dup
+ @original_attribute_descendants = Attribute.descendants.dup
end
# Reset the Attribute descendants
config.after do
- Attribute.descendants.replace(@original_descendants)
+ Attribute.descendants.replace(@original_attribute_descendants)
end
+ # Record the original Type descendants
+ config.before do
+ Axiom::Types.finalize
+ @original_type_descendants = Axiom::Types::Type.descendants.dup
+ end
+
+ # Reset the Type descendants
+ config.after do
+ Axiom::Types::Type.descendants.replace(@original_type_descendants)
+ Axiom::Types.instance_variable_get(:@inference_cache).clear
+ end
end