On Thu, Sep 02, 2021 at 03:25:51AM +0200, Daniel Leidert wrote: > Hi there, > > I require some help. The tests in ruby-jekyll-data [1] require the test-theme, > which is in test/fixtures/test-theme. But the tests cannot find it. > > In essence the tests call Jekyll::Site.new and set 'theme'=>'test-theme'. But > I > don't see any option to pass the directoy for this theme to Site.new as well. > And all my attempts to make the location aware by trying to add the path to > LOAD_PATH or GEM_PATH have been failed. IMHO upstream sets the locations up > via > the Gemfile when running "bundle exec rake". Any idea? > > [1] https://salsa.debian.org/ruby-team/ruby-jekyll-data
You can use a custom Gemfile, plus an extra option to the test run command. See the attached patch.
From 7ee664cb3a6852880b166679b35fbf072ce06d04 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro <terce...@debian.org> Date: Fri, 3 Sep 2021 11:44:53 -0300 Subject: [PATCH] Ensure tests find local gems used for testing This allows running the tests through the regular Debian Ruby testing machinery, while otherwise it would only work via `bundle exec rake`. Load a custom Gemfile under debian/ that loads only the packages needed for testing, and without any version constraint, plus the custom gems provided as test fixtures. --- debian/Gemfile | 13 +++++++++++++ debian/ruby-tests.rake | 3 +++ debian/rules | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 debian/Gemfile diff --git a/debian/Gemfile b/debian/Gemfile new file mode 100644 index 0000000..552a8a7 --- /dev/null +++ b/debian/Gemfile @@ -0,0 +1,13 @@ +source "https://rubygems.org" + +gem "jekyll" +gem "jekyll-data" +gem "rake" +gem "rspec-mocks" +gem "shoulda" +gem "kramdown-parser-gfm" + +gem "another-test-plugin", :path => File.expand_path("../test/fixtures/another-test-plugin", __dir__) +gem "test-plugin", :path => File.expand_path("../test/fixtures/test-plugin", __dir__) +gem "test-theme", :path => File.expand_path("../test/fixtures/test-theme", __dir__) + diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake index 63f3fd6..4bfcd34 100644 --- a/debian/ruby-tests.rake +++ b/debian/ruby-tests.rake @@ -1,6 +1,9 @@ require 'gem2deb/rake/testtask' +ENV["BUNDLE_GEMFILE"] = File.expand_path("Gemfile", __dir__) + Gem2Deb::Rake::TestTask.new do |t| t.libs = ['test'] + t.ruby_opts << "-rbundler/setup" t.test_files = FileList['test/**/*_test.rb'] + FileList['test/**/test_*.rb'] end diff --git a/debian/rules b/debian/rules index ea47d29..742234d 100755 --- a/debian/rules +++ b/debian/rules @@ -6,3 +6,7 @@ export DH_RUBY = --gem-install %: dh $@ --buildsystem=ruby --with ruby + +override_dh_auto_clean: + dh_auto_clean + $(RM) debian/Gemfile.lock -- 2.33.0
signature.asc
Description: PGP signature