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
The following commit(s) were added to refs/heads/master by this push:
new ca109e1 More tests of Wunderbar methods
ca109e1 is described below
commit ca109e15bff51085e913bc1b47235030ba5a3f3a
Author: Sebb <[email protected]>
AuthorDate: Sun Jun 7 20:38:01 2020 +0100
More tests of Wunderbar methods
---
lib/spec/lib/svn_spec.rb | 15 ------------
lib/spec/lib/svn_wunderbar_spec.rb | 49 ++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 15 deletions(-)
diff --git a/lib/spec/lib/svn_spec.rb b/lib/spec/lib/svn_spec.rb
index 95935c3..0954c93 100644
--- a/lib/spec/lib/svn_spec.rb
+++ b/lib/spec/lib/svn_spec.rb
@@ -232,19 +232,4 @@ describe ASF::SVN do
end
end
- describe "ASF::SVN.svn_" do
- it "svn_('info') should return array" do
- # TODO: this is a bit of a hack
- _ = Wunderbar::JsonBuilder.new(Struct.new(:params).new({}))
- repo = File.join(ASF::SVN.svnurl('attic-xdocs'),'_template.xml')
- rc = ASF::SVN.svn_('info', repo, _)
- expect(rc).to be(0)
- # expect(res).to be(true).or be(false)
- expect(_.target?(Hash)).to be(true)
- hash = _.target? # TODO: another hack
- expect(hash['transcript'].class).to equal(Array)
- expect(hash['transcript'].include?('Name: _template.xml')).to be(true)
- end
- end
-
end
\ No newline at end of file
diff --git a/lib/spec/lib/svn_wunderbar_spec.rb
b/lib/spec/lib/svn_wunderbar_spec.rb
new file mode 100644
index 0000000..276bfba
--- /dev/null
+++ b/lib/spec/lib/svn_wunderbar_spec.rb
@@ -0,0 +1,49 @@
+# encoding: utf-8
+# frozen_string_literal: true
+
+require 'spec_helper'
+require 'whimsy/asf'
+require 'wunderbar'
+
+describe "ASF::SVN.svn_" do
+ it "svn_('info') should return array with Name:" do
+ repo = File.join(ASF::SVN.svnurl('attic-xdocs'),'_template.xml')
+
+ rc, out = _json do |_|
+ ASF::SVN.svn_('info', repo, _)
+ end
+
+ expect(rc).to be(0)
+ expect(out['transcript'].class).to equal(Array)
+ expect(out['transcript'].include?('Name: _template.xml')).to be(true)
+ end
+ it "svn_('info') should return array" do
+ repo = File.join(ASF::SVN.svnurl('attic-xdocs'),'_template.xml')
+
+ rc, out = _json do |_|
+ ASF::SVN.svn_('info', repo, _, {dryrun: true})
+ end
+
+ expect(rc).to be(0)
+ expect(out['transcript'].class).to equal(Array)
+ exp = ["svn", "info",
"https://svn.apache.org/repos/asf/attic/site/xdocs/projects/_template.xml",
"--non-interactive"]
+ expect(out['transcript'][1]).to eq(exp.inspect)
+ end
+end
+
+describe "ASF::SVN.update" do
+ it "update('_template.xml') should return array" do
+ repo = File.join(ASF::SVN.svnurl('attic-xdocs'),'_template.xml')
+
+ rc, out = _json do |_|
+ ASF::SVN.update(repo, "Dummy message", ENV_.new, _, {dryrun:true}) do
|tmpdir, contents|
+ contents+"test\n"
+ end
+ end
+
+ expect(rc).to be(nil) # update does not return a value
+ expect(out['transcript'].class).to equal(Array)
+ # could look for "Checked out revision" and "Update to revision"
+ expect(out['transcript'][-1]).to eql('+test') #
+ end
+end