[DRE-commits] [ruby-hashdiff] 02/03: Port tests to rspec 3

Antonio Terceiro terceiro at moszumanska.debian.org
Fri Jan 22 14:23:07 UTC 2016


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

terceiro pushed a commit to branch master
in repository ruby-hashdiff.

commit 10fbcaad237be15ef0508219066e2f04f81fdbfa
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Fri Jan 22 12:15:07 2016 -0200

    Port tests to rspec 3
---
 debian/patches/0001-Port-tests-to-rspec-3.patch | 89 +++++++++++++++++++++++++
 debian/patches/series                           |  1 +
 2 files changed, 90 insertions(+)

diff --git a/debian/patches/0001-Port-tests-to-rspec-3.patch b/debian/patches/0001-Port-tests-to-rspec-3.patch
new file mode 100644
index 0000000..fb18633
--- /dev/null
+++ b/debian/patches/0001-Port-tests-to-rspec-3.patch
@@ -0,0 +1,89 @@
+From: Antonio Terceiro <terceiro at debian.org>
+Date: Fri, 22 Jan 2016 12:14:40 -0200
+Subject: Port tests to rspec 3
+
+---
+ spec/hashdiff/util_spec.rb | 34 +++++++++++++++++-----------------
+ 1 file changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/spec/hashdiff/util_spec.rb b/spec/hashdiff/util_spec.rb
+index bce861c..9130686 100644
+--- a/spec/hashdiff/util_spec.rb
++++ b/spec/hashdiff/util_spec.rb
+@@ -14,59 +14,59 @@ describe HashDiff do
+   it "should be able to tell similiar hash" do
+     a = {'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5}
+     b = {'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5}
+-    HashDiff.similar?(a, b).should be_true
+-    HashDiff.similar?(a, b, :similarity => 1).should be_false
++    HashDiff.similar?(a, b).should be true
++    HashDiff.similar?(a, b, :similarity => 1).should be false
+   end
+ 
+   it "should be able to tell similiar hash with values within tolerance" do
+     a = {'a' => 1.5, 'b' => 2.25, 'c' => 3, 'd' => 4, 'e' => 5}
+     b = {'a' => 1.503, 'b' => 2.22, 'c' => 3, 'e' => 5}
+-    HashDiff.similar?(a, b, :numeric_tolerance => 0.05).should be_true
+-    HashDiff.similar?(a, b).should be_false
++    HashDiff.similar?(a, b, :numeric_tolerance => 0.05).should be true
++    HashDiff.similar?(a, b).should be false
+   end
+ 
+   it "should be able to tell numbers and strings" do
+-    HashDiff.similar?(1, 2).should be_false
+-    HashDiff.similar?("a", "b").should be_false
+-    HashDiff.similar?("a", [1, 2, 3]).should be_false
+-    HashDiff.similar?(1, {'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5}).should be_false
++    HashDiff.similar?(1, 2).should be false
++    HashDiff.similar?("a", "b").should be false
++    HashDiff.similar?("a", [1, 2, 3]).should be false
++    HashDiff.similar?(1, {'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5}).should be false
+   end
+ 
+   it "should be able to tell true when similarity == 0.5" do
+     a = {"value" => "New1", "onclick" => "CreateNewDoc()"}
+     b = {"value" => "New", "onclick" => "CreateNewDoc()"}
+ 
+-    HashDiff.similar?(a, b, :similarity => 0.5).should be_true
++    HashDiff.similar?(a, b, :similarity => 0.5).should be true
+   end
+ 
+   it "should be able to tell false when similarity == 0.5" do
+     a = {"value" => "New1", "onclick" => "open()"}
+     b = {"value" => "New", "onclick" => "CreateNewDoc()"}
+ 
+-    HashDiff.similar?(a, b, :similarity => 0.5).should be_false
++    HashDiff.similar?(a, b, :similarity => 0.5).should be false
+   end
+ 
+   describe '.compare_values' do
+     it "should compare numeric values exactly when no tolerance" do
+-      expect(HashDiff.compare_values(10.004, 10.003)).to be_false
++      expect(HashDiff.compare_values(10.004, 10.003)).to be false
+     end
+ 
+     it "should allow tolerance with numeric values" do
+-      expect(HashDiff.compare_values(10.004, 10.003, :numeric_tolerance => 0.01)).to be_true
++      expect(HashDiff.compare_values(10.004, 10.003, :numeric_tolerance => 0.01)).to be true
+     end
+ 
+     it "should compare other objects with or without tolerance" do
+-      expect(HashDiff.compare_values('hats', 'ninjas')).to be_false
+-      expect(HashDiff.compare_values('hats', 'ninjas', :numeric_tolerance => 0.01)).to be_false
+-      expect(HashDiff.compare_values('horse', 'horse')).to be_true
++      expect(HashDiff.compare_values('hats', 'ninjas')).to be false
++      expect(HashDiff.compare_values('hats', 'ninjas', :numeric_tolerance => 0.01)).to be false
++      expect(HashDiff.compare_values('horse', 'horse')).to be true
+     end
+ 
+     it 'should compare strings exactly by default' do
+-      expect(HashDiff.compare_values(' horse', 'horse')).to be_false
++      expect(HashDiff.compare_values(' horse', 'horse')).to be false
+     end
+ 
+     it 'should strip strings before comparing when requested' do
+-      expect(HashDiff.compare_values(' horse', 'horse', :strip => true)).to be_true
++      expect(HashDiff.compare_values(' horse', 'horse', :strip => true)).to be true
+     end
+   end
+ end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..13e8bcc
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Port-tests-to-rspec-3.patch

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



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