Skip to content

Commit

Permalink
simplify how we test with libxml-ruby loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Feb 9, 2017
1 parent 00b81db commit db035e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
1 change: 1 addition & 0 deletions Gemfile-libxml-ruby
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = "1"
gem "libxml-ruby", :platform => :mri, :require => false
eval_gemfile File.join(File.dirname(ENV['BUNDLE_GEMFILE']),"Gemfile")
20 changes: 0 additions & 20 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -310,26 +310,6 @@ if Hoe.plugins.include?(:debugging)
end
end

desc "run tests with libxml-ruby loaded"
task "test:libxml-ruby" do
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = "1"
warn "#{__FILE__}:#{__LINE__}: --- running tests with libxml-ruby loaded ---"
Rake::Task[:test].execute
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = nil
end

Rake::Task["test:libxml-ruby"].prerequisites << :compile

desc "run tests under valgrind with libxml-ruby loaded"
task "test:valgrind:libxml-ruby" do
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = "1"
warn "#{__FILE__}:#{__LINE__}: --- running tests with libxml-ruby loaded ---"
Rake::Task["test:valgrind"].execute
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = nil
end

Rake::Task["test:valgrind:libxml-ruby"].prerequisites << :compile

require 'concourse'
Concourse.new("nokogiri").create_tasks!

Expand Down
10 changes: 10 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@
require 'pp'

require 'nokogiri'

if ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY']
#
# if you'd like to test with the libxml-ruby gem loaded, it's
# recommended that you set
#
# BUNDLE_GEMFILE=Gemfile-libxml-ruby
#
# which will a) bundle that gem, and b) set the appropriate env var to
# trigger this block
#
require 'libxml'
warn "#{__FILE__}:#{__LINE__}: loaded libxml-ruby '#{LibXML::XML::VERSION}'"
end
Expand Down

0 comments on commit db035e7

Please sign in to comment.