spec/spec_helper.rb in yard-0.8.7.6 vs spec/spec_helper.rb in yard-0.9.0

- old
+ new

@@ -30,11 +30,11 @@ begin require 'ripper'; rescue LoadError; end HAVE_RIPPER = defined?(::Ripper) && !ENV['LEGACY'] ? true : false LEGACY_PARSER = !HAVE_RIPPER class YARD::Parser::SourceParser - def self.parser_type; :ruby18 end + def self.parser_type; @parser_type == :ruby ? :ruby18 : @parser_type end end if ENV['LEGACY'] end NAMED_OPTIONAL_ARGUMENTS = RUBY_VERSION >= '2.1.0' @@ -99,11 +99,11 @@ # Run examples obj.tags(:example).each do |exs| exs.text.split(/\n/).each do |ex| begin hash = eval("{ #{ex} }") - hash.keys.first.should == hash.values.first + expect(hash.keys.first).to eq hash.values.first rescue => e raise e, "#{e.message}\nInvalid spec example in #{objname}:\n\n\t#{ex}\n" end end end @@ -123,8 +123,17 @@ end end if ENV['TM_APP_PATH'] RSpec.configure do |config| config.before(:each) { log.io = StringIO.new } + + # isolate environment of each test + # any other global settings which might be modified by a test should also + # be saved and restored here + config.around(:each) do |example| + saved_level = log.level + example.run + log.level = saved_level + end end include YARD