test/test_helper.rb in sass-3.3.0.rc.1 vs test/test_helper.rb in sass-3.3.0.rc.2

- old
+ new

@@ -6,10 +6,12 @@ require 'sass' require 'mathn' if ENV['MATHN'] == 'true' Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED) +Sass.tests_running = true + if defined?(Encoding) $-w, w = false, $-w Encoding.default_external = 'UTF-8' $-w = w end @@ -79,7 +81,21 @@ yield rescue Sass::SyntaxError => e assert_equal(line, e.sass_line) else flunk "Expected exception on line #{line}, none raised" + end +end + +module PublicApiLinter + def lint_api(api_class, duck_type_class) + define_method :test_lint_instance do + assert lint_instance.is_a?(duck_type_class) + end + api_class.instance_methods.each do |meth| + define_method :"test_has_#{meth}" do + assert lint_instance.respond_to?(meth), + "#{duck_type_class.name} does not implement #{meth}" + end + end end end