test/helper.rb in nanoc-3.6.9 vs test/helper.rb in nanoc-3.6.10
- old
+ new
@@ -2,19 +2,15 @@
# Set up gem loading (necessary for cri dependency)
require File.dirname(__FILE__) + '/gem_loader.rb'
# Load unit testing stuff
-begin
- require 'minitest/unit'
- require 'minitest/spec'
- require 'minitest/mock'
- require 'mocha/setup'
-rescue => e
- $stderr.puts "To run the nanoc unit tests, you need minitest and mocha."
- raise e
-end
+require 'minitest/unit'
+require 'minitest/spec'
+require 'minitest/mock'
+require 'mocha/setup'
+require 'vcr'
# Load nanoc
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
require 'nanoc'
require 'nanoc/cli'
@@ -22,15 +18,29 @@
# Load miscellaneous requirements
require 'tmpdir'
require 'stringio'
+VCR.configure do |c|
+ c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
+ c.hook_into :webmock
+end
+
module Nanoc::TestHelpers
LIB_DIR = File.expand_path(File.dirname(__FILE__) + '/../lib')
+ def disable_nokogiri?
+ ENV.key?('DISABLE_NOKOGIRI')
+ end
+
def if_have(*libs)
libs.each do |lib|
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' && lib == 'nokogiri' && disable_nokogiri?
+ skip "Pure Java Nokogiri has issues that cause problems with nanoc (see https://github.com/nanoc/nanoc/pull/422) -- run without DISABLE_NOKOGIRI to enable Nokogiri tests"
+ return
+ end
+
begin
require lib
rescue LoadError
skip "requiring #{lib} failed"
return