This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit 909ec3f0b86511d2c59e11c7a8eddd5b9bc6ae76 Author: Sebb <[email protected]> AuthorDate: Mon Aug 16 15:56:52 2021 +0100 Fix test TODO at last --- lib/Rakefile | 15 +++++++++++++++ lib/spec/lib/svn_spec.rb | 20 ++++++++------------ lib/spec/spec_helper.rb | 1 + 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/Rakefile b/lib/Rakefile index eb2717f..74f7b17 100644 --- a/lib/Rakefile +++ b/lib/Rakefile @@ -2,3 +2,18 @@ require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task :default => :spec task :test => :spec +task :spec => :work +task :work => ['test/svn/incubator-podlings'] + +file 'test/work/repository' do + unless File.exist? 'test/work/repository/format' + system 'svnadmin create test/work/repository' + end +end + +file 'test/svn/incubator-podlings' => 'test/work/repository' do + Dir.chdir('test') do + rm_rf 'svn/incubator-podlings' if File.exist? 'svn/incubator-podlings' + system "svn co file:///#{Dir.pwd}/work/repository svn/incubator-podlings" + end +end diff --git a/lib/spec/lib/svn_spec.rb b/lib/spec/lib/svn_spec.rb index a2bb527..0ba11d6 100644 --- a/lib/spec/lib/svn_spec.rb +++ b/lib/spec/lib/svn_spec.rb @@ -254,32 +254,28 @@ describe ASF::SVN do end it "svn('info', [path]) should return 'Name: path'" do repo = File.join(ASF::SVN.svnurl('attic-xdocs'),'_template.xml') - out, err = ASF::SVN.svn('info',[repo]) + out, _err = ASF::SVN.svn('info',[repo]) expect(out).to match(/^Name: _template.xml$/) end it "svn('info', [path1, path2], {item: kind'}) should return 'file ...'" do path1 = File.join(ASF::SVN.svnurl('attic-xdocs'),'_template.xml') path2 = File.join(ASF::SVN.svnurl('attic-xdocs'),'jakarta.xml') - out, err = ASF::SVN.svn('info',[path1, path2], {item: 'kind'}) + out, _err = ASF::SVN.svn('info',[path1, path2], {item: 'kind'}) expect(out).to match(/^file +https:/) end it "svn() should honour :chdir option" do - begin # Hack to avoid Travis fail; TODO ensure there is a suitable SVN checkout for the test - pods = ASF::SVN['incubator-podlings'] - if pods - out, err = ASF::SVN.svn('info', '.', {chdir: pods}) - expect(err).to eq(nil) - expect(out).to match(/^URL: /) - end - rescue Exception => e - puts e + pods = ASF::SVN['incubator-podlings'] # arbitrary, but must be set up in Rakefile and spec_helper + if pods + out, err = ASF::SVN.svn('info', '.', {chdir: pods}) + expect(err).to eq(nil) + expect(out).to match(/^URL: /) end end # TODO fix these tests it "svn(['help'], 'help') should return some help" do - out, err = ASF::SVN.svn(['help'],'help') + out, _err = ASF::SVN.svn(['help'],'help') expect(out).to match(/Describe the usage of this program or its subcommands/) end # it "svn(['help', '-v'], 'help') should return Global help" do diff --git a/lib/spec/spec_helper.rb b/lib/spec/spec_helper.rb index 634d8c3..a1b0138 100644 --- a/lib/spec/spec_helper.rb +++ b/lib/spec/spec_helper.rb @@ -16,6 +16,7 @@ if ENV['RAKE_TEST'] == 'TRUE' or not (ASF::SVN.find('apmail_bin') and ASF::SVN.f ASF::SVN['board'] = File.expand_path('../test/svn/board', __dir__) ASF::SVN[SAMPLE_SVN_NAME] = File.expand_path('../test/svn/minutes', __dir__) ASF::Config[:subscriptions] = File.expand_path('../test/subscriptions', __dir__) + ASF::SVN['incubator-podlings'] = File.expand_path('../test/svn/incubator-podlings', __dir__) else TEST_DATA = false end
