[DRE-commits] [ruby-settingslogic] 03/05: Port tests to RSpec3
Balasankar C
balasankarc-guest at moszumanska.debian.org
Thu Sep 3 18:34:44 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-settingslogic.
commit e6cf8eaedf7fb2f2e4a47b05f35822fee218333a
Author: Balasankar C <balasankarc at autistici.org>
Date: Thu Sep 3 23:58:08 2015 +0530
Port tests to RSpec3
---
debian/patches/0002-rpsec3-port.patch | 261 ++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 262 insertions(+)
diff --git a/debian/patches/0002-rpsec3-port.patch b/debian/patches/0002-rpsec3-port.patch
new file mode 100644
index 0000000..da87be2
--- /dev/null
+++ b/debian/patches/0002-rpsec3-port.patch
@@ -0,0 +1,261 @@
+Description: Port tests to support RSpec3 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/spec/settingslogic_spec.rb
++++ b/spec/settingslogic_spec.rb
+@@ -2,50 +2,50 @@
+
+ describe "Settingslogic" do
+ it "should access settings" do
+- Settings.setting2.should == 5
++ expect(Settings.setting2).to eq(5)
+ end
+
+ it "should access nested settings" do
+- Settings.setting1.setting1_child.should == "saweet"
++ expect(Settings.setting1.setting1_child).to eq("saweet")
+ end
+
+ it "should access settings in nested arrays" do
+- Settings.array.first.name.should == "first"
++ expect(Settings.array.first.name).to eq("first")
+ end
+
+ it "should access deep nested settings" do
+- Settings.setting1.deep.another.should == "my value"
++ expect(Settings.setting1.deep.another).to eq("my value")
+ end
+
+ it "should access extra deep nested settings" do
+- Settings.setting1.deep.child.value.should == 2
++ expect(Settings.setting1.deep.child.value).to eq(2)
+ end
+
+ it "should enable erb" do
+- Settings.setting3.should == 25
++ expect(Settings.setting3).to eq(25)
+ end
+
+ it "should namespace settings" do
+- Settings2.setting1_child.should == "saweet"
+- Settings2.deep.another.should == "my value"
++ expect(Settings2.setting1_child).to eq("saweet")
++ expect(Settings2.deep.another).to eq("my value")
+ end
+
+ it "should return the namespace" do
+- Settings.namespace.should be_nil
+- Settings2.namespace.should == 'setting1'
++ expect(Settings.namespace).to be_nil
++ expect(Settings2.namespace).to eq('setting1')
+ end
+
+ it "should distinguish nested keys" do
+- Settings.language.haskell.paradigm.should == 'functional'
+- Settings.language.smalltalk.paradigm.should == 'object oriented'
++ expect(Settings.language.haskell.paradigm).to eq('functional')
++ expect(Settings.language.smalltalk.paradigm).to eq('object oriented')
+ end
+
+ it "should not collide with global methods" do
+- Settings3.nested.collides.does.should == 'not either'
++ expect(Settings3.nested.collides.does).to eq('not either')
+ Settings3[:nested] = 'fooey'
+- Settings3[:nested].should == 'fooey'
+- Settings3.nested.should == 'fooey'
+- Settings3.collides.does.should == 'not'
++ expect(Settings3[:nested]).to eq('fooey')
++ expect(Settings3.nested).to eq('fooey')
++ expect(Settings3.collides.does).to eq('not')
+ end
+
+ it "should raise a helpful error message" do
+@@ -53,19 +53,19 @@
+ begin
+ Settings.missing
+ rescue => e
+- e.should be_kind_of Settingslogic::MissingSetting
++ expect(e).to be_kind_of Settingslogic::MissingSetting
+ end
+- e.should_not be_nil
+- e.message.should =~ /Missing setting 'missing' in/
++ expect(e).not_to be_nil
++ expect(e.message).to match(/Missing setting 'missing' in/)
+
+ e = nil
+ begin
+ Settings.language.missing
+ rescue => e
+- e.should be_kind_of Settingslogic::MissingSetting
++ expect(e).to be_kind_of Settingslogic::MissingSetting
+ end
+- e.should_not be_nil
+- e.message.should =~ /Missing setting 'missing' in 'language' section/
++ expect(e).not_to be_nil
++ expect(e.message).to match(/Missing setting 'missing' in 'language' section/)
+ end
+
+ it "should handle optional / dynamic settings" do
+@@ -73,31 +73,31 @@
+ begin
+ Settings.language.erlang
+ rescue => e
+- e.should be_kind_of Settingslogic::MissingSetting
++ expect(e).to be_kind_of Settingslogic::MissingSetting
+ end
+- e.should_not be_nil
+- e.message.should =~ /Missing setting 'erlang' in 'language' section/
++ expect(e).not_to be_nil
++ expect(e.message).to match(/Missing setting 'erlang' in 'language' section/)
+
+- Settings.language['erlang'].should be_nil
++ expect(Settings.language['erlang']).to be_nil
+ Settings.language['erlang'] = 5
+- Settings.language['erlang'].should == 5
++ expect(Settings.language['erlang']).to eq(5)
+
+ Settings.language['erlang'] = {'paradigm' => 'functional'}
+- Settings.language.erlang.paradigm.should == 'functional'
+- Settings.respond_to?('erlang').should be_false
++ expect(Settings.language.erlang.paradigm).to eq('functional')
++ expect(Settings.respond_to?('erlang')).to be_falsey
+
+ Settings.reload!
+- Settings.language['erlang'].should be_nil
++ expect(Settings.language['erlang']).to be_nil
+
+ Settings.language[:erlang] ||= 5
+- Settings.language[:erlang].should == 5
++ expect(Settings.language[:erlang]).to eq(5)
+
+ Settings.language[:erlang] = {}
+ Settings.language[:erlang][:paradigm] = 'functional'
+- Settings.language.erlang.paradigm.should == 'functional'
++ expect(Settings.language.erlang.paradigm).to eq('functional')
+
+ Settings[:toplevel] = '42'
+- Settings.toplevel.should == '42'
++ expect(Settings.toplevel).to eq('42')
+ end
+
+ it "should raise an error on a nil source argument" do
+@@ -106,13 +106,13 @@
+ begin
+ NoSource.foo.bar
+ rescue => e
+- e.should be_kind_of Errno::ENOENT
++ expect(e).to be_kind_of Errno::ENOENT
+ end
+- e.should_not be_nil
++ expect(e).not_to be_nil
+ end
+
+ it "should allow suppressing errors" do
+- Settings4.non_existent_key.should be_nil
++ expect(Settings4.non_existent_key).to be_nil
+ end
+
+ # This one edge case currently does not pass, because it requires very
+@@ -127,80 +127,80 @@
+
+ it "should handle oddly-named settings" do
+ Settings.language['some-dash-setting#'] = 'dashtastic'
+- Settings.language['some-dash-setting#'].should == 'dashtastic'
++ expect(Settings.language['some-dash-setting#']).to eq('dashtastic')
+ end
+
+ it "should handle settings with nil value" do
+ Settings["flag"] = true
+ Settings["flag"] = nil
+- Settings.flag.should == nil
++ expect(Settings.flag).to eq(nil)
+ end
+
+ it "should handle settings with false value" do
+ Settings["flag"] = true
+ Settings["flag"] = false
+- Settings.flag.should == false
++ expect(Settings.flag).to eq(false)
+ end
+
+ it "should support instance usage as well" do
+ settings = SettingsInst.new(Settings.source)
+- settings.setting1.setting1_child.should == "saweet"
++ expect(settings.setting1.setting1_child).to eq("saweet")
+ end
+
+ it "should be able to get() a key with dot.notation" do
+- Settings.get('setting1.setting1_child').should == "saweet"
+- Settings.get('setting1.deep.another').should == "my value"
+- Settings.get('setting1.deep.child.value').should == 2
++ expect(Settings.get('setting1.setting1_child')).to eq("saweet")
++ expect(Settings.get('setting1.deep.another')).to eq("my value")
++ expect(Settings.get('setting1.deep.child.value')).to eq(2)
+ end
+
+ # If .name is not a property, delegate to superclass
+ it "should respond with Module.name" do
+- Settings2.name.should == "Settings2"
++ expect(Settings2.name).to eq("Settings2")
+ end
+
+ # If .name is called on Settingslogic itself, handle appropriately
+ # by delegating to Hash
+ it "should have the parent class always respond with Module.name" do
+- Settingslogic.name.should == 'Settingslogic'
++ expect(Settingslogic.name).to eq('Settingslogic')
+ end
+
+ # If .name is a property, respond with that instead of delegating to superclass
+ it "should allow a name setting to be overriden" do
+- Settings.name.should == 'test'
++ expect(Settings.name).to eq('test')
+ end
+
+ it "should allow symbolize_keys" do
+ Settings.reload!
+ result = Settings.language.haskell.symbolize_keys
+- result.class.should == Hash
+- result.should == {:paradigm => "functional"}
++ expect(result.class).to eq(Hash)
++ expect(result).to eq({:paradigm => "functional"})
+ end
+
+ it "should allow symbolize_keys on nested hashes" do
+ Settings.reload!
+ result = Settings.language.symbolize_keys
+- result.class.should == Hash
+- result.should == {
++ expect(result.class).to eq(Hash)
++ expect(result).to eq({
+ :haskell => {:paradigm => "functional"},
+ :smalltalk => {:paradigm => "object oriented"}
+- }
++ })
+ end
+
+ it "should handle empty file" do
+- SettingsEmpty.keys.should eql([])
++ expect(SettingsEmpty.keys).to eql([])
+ end
+
+ # Put this test last or else call to .instance will load @instance,
+ # masking bugs.
+ it "should be a hash" do
+- Settings.send(:instance).should be_is_a(Hash)
++ expect(Settings.send(:instance)).to be_is_a(Hash)
+ end
+
+ describe "#to_hash" do
+ it "should return a new instance of a Hash object" do
+- Settings.to_hash.should be_kind_of(Hash)
+- Settings.to_hash.class.name.should == "Hash"
+- Settings.to_hash.object_id.should_not == Settings.object_id
++ expect(Settings.to_hash).to be_kind_of(Hash)
++ expect(Settings.to_hash.class.name).to eq("Hash")
++ expect(Settings.to_hash.object_id).not_to eq(Settings.object_id)
+ end
+ end
+
diff --git a/debian/patches/series b/debian/patches/series
index 7dafdb0..2d848d7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
+0002-rpsec3-port.patch
0001-Replace-git-ls-files-with-Dir-list.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-settingslogic.git
More information about the Pkg-ruby-extras-commits
mailing list