[DRE-commits] [ruby-eim-xml] 01/04: Refresh patch: Upgrade RSpec >= 3
Youhei SASAKI
uwabami-guest at moszumanska.debian.org
Mon Sep 28 08:28:01 UTC 2015
This is an automated email from the git hooks/post-receive script.
uwabami-guest pushed a commit to branch master
in repository ruby-eim-xml.
commit bf9c05099e02b04b82ac57dd256fc388e9fae23e
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date: Mon Sep 28 17:18:33 2015 +0900
Refresh patch: Upgrade RSpec >= 3
Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
---
debian/patches/Fix_old_Rake_and_Upgrade_RSpec3 | 325 +++++++++++++++++++++++++
debian/patches/fix_old_Rake_Issues | 28 ---
debian/patches/series | 2 +-
3 files changed, 326 insertions(+), 29 deletions(-)
diff --git a/debian/patches/Fix_old_Rake_and_Upgrade_RSpec3 b/debian/patches/Fix_old_Rake_and_Upgrade_RSpec3
new file mode 100644
index 0000000..bf2e29e
--- /dev/null
+++ b/debian/patches/Fix_old_Rake_and_Upgrade_RSpec3
@@ -0,0 +1,325 @@
+From: Youhei SASAKI <uwabami at gfd-dennou.org>
+Date: Mon, 28 Sep 2015 16:50:09 +0900
+Subject: Fix old Rake Issue and Upgrade RSpec 3
+
+Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
+---
+ Rakefile.utirake | 4 +--
+ spec/dsl_spec.rb | 3 +-
+ spec/eim_xml_spec.rb | 90 +++++++++++++++++++++++++-------------------------
+ spec/formatter_spec.rb | 8 ++---
+ spec/parser_spec.rb | 2 +-
+ spec/spec_helper.rb | 8 +++++
+ spec/xhtml_spec.rb | 54 +++++++++++++++---------------
+ 7 files changed, 89 insertions(+), 80 deletions(-)
+ create mode 100644 spec/spec_helper.rb
+
+diff --git a/Rakefile.utirake b/Rakefile.utirake
+index 44349e5..c28a474 100644
+--- a/Rakefile.utirake
++++ b/Rakefile.utirake
+@@ -5,12 +5,12 @@
+
+ require "rake/clean"
+ require "rake/testtask"
+-require "rdoc/task"
++require "rake/rdoctask"
+ require "rake/contrib/rubyforgepublisher"
+ require "rubygems/package_task"
+
+ class UtiRake
+- include Rake::DSL
++ include Rake::DSL if defined?(Rake::DSL)
+
+ def self.setup(opt={}, &proc)
+ ur = new
+diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb
+index bf5b30b..0c7b4a5 100644
+--- a/spec/dsl_spec.rb
++++ b/spec/dsl_spec.rb
+@@ -1,4 +1,5 @@
+ require "eim_xml/dsl"
++require 'spec_helper'
+
+ module Module.new::M
+ include EimXML
+@@ -124,7 +125,7 @@ module Module.new::M
+ d.element(:sub2).should == Element.new(:sub2)
+ end
+ end
+- block_executed.should be_true
++ block_executed.should be_truthy
+ end
+
+ it "DSL methods return element" do
+diff --git a/spec/eim_xml_spec.rb b/spec/eim_xml_spec.rb
+index e38b05c..d5f2543 100644
+--- a/spec/eim_xml_spec.rb
++++ b/spec/eim_xml_spec.rb
+@@ -322,50 +322,50 @@ module Module.new::M
+
+ it "#match" do
+ e = Element.new(:tag, :attr=>"value")
+- e.match(:tag).should be_true
+- e.match(:tag, :attr=>"value").should be_true
+- e.match(:t).should be_false
+- e.match(:tag, :attr2=>"value").should be_false
+- e.match(:tag, :attr=>"value2").should be_false
+- e.match(:tag, :attr=>/val/).should be_true
+-
+- e.match(Element.new(:tag)).should be_true
+- e.match(Element.new(:tag, :attr=>"value")).should be_true
+- e.match(Element.new(:tag, :attr=>/alu/)).should be_true
+- e.match(Element.new(:t)).should be_false
+- e.match(Element.new(:tag, :attr2=>"value")).should be_false
+- e.match(Element.new(:tag, :attr=>"value2")).should be_false
+- e.match(Element.new(:tag, :attr=>/aul/)).should be_false
+- e.match(Element.new(:tag, :attr=>PCString.new("value"))).should be_true
+- Element.new(:tag, :attr=>PCString.new("value")).should match(e)
+-
+- e.match(Element.new(:tag, :attr=>nil)).should be_false
+- e.match(Element.new(:tag, :nonattr=>nil)).should be_true
+-
+- (!!e.match(/ag/)).should be_true
+- (!!e.match(/elem/)).should be_false
+-
+- e.match(Element).should be_true
+- e.match(Dummy).should be_false
+- e.match(String).should be_false
++ e.match(:tag).should be_truthy
++ expect(e.match(:tag, :attr=>"value")).to be_truthy
++ expect(e.match(:t)).to be_falsey
++ expect(e.match(:tag, :attr2=>"value")).to be_falsey
++ expect(e.match(:tag, :attr=>"value2")).to be_falsey
++ expect(e.match(:tag, :attr=>/val/)).to be_truthy
++
++ expect(e.match(Element.new(:tag))).to be_truthy
++ expect(e.match(Element.new(:tag, :attr=>"value"))).to be_truthy
++ expect(e.match(Element.new(:tag, :attr=>/alu/))).to be_truthy
++ expect(e.match(Element.new(:t))).to be_falsey
++ expect(e.match(Element.new(:tag, :attr2=>"value"))).to be_falsey
++ expect(e.match(Element.new(:tag, :attr=>"value2"))).to be_falsey
++ expect(e.match(Element.new(:tag, :attr=>/aul/))).to be_falsey
++ expect(e.match(Element.new(:tag, :attr=>PCString.new("value")))).to be_truthy
++ expect(Element.new(:tag, :attr=>PCString.new("value"))).to match(e)
++
++ expect(e.match(Element.new(:tag, :attr=>nil))).to be_falsey
++ expect(e.match(Element.new(:tag, :nonattr=>nil))).to be_truthy
++
++ expect(!!e.match(/ag/)).to be_truthy
++ expect(!!e.match(/elem/)).to be_falsey
++
++ expect(e.match(Element)).to be_truthy
++ expect(e.match(Dummy)).to be_falsey
++ expect(e.match(String)).to be_falsey
+
+ e = Element.new(:element)
+ e << Element.new(:sub)
+ e << "text"
+- e.match(EDSL.element(:element){element(:sub)}).should be_true
+- e.match(EDSL.element(:element){element(:other)}).should be_false
+- e.match(EDSL.element(:element){add("text")}).should be_true
+- e.match(EDSL.element(:element){add("other")}).should be_false
+- e.match(EDSL.element(:element){add(/ex/)}).should be_true
+- e.match(EDSL.element(:element){add(/th/)}).should be_false
+- e.match(EDSL.element(:element){add(/sub/)}).should be_false
++ expect(e.match(EDSL.element(:element){element(:sub)})).to be_truthy
++ expect(e.match(EDSL.element(:element){element(:other)})).to be_falsey
++ expect(e.match(EDSL.element(:element){add("text")})).to be_truthy
++ expect(e.match(EDSL.element(:element){add("other")})).to be_falsey
++ expect(e.match(EDSL.element(:element){add(/ex/)})).to be_truthy
++ expect(e.match(EDSL.element(:element){add(/th/)})).to be_falsey
++ expect(e.match(EDSL.element(:element){add(/sub/)})).to be_falsey
+
+ e = Element.new(:t, :a=>"&")
+- e.should match(Element.new(:t, :a=>"&"))
+- e.should match(Element.new(:t, :a=>PCString.new("&", true)))
+- e.should match(Element.new(:t, :a=>PCString.new("&")))
++ expect(e).to match(Element.new(:t, :a=>"&"))
++ expect(e).to match(Element.new(:t, :a=>PCString.new("&", true)))
++ expect(e).to match(Element.new(:t, :a=>PCString.new("&")))
+
+- Element.new(:t, "a"=>"v").should match(Element.new(:t, :a=>"v"))
++ expect(Element.new(:t, "a"=>"v")).to match(Element.new(:t, :a=>"v"))
+ end
+
+ it "#=~" do
+@@ -398,25 +398,25 @@ module Module.new::M
+ b <<= Element.new(:sub, :attr=>"value")
+ end
+
+- e.send(method, :sub).should be_true
+- e.send(method, :sub, :attr=>"value").should be_true
+- e.send(method, :sub, :attr=>"value", :attr2=>"").should be_false
+- e.send(method, :deep).should be_true
++ e.send(method, :sub).should be_truthy
++ expect(e.send(method, :sub, :attr=>"value")).to be_truthy
++ expect(e.send(method, :sub, :attr=>"value", :attr2=>"")).to be_falsey
++ expect(e.send(method, :deep)).to be_truthy
+
+- e.send(method, String).should be_true
+- e.send(method, PCString).should be_true
++ expect(e.send(method, String)).to be_truthy
++ expect(e.send(method, PCString)).to be_truthy
+
+ d = Element.new(:deep)
+ d << "text"
+ d << PCString.new("&", true)
+ d << "<"
+- e.send(method, d).should be_true
++ expect(e.send(method, d)).to be_truthy
+
+ d = Element.new(:deep)
+ d << PCString.new("text", true)
+ d << "&"
+ d << PCString.new("<", true)
+- e.send(method, d).should be_true
++ expect(e.send(method, d)).to be_truthy
+ end
+ end
+
+diff --git a/spec/formatter_spec.rb b/spec/formatter_spec.rb
+index c489944..f8788ff 100644
+--- a/spec/formatter_spec.rb
++++ b/spec/formatter_spec.rb
+@@ -229,7 +229,7 @@ describe EimXML::Formatter::ElementWrapper do
+ @mocks
+ end
+ end
+- @mocks = [mock(:m1).as_null_object, mock(:m2).as_null_object]
++ @mocks = [double(:m1).as_null_object, double(:m2).as_null_object]
+ @wrapper = @m::Wrapper.new(@mocks)
+ @xml = EimXML::Element.new(:e) do |e|
+ e << @wrapper
+@@ -238,16 +238,16 @@ describe EimXML::Formatter::ElementWrapper do
+
+ describe "#each" do
+ it "will give options from formatter" do
+- @wrapper.should_receive(:contents).with(:a=>10, :b=>20).and_return([])
++ expect(@wrapper).to receive(:contents).with(:a=>10, :b=>20).and_return([])
+ @formatter.write(@xml)
+ end
+
+ it "yield result of contents" do
+ @mocks.each_with_index do |mock, index|
+- mock.should_receive(:to_s).and_return("m#{index}")
++ expect(mock).to receive(:to_s).and_return("m#{index}")
+ end
+ @formatter.write(@xml)
+- @out.should == "<e>\n m0\n m1\n</e>\n"
++ expect(@out).to eq("<e>\n m0\n m1\n</e>\n")
+ end
+
+ it "raise error when subclass of ElementWrapper is not implement #contents" do
+diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
+index 004ec09..f100ded 100644
+--- a/spec/parser_spec.rb
++++ b/spec/parser_spec.rb
+@@ -5,7 +5,7 @@ module Module.new::M
+
+ describe Parser do
+ def parse(src)
+- Parser.new(src).parse
++ EimXML::Parser.new(src).parse
+ end
+
+ it "'parser' method for test" do
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+new file mode 100644
+index 0000000..cdb8571
+--- /dev/null
++++ b/spec/spec_helper.rb
+@@ -0,0 +1,8 @@
++RSpec.configure do |config|
++ config.expect_with :rspec do |c|
++ c.syntax = [:should, :expect]
++ end
++ config.mock_with :rspec do |c|
++ c.syntax = [:should, :expect]
++ end
++end
+diff --git a/spec/xhtml_spec.rb b/spec/xhtml_spec.rb
+index 5c4e478..632284b 100644
+--- a/spec/xhtml_spec.rb
++++ b/spec/xhtml_spec.rb
+@@ -226,33 +226,33 @@ module Module.new::M
+ end
+
+ it "FORM.new should be able to receive CGI::Session object and set random token" do
+- s = mock("session")
++ s = double("session")
+ h = {}
+- s.should_receive(:[]).any_number_of_times{|k| h[k]}
+- s.should_receive(:[]=).any_number_of_times{|k, v| h[k]=v}
++ allow(s).to receive(:[]){|k| h[k]}
++ allow(s).to receive(:[]=){|k, v| h[k]=v}
+ f = FORM.new(:session=>s)
+- h["token"].size.should == 40
+- h["token"].should =~ /\A[0-9a-f]{40}\z/
+- f.should include(HIDDEN.new(:name=>"token", :value=>h["token"]))
++ expect(h["token"].size).to eq(40)
++ expect(h["token"]).to match(/\A[0-9a-f]{40}\z/)
++ expect(f).to include(HIDDEN.new(:name=>"token", :value=>h["token"]))
+
+- s = mock("session")
++ s = double("session")
+ h = {}
+- s.should_receive(:[]).any_number_of_times{|k| h[k]}
+- s.should_receive(:[]=).any_number_of_times{|k, v| h[k]=v}
++ allow(s).to receive(:[]){|k| h[k]}
++ allow(s).to receive(:[]=){|k, v| h[k]=v}
+ f = FORM.new(:session=>s, :session_name=>"random_key")
+- h["token"].should be_nil
+- h["random_key"].size.should == 40
+- h["random_key"].should =~ /\A[0-9a-f]{40}\z/
+- f.should include(HIDDEN.new(:name=>"random_key", :value=>h["random_key"]))
++ expect(h["token"]).to be_nil
++ expect(h["random_key"].size).to eq(40)
++ expect(h["random_key"]).to match(/\A[0-9a-f]{40}\z/)
++ expect(f).to include(HIDDEN.new(:name=>"random_key", :value=>h["random_key"]))
+
+- s = mock("session")
++ s = double("session")
+ h = {}
+- s.should_receive(:[]).any_number_of_times{|k| h[k]}
+- s.should_receive(:[]=).any_number_of_times{|k, v| h[k]=v}
++ allow(s).to receive(:[]){|k| h[k]}
++ allow(s).to receive(:[]=){|k, v| h[k]=v}
+ FORM.new(:session=>s)
+ token = s["token"]
+- FORM.new(:session=>s).should include(HIDDEN.new(:name=>"token", :value=>token))
+- s["token"].should == token
++ expect(FORM.new(:session=>s)).to include(HIDDEN.new(:name=>"token", :value=>token))
++ expect(s["token"]).to eq(token)
+ end
+
+ it "TEXTAREA" do
+@@ -316,19 +316,19 @@ module Module.new::M
+ s = XDSL.submit
+ s.should be_kind_of(SUBMIT)
+ s.should =~ SUBMIT.new
+- (!s[:name]).should be_true
+- (!s[:value]).should be_true
++ (!s[:name]).should be_truthy
++ expect(!s[:value]).to be_truthy
+ s = XDSL.submit(:name=>:s, :value=>:v)
+- s[:name].should == :s
+- s[:value].should == :v
++ expect(s[:name]).to eq(:s)
++ expect(s[:value]).to eq(:v)
+
+ s = OpenDSL.submit
+- s.should be_kind_of(SUBMIT)
+- s.should == SUBMIT.new
+- s[:name].should be_nil
+- s[:value].should be_nil
++ expect(s).to be_kind_of(SUBMIT)
++ expect(s).to eq(SUBMIT.new)
++ expect(s[:name]).to be_nil
++ expect(s[:value]).to be_nil
+ s = OpenDSL.submit(:name=>:s, :value=>:v)
+- s.should == SUBMIT.new(:name=>:s, :value=>:v)
++ expect(s).to eq(SUBMIT.new(:name=>:s, :value=>:v))
+ end
+
+ it "TEXT" do
diff --git a/debian/patches/fix_old_Rake_Issues b/debian/patches/fix_old_Rake_Issues
deleted file mode 100644
index 42b82f0..0000000
--- a/debian/patches/fix_old_Rake_Issues
+++ /dev/null
@@ -1,28 +0,0 @@
---- ruby-eim-xml-0.0.4.orig/Rakefile.utirake
-+++ ruby-eim-xml-0.0.4/Rakefile.utirake
-@@ -5,12 +5,12 @@
-
- require "rake/clean"
- require "rake/testtask"
--require "rdoc/task"
-+require "rake/rdoctask"
- require "rake/contrib/rubyforgepublisher"
- require "rubygems/package_task"
-
- class UtiRake
-- include Rake::DSL
-+ include Rake::DSL if defined?(Rake::DSL)
-
- def self.setup(opt={}, &proc)
- ur = new
---- ruby-eim-xml-0.0.4.orig/spec/parser_spec.rb
-+++ ruby-eim-xml-0.0.4/spec/parser_spec.rb
-@@ -5,7 +5,7 @@
-
- describe Parser do
- def parse(src)
-- Parser.new(src).parse
-+ EimXML::Parser.new(src).parse
- end
-
- it "'parser' method for test" do
diff --git a/debian/patches/series b/debian/patches/series
index dc75682..83ca025 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-fix_old_Rake_Issues
+Fix_old_Rake_and_Upgrade_RSpec3
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-eim-xml.git
More information about the Pkg-ruby-extras-commits
mailing list