[DRE-commits] [ruby-nokogiri-diff] 01/02: Port tests to Rspec3

Balasankar C balasankarc-guest at moszumanska.debian.org
Sat Nov 28 12:30:51 UTC 2015


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

balasankarc-guest pushed a commit to branch master
in repository ruby-nokogiri-diff.

commit bc09b4d93e45044fbdfb1aef84c8420a1cd78372
Author: Balasankar C <balasankarc at autistici.org>
Date:   Sat Nov 28 18:00:20 2015 +0530

    Port tests to Rspec3
---
 debian/patches/rspec3-port.patch | 444 +++++++++++++++++++++++++++++++++++++++
 debian/patches/series            |   1 +
 2 files changed, 445 insertions(+)

diff --git a/debian/patches/rspec3-port.patch b/debian/patches/rspec3-port.patch
new file mode 100644
index 0000000..19e3b9a
--- /dev/null
+++ b/debian/patches/rspec3-port.patch
@@ -0,0 +1,444 @@
+Description: Port tests to RSpec3 and tweak gemspec file
+ Port the tests to follow RSpec 3 syntax. Also tweak gemspec and metadata file
+ change the requirement on RSpec to ~> 3.0.
+Author: Balasankar C <balasankarc at autistici.org>
+Bug: https://github.com/postmodern/nokogiri-diff/pull/7
+Last-Update: 2015-11-28
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/gemspec.yml
++++ b/gemspec.yml
+@@ -18,5 +18,5 @@
+ 
+ development_dependencies:
+   rubygems-tasks: ~> 0.1
+-  rspec: ~> 2.4
++  rspec: ~> 3.0
+   yard: ~> 0.7
+--- a/spec/diff_spec.rb
++++ b/spec/diff_spec.rb
+@@ -21,197 +21,197 @@
+   let(:removed_attr)    { Nokogiri::XML('<div><p>one</p></div>') }
+ 
+   it "should add #diff to Nokogiri::XML::Docuemnt" do
+-    doc.should respond_to(:diff)
++    expect(doc).to respond_to(:diff)
+   end
+ 
+   it "should add #diff to Nokogiri::XML::Element" do
+-    added_element.at('div').should respond_to(:diff)
++    expect(added_element.at('div')).to respond_to(:diff)
+   end
+ 
+   it "should add #diff to Nokogiri::XML::Text" do
+-    added_text.at('p/text()').should respond_to(:diff)
++    expect(added_text.at('p/text()')).to respond_to(:diff)
+   end
+ 
+   it "should add #diff to Nokogiri::XML::Attr" do
+-    added_attr.at('p/@id').should respond_to(:diff)
++    expect(added_attr.at('p/@id')).to respond_to(:diff)
+   end
+ 
+   it "should not compare the Document objects" do
+     change = doc.diff(doc).first
+ 
+-    change[0].should == ' '
+-    change[1].should == doc.root
++    expect(change[0]).to eq(' ')
++    expect(change[1]).to eq(doc.root)
+   end
+ 
+   it "should determine when two different documents are identical" do
+-    doc.diff(Nokogiri::XML(contents)).all? { |change,node|
++    expect(doc.diff(Nokogiri::XML(contents)).all? { |change,node|
+       change == ' '
+-    }.should == true
++    }).to eq(true)
+   end
+ 
+   it "should search down within Nokogiri::XML::Document objects" do
+-    doc.diff(changed_text).any? { |change,node|
++    expect(doc.diff(changed_text).any? { |change,node|
+       change != ' '
+-    }.should == true
++    }).to eq(true)
+   end
+ 
+   it "should determine when text nodes are added" do
+     changes = doc.at('div').diff(added_text.at('div')).to_a
+ 
+-    changes.length.should == 4
++    expect(changes.length).to eq(4)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == doc.at('div')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(doc.at('div'))
+ 
+-    changes[1][0].should == ' '
+-    changes[1][1].should == doc.at('//p')
++    expect(changes[1][0]).to eq(' ')
++    expect(changes[1][1]).to eq(doc.at('//p'))
+ 
+-    changes[2][0].should == '+'
+-    changes[2][1].should == added_text.at('//div/text()')
++    expect(changes[2][0]).to eq('+')
++    expect(changes[2][1]).to eq(added_text.at('//div/text()'))
+ 
+-    changes[3][0].should == ' '
+-    changes[3][1].should == doc.at('//p/text()')
++    expect(changes[3][0]).to eq(' ')
++    expect(changes[3][1]).to eq(doc.at('//p/text()'))
+   end
+ 
+   it "should determine when elements are added" do
+     changes = doc.at('div').diff(added_element.at('div')).to_a
+ 
+-    changes.length.should == 5
++    expect(changes.length).to eq(5)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == doc.at('div')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(doc.at('div'))
+ 
+-    changes[1][0].should == '+'
+-    changes[1][1].should == added_element.at('//p[1]')
++    expect(changes[1][0]).to eq('+')
++    expect(changes[1][1]).to eq(added_element.at('//p[1]'))
+ 
+-    changes[2][0].should == ' '
+-    changes[2][1].should == doc.at('//p')
++    expect(changes[2][0]).to eq(' ')
++    expect(changes[2][1]).to eq(doc.at('//p'))
+ 
+-    changes[3][0].should == '-'
+-    changes[3][1].should == doc.at('//p/text()')
++    expect(changes[3][0]).to eq('-')
++    expect(changes[3][1]).to eq(doc.at('//p/text()'))
+ 
+-    changes[4][0].should == '+'
+-    changes[4][1].should == added_element.at('//p[2]/text()')
++    expect(changes[4][0]).to eq('+')
++    expect(changes[4][1]).to eq(added_element.at('//p[2]/text()'))
+   end
+ 
+   it "should ignore when attribute order changes" do
+     changes = added_attrs.at('p').diff(changed_attr_order.at('p')).to_a
+ 
+-    changes.all? { |change| change[0] == ' ' }.should be_true
++    expect(changes.all? { |change| change[0] == ' ' }).to be_truthy
+   end
+ 
+   it "should determine when attributes are added" do
+     changes = doc.at('p').diff(added_attr.at('p')).to_a
+ 
+-    changes.length.should == 3
++    expect(changes.length).to eq(3)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == doc.at('p')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(doc.at('p'))
+ 
+-    changes[1][0].should == '+'
+-    changes[1][1].should == added_attr.at('//p/@id')
++    expect(changes[1][0]).to eq('+')
++    expect(changes[1][1]).to eq(added_attr.at('//p/@id'))
+ 
+-    changes[2][0].should == ' '
+-    changes[2][1].should == doc.at('//p/text()')
++    expect(changes[2][0]).to eq(' ')
++    expect(changes[2][1]).to eq(doc.at('//p/text()'))
+   end
+ 
+   it "should determine when text nodes differ" do
+     changes = doc.at('p').diff(changed_text.at('p')).to_a
+ 
+-    changes.length.should == 3
++    expect(changes.length).to eq(3)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == doc.at('p')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(doc.at('p'))
+ 
+-    changes[1][0].should == '-'
+-    changes[1][1].should == doc.at('//p/text()')
++    expect(changes[1][0]).to eq('-')
++    expect(changes[1][1]).to eq(doc.at('//p/text()'))
+ 
+-    changes[2][0].should == '+'
+-    changes[2][1].should == changed_text.at('//p/text()')
++    expect(changes[2][0]).to eq('+')
++    expect(changes[2][1]).to eq(changed_text.at('//p/text()'))
+   end
+ 
+   it "should determine when element names differ" do
+     changes = doc.at('div').diff(changed_element.at('div')).to_a
+ 
+-    changes.length.should == 3
++    expect(changes.length).to eq(3)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == doc.at('div')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(doc.at('div'))
+ 
+-    changes[1][0].should == '-'
+-    changes[1][1].should == doc.at('p')
++    expect(changes[1][0]).to eq('-')
++    expect(changes[1][1]).to eq(doc.at('p'))
+ 
+-    changes[2][0].should == '+'
+-    changes[2][1].should == changed_element.at('span')
++    expect(changes[2][0]).to eq('+')
++    expect(changes[2][1]).to eq(changed_element.at('span'))
+   end
+ 
+   it "should determine when attribute names differ" do
+     changes = added_attr.at('p').diff(changed_attr_name.at('p')).to_a
+ 
+-    changes.length.should == 4
++    expect(changes.length).to eq(4)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == added_attr.at('p')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(added_attr.at('p'))
+ 
+-    changes[1][0].should == '-'
+-    changes[1][1].should == added_attr.at('//p/@id')
++    expect(changes[1][0]).to eq('-')
++    expect(changes[1][1]).to eq(added_attr.at('//p/@id'))
+ 
+-    changes[2][0].should == '+'
+-    changes[2][1].should == changed_attr_name.at('//p/@i')
++    expect(changes[2][0]).to eq('+')
++    expect(changes[2][1]).to eq(changed_attr_name.at('//p/@i'))
+ 
+-    changes[3][0].should == ' '
+-    changes[3][1].should == added_attr.at('//p/text()')
++    expect(changes[3][0]).to eq(' ')
++    expect(changes[3][1]).to eq(added_attr.at('//p/text()'))
+   end
+ 
+   it "should determine when attribute values differ" do
+     changes = added_attr.at('p').diff(changed_attr_value.at('p')).to_a
+ 
+-    changes.length.should == 4
++    expect(changes.length).to eq(4)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == added_attr.at('p')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(added_attr.at('p'))
+ 
+-    changes[1][0].should == '-'
+-    changes[1][1].should == added_attr.at('//p/@id')
++    expect(changes[1][0]).to eq('-')
++    expect(changes[1][1]).to eq(added_attr.at('//p/@id'))
+ 
+-    changes[2][0].should == '+'
+-    changes[2][1].should == changed_attr_value.at('//p/@id')
++    expect(changes[2][0]).to eq('+')
++    expect(changes[2][1]).to eq(changed_attr_value.at('//p/@id'))
+ 
+-    changes[3][0].should == ' '
+-    changes[3][1].should == added_attr.at('//p/text()')
++    expect(changes[3][0]).to eq(' ')
++    expect(changes[3][1]).to eq(added_attr.at('//p/text()'))
+   end
+ 
+   it "should determine when text nodes are removed" do
+     changes = added_text.at('div').diff(removed_text.at('div')).to_a
+ 
+-    changes.length.should == 4
++    expect(changes.length).to eq(4)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == added_text.at('div')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(added_text.at('div'))
+ 
+-    changes[1][0].should == ' '
+-    changes[1][1].should == added_text.at('p')
++    expect(changes[1][0]).to eq(' ')
++    expect(changes[1][1]).to eq(added_text.at('p'))
+ 
+-    changes[2][0].should == ' '
+-    changes[2][1].should == added_text.at('//div/text()')
++    expect(changes[2][0]).to eq(' ')
++    expect(changes[2][1]).to eq(added_text.at('//div/text()'))
+ 
+-    changes[3][0].should == '-'
+-    changes[3][1].should == added_text.at('//p/text()')
++    expect(changes[3][0]).to eq('-')
++    expect(changes[3][1]).to eq(added_text.at('//p/text()'))
+   end
+ 
+   it "should determine when elements are removed" do
+     changes = added_element.at('div').diff(removed_element.at('div')).to_a
+ 
+-    changes.length.should == 3
++    expect(changes.length).to eq(3)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == added_element.at('div')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(added_element.at('div'))
+ 
+-    changes[1][0].should == '-'
+-    changes[1][1].should == added_element.at('//p[1]')
++    expect(changes[1][0]).to eq('-')
++    expect(changes[1][1]).to eq(added_element.at('//p[1]'))
+ 
+-    changes[2][0].should == '-'
+-    changes[2][1].should == added_element.at('//p[2]')
++    expect(changes[2][0]).to eq('-')
++    expect(changes[2][1]).to eq(added_element.at('//p[2]'))
+   end
+ 
+   it "should ignore when attributes change order" do
+@@ -220,47 +220,47 @@
+   it "should determine when attributes are removed" do
+     changes = added_attr.at('div').diff(removed_attr.at('div')).to_a
+ 
+-    changes.length.should == 4
++    expect(changes.length).to eq(4)
+ 
+-    changes[0][0].should == ' '
+-    changes[0][1].should == added_attr.at('div')
++    expect(changes[0][0]).to eq(' ')
++    expect(changes[0][1]).to eq(added_attr.at('div'))
+ 
+-    changes[1][0].should == ' '
+-    changes[1][1].should == added_attr.at('p')
++    expect(changes[1][0]).to eq(' ')
++    expect(changes[1][1]).to eq(added_attr.at('p'))
+ 
+-    changes[2][0].should == '-'
+-    changes[2][1].should == added_attr.at('//p/@id')
++    expect(changes[2][0]).to eq('-')
++    expect(changes[2][1]).to eq(added_attr.at('//p/@id'))
+ 
+-    changes[3][0].should == ' '
+-    changes[3][1].should == added_attr.at('//p/text()')
++    expect(changes[3][0]).to eq(' ')
++    expect(changes[3][1]).to eq(added_attr.at('//p/text()'))
+   end
+ 
+   context ":added" do
+     it "should determine only when text nodes are added" do
+       changes = doc.at('div').diff(added_text.at('div'), :added => true).to_a
+ 
+-      changes.length.should == 1
++      expect(changes.length).to eq(1)
+ 
+-      changes[0][0].should == '+'
+-      changes[0][1].should == added_text.at('//div/text()')
++      expect(changes[0][0]).to eq('+')
++      expect(changes[0][1]).to eq(added_text.at('//div/text()'))
+     end
+ 
+     it "should determine only when elements are added" do
+       changes = doc.at('div').diff(added_element.at('div'), :added => true).to_a
+ 
+-      changes.length.should == 1
++      expect(changes.length).to eq(1)
+ 
+-      changes[0][0].should == '+'
+-      changes[0][1].should == added_element.at('//div/p[2]')
++      expect(changes[0][0]).to eq('+')
++      expect(changes[0][1]).to eq(added_element.at('//div/p[2]'))
+     end
+ 
+     it "should determine only when attributes are added" do
+       changes = doc.at('div').diff(added_attr.at('div'), :added => true).to_a
+ 
+-      changes.length.should == 1
++      expect(changes.length).to eq(1)
+ 
+-      changes[0][0].should == '+'
+-      changes[0][1].should == added_attr.at('//p/@id')
++      expect(changes[0][0]).to eq('+')
++      expect(changes[0][1]).to eq(added_attr.at('//p/@id'))
+     end
+   end
+ 
+@@ -268,28 +268,28 @@
+     it "should determine only when text nodes are removed" do
+       changes = doc.at('div').diff(removed_text.at('div'), :removed => true).to_a
+ 
+-      changes.length.should == 1
++      expect(changes.length).to eq(1)
+ 
+-      changes[0][0].should == '-'
+-      changes[0][1].should == doc.at('//p/text()')
++      expect(changes[0][0]).to eq('-')
++      expect(changes[0][1]).to eq(doc.at('//p/text()'))
+     end
+ 
+     it "should determine only when elements are removed" do
+       changes = doc.at('div').diff(removed_element.at('div'), :removed => true).to_a
+ 
+-      changes.length.should == 1
++      expect(changes.length).to eq(1)
+ 
+-      changes[0][0].should == '-'
+-      changes[0][1].should == doc.at('//div/p')
++      expect(changes[0][0]).to eq('-')
++      expect(changes[0][1]).to eq(doc.at('//div/p'))
+     end
+ 
+     it "should determine only when attributes are removed" do
+       changes = added_attr.at('div').diff(removed_attr.at('div'), :removed => true).to_a
+ 
+-      changes.length.should == 1
++      expect(changes.length).to eq(1)
+ 
+-      changes[0][0].should == '-'
+-      changes[0][1].should == added_attr.at('//p/@id')
++      expect(changes[0][0]).to eq('-')
++      expect(changes[0][1]).to eq(added_attr.at('//p/@id'))
+     end
+   end
+ end
+--- a/metadata.yml
++++ b/metadata.yml
+@@ -72,7 +72,7 @@
+     requirements:
+     - - ~>
+       - !ruby/object:Gem::Version
+-        version: '2.4'
++        version: '3.0'
+   type: :development
+   prerelease: false
+   version_requirements: !ruby/object:Gem::Requirement
+@@ -80,7 +80,7 @@
+     requirements:
+     - - ~>
+       - !ruby/object:Gem::Version
+-        version: '2.4'
++        version: '3.0'
+ - !ruby/object:Gem::Dependency
+   name: yard
+   requirement: !ruby/object:Gem::Requirement
+--- a/Rakefile
++++ b/Rakefile
+@@ -12,7 +12,7 @@
+ end
+ 
+ begin
+-  gem 'rspec', '~> 2.4'
++  gem 'rspec', '~> 3.0'
+   require 'rspec/core/rake_task'
+ 
+   RSpec::Core::RakeTask.new
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -1,2 +1,2 @@
+-gem 'rspec', '~> 2.4'
++gem 'rspec', '~> 3.0'
+ require 'rspec'
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..4a6c93e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+rspec3-port.patch

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



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