[DRE-commits] [ruby-i18n-inflector-rails] 03/04: port tests to support rspec3 and ruby2.2

Balasankar C balasankarc-guest at moszumanska.debian.org
Thu Sep 3 20:03:22 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-i18n-inflector-rails.

commit f80accd3812057de129cea466a392a8940096a9f
Author: Balasankar C <balasankarc at autistici.org>
Date:   Fri Sep 4 01:28:48 2015 +0530

    port tests to support rspec3 and ruby2.2
---
 debian/patches/rspec3-port.patch           | 288 +++++++++++++++++++++++++++++
 debian/patches/series                      |   2 +
 debian/patches/set-available-locales.patch |  16 ++
 3 files changed, 306 insertions(+)

diff --git a/debian/patches/rspec3-port.patch b/debian/patches/rspec3-port.patch
new file mode 100644
index 0000000..780b2d7
--- /dev/null
+++ b/debian/patches/rspec3-port.patch
@@ -0,0 +1,288 @@
+Description: Port tests to RSpec 3 syntax
+Author: Balasankar C <balasankarc at autistici.org>
+Last-Update: 2015-09-03
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/.rspec
++++ b/.rspec
+@@ -1 +1 @@
+---format nested --color
++--format documentation --color
+--- a/spec/inflector_spec.rb
++++ b/spec/inflector_spec.rb
+@@ -9,11 +9,11 @@
+   context "instance I18n.inflector.options" do
+ 
+     it "should contain verify_methods switch" do
+-      I18n.inflector.options.should respond_to :verify_methods
++      expect(I18n.inflector.options).to respond_to :verify_methods
+     end
+ 
+     it "should have default value set to false" do
+-      I18n.inflector.options.verify_methods.should == false
++      expect(I18n.inflector.options.verify_methods).to eq(false)
+     end
+ 
+   end
+@@ -73,42 +73,42 @@
+     end
+ 
+     it "should be albe to assign a mehtod to the inflection kind" do
+-      lambda{AnotherController.inflection_method(:users_gender => :gender)}.should_not raise_error
++      expect{AnotherController.inflection_method(:users_gender => :gender)}.not_to raise_error
+     end
+ 
+     it "should be albe to assign a mehtod to the strict inflection kind" do
+-      lambda{AnotherController.inflection_method(:users_gender => :@gender)}.should_not raise_error
++      expect{AnotherController.inflection_method(:users_gender => :@gender)}.not_to raise_error
+     end
+ 
+     it "should be albe to accept single Symbol argument" do
+-      lambda{AnotherController.inflection_method(:time)}.should_not raise_error
+-      lambda{AnotherController.inflection_method(:@time)}.should_not raise_error
++      expect{AnotherController.inflection_method(:time)}.not_to raise_error
++      expect{AnotherController.inflection_method(:@time)}.not_to raise_error
+     end
+ 
+     it "should be albe to accept single String argument" do
+-      lambda{AnotherController.inflection_method('time')}.should_not raise_error
+-      lambda{AnotherController.inflection_method('@time')}.should_not raise_error
++      expect{AnotherController.inflection_method('time')}.not_to raise_error
++      expect{AnotherController.inflection_method('@time')}.not_to raise_error
+     end
+ 
+     it "should be albe to accept Array<Symbol> argument" do
+-      lambda{AnotherController.inflection_method([:time])}.should_not raise_error
+-      lambda{AnotherController.inflection_method([:@time])}.should_not raise_error
++      expect{AnotherController.inflection_method([:time])}.not_to raise_error
++      expect{AnotherController.inflection_method([:@time])}.not_to raise_error
+     end
+ 
+     it "should raise an error when method name is wrong" do
+-      lambda{AnotherController.inflection_method}.should                  raise_error
+-      lambda{AnotherController.inflection_method(nil => :blabla)}.should  raise_error
+-      lambda{AnotherController.inflection_method(:blabla => nil)}.should  raise_error
+-      lambda{AnotherController.inflection_method(nil => :@blabla)}.should raise_error
+-      lambda{AnotherController.inflection_method(:@blabla => nil)}.should raise_error
+-      lambda{AnotherController.inflection_method(:"@")}.should            raise_error
+-      lambda{AnotherController.inflection_method({''=>''})}.should        raise_error
+-      lambda{AnotherController.inflection_method(nil => nil)}.should      raise_error
+-      lambda{AnotherController.inflection_method(nil)}.should             raise_error
+-      lambda{AnotherController.inflection_method([nil])}.should           raise_error
+-      lambda{AnotherController.inflection_method([''])}.should            raise_error
+-      lambda{AnotherController.inflection_method([])}.should              raise_error
+-      lambda{AnotherController.inflection_method({})}.should              raise_error
++      expect{AnotherController.inflection_method}.to                  raise_error
++      expect{AnotherController.inflection_method(nil => :blabla)}.to  raise_error
++      expect{AnotherController.inflection_method(:blabla => nil)}.to  raise_error
++      expect{AnotherController.inflection_method(nil => :@blabla)}.to raise_error
++      expect{AnotherController.inflection_method(:@blabla => nil)}.to raise_error
++      expect{AnotherController.inflection_method(:"@")}.to            raise_error
++      expect{AnotherController.inflection_method({''=>''})}.to        raise_error
++      expect{AnotherController.inflection_method(nil => nil)}.to      raise_error
++      expect{AnotherController.inflection_method(nil)}.to             raise_error
++      expect{AnotherController.inflection_method([nil])}.to           raise_error
++      expect{AnotherController.inflection_method([''])}.to            raise_error
++      expect{AnotherController.inflection_method([])}.to              raise_error
++      expect{AnotherController.inflection_method({})}.to              raise_error
+     end
+ 
+   end
+@@ -120,32 +120,32 @@
+     end
+ 
+     it "should be albe to split a mehtod of the inflection kind" do
+-      lambda{AnotherController.no_inflection_method(:users_gender)}.should_not raise_error
++      expect{AnotherController.no_inflection_method(:users_gender)}.not_to raise_error
+     end
+ 
+     it "should be albe to accept single Symbol argument" do
+-      lambda{AnotherController.no_inflection_method(:time)}.should_not raise_error
+-      lambda{AnotherController.no_inflection_method(:@time)}.should_not raise_error
++      expect{AnotherController.no_inflection_method(:time)}.not_to raise_error
++      expect{AnotherController.no_inflection_method(:@time)}.not_to raise_error
+     end
+ 
+     it "should be albe to accept single String argument" do
+-      lambda{AnotherController.no_inflection_method('time')}.should_not raise_error
+-      lambda{AnotherController.no_inflection_method('@time')}.should_not raise_error
++      expect{AnotherController.no_inflection_method('time')}.not_to raise_error
++      expect{AnotherController.no_inflection_method('@time')}.not_to raise_error
+     end
+ 
+     it "should be albe to accept Array<Symbol> argument" do
+-      lambda{AnotherController.no_inflection_method([:time])}.should_not raise_error
+-      lambda{AnotherController.no_inflection_method([:@time])}.should_not raise_error
++      expect{AnotherController.no_inflection_method([:time])}.not_to raise_error
++      expect{AnotherController.no_inflection_method([:@time])}.not_to raise_error
+     end
+ 
+     it "should raise an error when method name is wrong" do
+-      lambda{AnotherController.no_inflection_method}.should         raise_error
+-      lambda{AnotherController.no_inflection_method(nil)}.should    raise_error
+-      lambda{AnotherController.no_inflection_method([nil])}.should  raise_error
+-      lambda{AnotherController.no_inflection_method(:"@")}.should   raise_error
+-      lambda{AnotherController.no_inflection_method([''])}.should   raise_error
+-      lambda{AnotherController.no_inflection_method([])}.should     raise_error
+-      lambda{AnotherController.no_inflection_method({})}.should     raise_error
++      expect{AnotherController.no_inflection_method}.to         raise_error
++      expect{AnotherController.no_inflection_method(nil)}.to    raise_error
++      expect{AnotherController.no_inflection_method([nil])}.to  raise_error
++      expect{AnotherController.no_inflection_method(:"@")}.to   raise_error
++      expect{AnotherController.no_inflection_method([''])}.to   raise_error
++      expect{AnotherController.no_inflection_method([])}.to     raise_error
++      expect{AnotherController.no_inflection_method({})}.to     raise_error
+     end
+ 
+   end
+@@ -157,33 +157,33 @@
+     end
+ 
+     it "should be albe to spit a mehtod of the inflection kind" do
+-      lambda{AnotherController.no_inflection_kind(:gender)}.should_not raise_error
+-      lambda{AnotherController.no_inflection_kind(:@gender)}.should_not raise_error
++      expect{AnotherController.no_inflection_kind(:gender)}.not_to raise_error
++      expect{AnotherController.no_inflection_kind(:@gender)}.not_to raise_error
+     end
+ 
+     it "should be albe to accept single Symbol argument" do
+-      lambda{AnotherController.no_inflection_kind(:time)}.should_not raise_error
+-      lambda{AnotherController.no_inflection_kind(:@time)}.should_not raise_error
++      expect{AnotherController.no_inflection_kind(:time)}.not_to raise_error
++      expect{AnotherController.no_inflection_kind(:@time)}.not_to raise_error
+     end
+ 
+     it "should be albe to accept single String argument" do
+-      lambda{AnotherController.no_inflection_kind('time')}.should_not raise_error
+-      lambda{AnotherController.no_inflection_kind('@time')}.should_not raise_error
++      expect{AnotherController.no_inflection_kind('time')}.not_to raise_error
++      expect{AnotherController.no_inflection_kind('@time')}.not_to raise_error
+     end
+ 
+     it "should be albe to accept Array<Symbol> argument" do
+-      lambda{AnotherController.no_inflection_kind([:time])}.should_not raise_error
+-      lambda{AnotherController.no_inflection_kind([:@time])}.should_not raise_error
++      expect{AnotherController.no_inflection_kind([:time])}.not_to raise_error
++      expect{AnotherController.no_inflection_kind([:@time])}.not_to raise_error
+     end
+ 
+     it "should raise an error when method name is wrong" do
+-      lambda{AnotherController.no_inflection_kind}.should        raise_error
+-      lambda{AnotherController.no_inflection_kind(nil)}.should   raise_error
+-      lambda{AnotherController.no_inflection_kind(:"@")}.should  raise_error
+-      lambda{AnotherController.no_inflection_kind([nil])}.should raise_error
+-      lambda{AnotherController.no_inflection_kind([''])}.should  raise_error
+-      lambda{AnotherController.no_inflection_kind([])}.should    raise_error
+-      lambda{AnotherController.no_inflection_kind({})}.should    raise_error
++      expect{AnotherController.no_inflection_kind}.to        raise_error
++      expect{AnotherController.no_inflection_kind(nil)}.to   raise_error
++      expect{AnotherController.no_inflection_kind(:"@")}.to  raise_error
++      expect{AnotherController.no_inflection_kind([nil])}.to raise_error
++      expect{AnotherController.no_inflection_kind([''])}.to  raise_error
++      expect{AnotherController.no_inflection_kind([])}.to    raise_error
++      expect{AnotherController.no_inflection_kind({})}.to    raise_error
+     end
+ 
+   end
+@@ -197,11 +197,11 @@
+     end
+ 
+     it "should be callable" do
+-      lambda{InflectedTranslateController.i18n_inflector_kinds}.should_not raise_error
++      expect{InflectedTranslateController.i18n_inflector_kinds}.not_to raise_error
+     end
+ 
+     it "should be able to read methods assigned to inflection kinds" do
+-      InflectedTranslateController.i18n_inflector_kinds.should ==  @expected_hash
++      expect(InflectedTranslateController.i18n_inflector_kinds).to eq(@expected_hash)
+     end
+ 
+   end
+@@ -262,7 +262,7 @@
+       end
+ 
+       it "should be able to read methods assigned to inflection kinds" do
+-        @controller.i18n_inflector_kinds.should == @expected_hash
++        expect(@controller.i18n_inflector_kinds).to eq(@expected_hash)
+       end
+ 
+     end
+@@ -270,53 +270,53 @@
+     describe "#translate" do
+ 
+       it "should translate using inflection patterns and pick up the right value" do
+-        @controller.trn('welcome').should == 'Dear Sir!'
+-        @controller.trn('welcome_strict').should == 'Dear Sir!'
+-        @strict_controller.trn('welcome_strict').should == 'Dear Sir!'
++        expect(@controller.trn('welcome')).to eq('Dear Sir!')
++        expect(@controller.trn('welcome_strict')).to eq('Dear Sir!')
++        expect(@strict_controller.trn('welcome_strict')).to eq('Dear Sir!')
+       end
+ 
+       it "should make use of a block passed to inflection method" do
+-        @controller.trn('hitime').should == 'past!'
++        expect(@controller.trn('hitime')).to eq('past!')
+       end
+ 
+       it "should make use of inherited inflection method assignments" do
+-        @strict_over_controller.trn('hitime').should == 'past!'
++        expect(@strict_over_controller.trn('hitime')).to eq('past!')
+       end
+ 
+       it "should make use of overriden inflection method assignments" do
+-        @strict_over_controller.trn('welcome').should == 'Dear Lady!'
++        expect(@strict_over_controller.trn('welcome')).to eq('Dear Lady!')
+       end
+ 
+       it "should prioritize strict kinds when both inflection options are passed" do
+-        @strict_over_controller.trn('welcome_strict').should == 'Dear Dude!'
+-        @strict_over_controller.trn('welcome').should == 'Dear Lady!'
++        expect(@strict_over_controller.trn('welcome_strict')).to eq('Dear Dude!')
++        expect(@strict_over_controller.trn('welcome')).to eq('Dear Lady!')
+       end
+ 
+       it "should use regular kind option when strict kind option is missing" do
+-        @strict_over_controller.trn('to_be').should == 'Oh I am'
+-        @strict_over_controller.trn('to_be_strict').should == 'Oh me'
++        expect(@strict_over_controller.trn('to_be')).to eq('Oh I am')
++        expect(@strict_over_controller.trn('to_be_strict')).to eq('Oh me')
+       end
+ 
+       it "should make use of disabled inflection method assignments" do
+-        @disabled_controller.trn('welcome').should == 'Dear You!'
++        expect(@disabled_controller.trn('welcome')).to eq('Dear You!')
+       end
+ 
+       it "should raise exception when method does not exists" do
+-        lambda{@nomethod_controller.translated_male}.should raise_error(NameError)
++        expect{@nomethod_controller.translated_male}.to raise_error(NameError)
+       end
+ 
+       it "should not raise when method does not exists and verify_methods is enabled" do
+-        lambda{@nomethod_controller.trn('welcome', :inflector_verify_methods => true)}.should_not raise_error
++        expect{@nomethod_controller.trn('welcome', :inflector_verify_methods => true)}.not_to raise_error
+         I18n.inflector.options.verify_methods = true
+-        lambda{@nomethod_controller.trn('welcome')}.should_not raise_error
++        expect{@nomethod_controller.trn('welcome')}.not_to raise_error
+       end
+ 
+       it "should translate with the :inflector_lazy_methods switch turned off" do
+-        @strict_over_controller.trn('welcome', :inflector_lazy_methods => false).should == 'Dear Lady!'
++        expect(@strict_over_controller.trn('welcome', :inflector_lazy_methods => false)).to eq('Dear Lady!')
+       end
+ 
+       it "should omit pattern interpolation when locale is not inflected" do
+-        @strict_over_controller.trn('welcome', :locale => :ns).should == 'Dear !'
++        expect(@strict_over_controller.trn('welcome', :locale => :ns)).to eq('Dear !')
+       end
+ 
+     end
+@@ -324,7 +324,7 @@
+     describe "#t" do
+ 
+       it "should call translate" do
+-        @controller.t_male.should == 'Dear Sir!'
++        expect(@controller.t_male).to eq('Dear Sir!')
+       end
+ 
+     end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..1e1b35a
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+rspec3-port.patch
+set-available-locales.patch
diff --git a/debian/patches/set-available-locales.patch b/debian/patches/set-available-locales.patch
new file mode 100644
index 0000000..f9f7a5c
--- /dev/null
+++ b/debian/patches/set-available-locales.patch
@@ -0,0 +1,16 @@
+Description: Set available locales before running tests
+Author: Balasankar C <balasankarc at autistici.org>
+Last-Update: 2015-09-03
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/spec/inflector_spec.rb
++++ b/spec/inflector_spec.rb
+@@ -23,7 +23,7 @@
+ describe ApplicationController do
+ 
+   before do
+-
++    I18n.config.available_locales = :xx, :ns
+     I18n.locale = :xx
+     I18n.backend.store_translations(:xx, :i18n => { :inflections => {
+                                                      :gender => {

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



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