[DRE-commits] [ruby-mathml] 01/02: Fix tests for rspec 3.3.0

Lucas Moura lucasmoura-guest at moszumanska.debian.org
Wed Mar 2 13:08:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

lucasmoura-guest pushed a commit to branch master
in repository ruby-mathml.

commit 1bced00413b4ca8e6548805b7b6603cf60e8da24
Author: Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>
Date:   Wed Mar 2 08:45:06 2016 -0300

    Fix tests for rspec 3.3.0
---
 debian/changelog                           |  9 +++++
 debian/patches/fix_custom_matcher.patch    | 56 +++++++++++++++++++++++++++
 debian/patches/fix_test_lib_import.patch   | 27 +++++++++++++
 debian/patches/fix_tests_for_ruby2.3.patch | 61 ++++++++++++++++++++++++++++++
 debian/patches/series                      |  3 ++
 5 files changed, 156 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b29fe7d..0af6aaf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+ruby-mathml (0.14-4) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Fix tests for rspec version 3.3.0.
+  * Fix custom matcher definition for rspec version 3.3.0.
+  * Fix test require for autopkgtest.
+
+ -- Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>  Wed, 02 Mar 2016 09:10:20 -0300
+
 ruby-mathml (0.14-3) unstable; urgency=medium
 
   * Bump standard version: 3.9.6 (not changed)
diff --git a/debian/patches/fix_custom_matcher.patch b/debian/patches/fix_custom_matcher.patch
new file mode 100644
index 0000000..1a030ef
--- /dev/null
+++ b/debian/patches/fix_custom_matcher.patch
@@ -0,0 +1,56 @@
+Description: Fix custom matcher for new rspec version 3.3.0.
+ The way the raise_parse_error custom matcher was defined does not
+ follow the new rspec guidelines, therefore, it was necessary to
+ rewrite it in order for the tests to pass.
+
+ This fix will not be sent to the upstream, because the tool being used
+ to hold the source code doesn't seem to allow merge requests.
+
+Author: Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>
+Last-updated: 2016-03-02
+Forwarded: not-needed
+Bug: not-needed
+
+Index: ruby-mathml/spec/util.rb
+===================================================================
+--- ruby-mathml.orig/spec/util.rb	2016-03-01 17:05:48.291538966 -0300
++++ ruby-mathml/spec/util.rb	2016-03-02 08:43:11.503329737 -0300
+@@ -2,24 +2,21 @@
+ module MathML
+ 	module Spec
+ 		module Util
+-			def raise_parse_error(message, done, rest)
+-				begin
+-					matcher_class = RSpec::Matchers::DSL::Matcher
+-				rescue NameError
+-					matcher_class = RSpec::Matchers::Matcher
+-				end
+-				matcher_class.new(:raise_parse_error){
+-					match do |given|
+-						begin
+-							given.call
+-							@error = nil
+-						rescue Exception
+-							@error = $!
+-						end
+-						@error.is_a?(MathML::LaTeX::ParseError) &&
+-							[@error.message, @error.done, @error.rest] == [message, done, rest]
++		    RSpec::Matchers.define :raise_parse_error do |*attributes|
++		        match do |given|
++                    message = attributes[0]
++                    done = attributes[1]
++                    rest = attributes[2]
++
++				    begin
++						given.call
++						@error = nil
++					rescue Exception
++						@error = $!
+ 					end
+-				}.for_expected
++					@error.is_a?(MathML::LaTeX::ParseError) &&
++						[@error.message, @error.done, @error.rest] == [message, done, rest]
++				end
+ 			end
+ 
+ 			def new_parser
diff --git a/debian/patches/fix_test_lib_import.patch b/debian/patches/fix_test_lib_import.patch
new file mode 100644
index 0000000..9d6382a
--- /dev/null
+++ b/debian/patches/fix_test_lib_import.patch
@@ -0,0 +1,27 @@
+Description: Removing relative import from spec file.
+ When running adt-run, the lib dir will not be found and the test
+ will fail. Once the package is installed, there is not need for
+ a relative require anymore. Therefore, to fix this issue, it was
+ necessary just to remove the "lib" part of the require.
+
+ This fix will not be sent to the upstream, because the tool being used
+ to hold the source code doesn't seem to allow merge requests.
+
+Author: Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>
+Last-updated: 2016-03-02
+Forwarded: not-needed
+Bug: not-needed
+
+Index: ruby-mathml/spec/math_ml_spec.rb
+===================================================================
+--- ruby-mathml.orig/spec/math_ml_spec.rb	2016-03-01 17:05:48.291538966 -0300
++++ ruby-mathml/spec/math_ml_spec.rb	2016-03-02 08:52:07.485031013 -0300
+@@ -2,7 +2,7 @@
+ 
+ describe MathML do
+ 	it "should not raise error when math_ml.rb is required twice" do
+-		if require("lib/math_ml")
++		if require("math_ml")
+ 			lambda{MathML::LaTeX::Parser.new}.should_not raise_error
+ 		end
+ 	end
diff --git a/debian/patches/fix_tests_for_ruby2.3.patch b/debian/patches/fix_tests_for_ruby2.3.patch
new file mode 100644
index 0000000..a35af58
--- /dev/null
+++ b/debian/patches/fix_tests_for_ruby2.3.patch
@@ -0,0 +1,61 @@
+Description: Fix tests for new rspec version 3.3.0
+ In order for the tests to run on newer versions of rspec, same methods needs to
+ be updated, such as be_false to be_falsey and be_true to be_truthy.
+
+ This fix will not be sent to the upstream, because the tool being used
+ to hold the source code doesn't seem to allow merge requests.
+
+Author: Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>
+Last-updated: 2016-03-02
+Forwarded: not-needed
+Bugs: not needed
+
+Index: ruby-mathml/spec/math_ml/element_spec.rb
+===================================================================
+--- ruby-mathml.orig/spec/math_ml/element_spec.rb	2016-03-01 17:05:48.291538966 -0300
++++ ruby-mathml/spec/math_ml/element_spec.rb	2016-03-01 17:17:03.892949541 -0300
+@@ -6,7 +6,7 @@
+ 		e = MathML::Element.new("test")
+ 		r = e.as_display_style
+ 		r.should equal(e)
+-		e.display_style.should be_true
++		e.display_style.should be_truthy
+ 	end
+ 
+ 	it "#pop" do
+Index: ruby-mathml/spec/math_ml/latex/parser_spec.rb
+===================================================================
+--- ruby-mathml.orig/spec/math_ml/latex/parser_spec.rb	2016-03-01 17:05:48.291538966 -0300
++++ ruby-mathml/spec/math_ml/latex/parser_spec.rb	2016-03-01 17:09:44.172056895 -0300
+@@ -551,27 +551,27 @@
+ 			end
+ 
+ 			it "character entity reference version by default" do
+-				require("math_ml").should be_true
++				require("math_ml").should be_truthy
+ 				MathML::LaTeX::Parser.new.symbol_table.should == MathML::Symbol::EntityReference
+ 			end
+ 
+ 			describe "character entity reference version when set by requiring" do
+ 				it do
+-					require("math_ml/symbol/entity_reference").should be_true
++					require("math_ml/symbol/entity_reference").should be_truthy
+ 					MathML::LaTeX::Parser.new.symbol_table.should == MathML::Symbol::EntityReference
+ 				end
+ 			end
+ 
+ 			describe "utf8 version when set by requiring" do
+ 				it do
+-					require("math_ml/symbol/utf8").should be_true
++					require("math_ml/symbol/utf8").should be_truthy
+ 					MathML::LaTeX::Parser.new.symbol_table.should == MathML::Symbol::UTF8
+ 				end
+ 			end
+ 
+ 			describe "numeric character reference version when set by requiring" do
+ 				it do
+-					require("math_ml/symbol/character_reference").should be_true
++					require("math_ml/symbol/character_reference").should be_truthy
+ 					MathML::LaTeX::Parser.new.symbol_table.should == MathML::Symbol::CharacterReference
+ 				end
+ 			end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..ab9e905
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+fix_test_lib_import.patch
+fix_custom_matcher.patch
+fix_tests_for_ruby2.3.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-mathml.git



More information about the Pkg-ruby-extras-commits mailing list