[DRE-commits] [ruby-virtus] 02/03: Make tests run

Balasankar C balasankarc-guest at moszumanska.debian.org
Fri Jan 29 17:56:21 UTC 2016


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

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

commit 2a37b8a08ab9217e1d2d0c4f4780eb91e540ec44
Author: Balasankar C <balasankarc at autistici.org>
Date:   Fri Jan 29 23:24:19 2016 +0530

    Make tests run
---
 debian/patches/fix-tests.patch | 136 +++++++++++++++++++++++++++++++++++++++++
 debian/patches/series          |   1 +
 2 files changed, 137 insertions(+)

diff --git a/debian/patches/fix-tests.patch b/debian/patches/fix-tests.patch
new file mode 100644
index 0000000..af51193
--- /dev/null
+++ b/debian/patches/fix-tests.patch
@@ -0,0 +1,136 @@
+Description: Fix failing tests
+Author: Sergey Novik <konnigun at gmail.com>
+Applied-Upstream: https://github.com/solnic/virtus/pull/333
+Last-Update: 2016-01-29
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/lib/virtus/attribute.rb
++++ b/lib/virtus/attribute.rb
+@@ -18,7 +18,7 @@
+   class Attribute
+     extend DescendantsTracker, Options, TypeLookup
+ 
+-    include ::Equalizer.new(:type, :options)
++    include Equalizer.new(inspect) << :type << :options
+ 
+     accept_options :primitive, :accessor, :default, :lazy, :strict, :required, :finalize, :nullify_blank
+ 
+--- a/lib/virtus/attribute/default_value.rb
++++ b/lib/virtus/attribute/default_value.rb
+@@ -7,6 +7,8 @@
+     class DefaultValue
+       extend DescendantsTracker
+ 
++      include Equalizer.new(inspect) << :value
++
+       # Builds a default value instance
+       #
+       # @return [Virtus::Attribute::DefaultValue]
+--- a/lib/virtus/coercer.rb
++++ b/lib/virtus/coercer.rb
+@@ -3,6 +3,7 @@
+   # Abstract coercer class
+   #
+   class Coercer
++    include Equalizer.new(inspect) << :primitive << :type
+ 
+     # @api private
+     attr_reader :primitive, :type
+--- a/spec/unit/virtus/attribute_set/append_spec.rb
++++ b/spec/unit/virtus/attribute_set/append_spec.rb
+@@ -38,10 +38,10 @@
+ 
+     it { is_expected.to equal(object) }
+ 
+-    it 'replaces the original attribute' do
+-      expect { subject }.to change { object.to_a }.
+-        from(attributes).
+-        to([ attribute ])
++    it "replaces the original attribute object" do
++      expect { subject }.to change { object.to_a.map(&:__id__) }.
++      from(attributes.map(&:__id__)).
++      to([attribute.__id__])
+     end
+   end
+ end
+--- a/spec/unit/virtus/attribute_set/element_set_spec.rb
++++ b/spec/unit/virtus/attribute_set/element_set_spec.rb
+@@ -37,20 +37,28 @@
+ 
+     it { is_expected.to equal(attribute) }
+ 
+-    it 'replaces the original attribute' do
+-      expect { subject }.to change { object.to_a }.from(attributes).to([ attribute ])
++    it "replaces the original attribute object" do
++      expect { subject }.to change { object.to_a.map(&:__id__) }.
++      from(attributes.map(&:__id__)).
++      to([attribute.__id__])
+     end
+ 
+-    it 'allows #[] to access the attribute with a symbol' do
+-      expect { subject }.to change { object['name'] }.from(original).to(attribute)
++    it 'allows #[] to access the attribute with a string' do
++      expect { subject }.to change { object['name'].__id__ }.
++      from(original.__id__).
++      to(attribute.__id__)
+     end
+ 
+-    it 'allows #[] to access the attribute with a string' do
+-      expect { subject }.to change { object[:name] }.from(original).to(attribute)
++    it 'allows #[] to access the attribute with a symbol' do
++      expect { subject }.to change { object[:name].__id__ }.
++      from(original.__id__).
++      to(attribute.__id__)
+     end
+ 
+     it 'allows #reset to track overridden attributes' do
+-      expect { subject }.to change { object.reset.to_a }.from(attributes).to([ attribute ])
++      expect { subject }.to change { object.reset.to_a.map(&:__id__) }.
++      from(attributes.map(&:__id__)).
++      to([attribute.__id__])
+     end
+   end
+ end
+--- a/spec/unit/virtus/attribute_set/merge_spec.rb
++++ b/spec/unit/virtus/attribute_set/merge_spec.rb
+@@ -21,12 +21,14 @@
+ 
+   context 'with a duplicate attribute' do
+     let(:attributes) { [Virtus::Attribute.build(String, :name => name)] }
+-    let(:attribute)  { Virtus::Attribute.build(String, :name => name) }
++    let(:attribute)  {  Virtus::Attribute.build(String, :name => name) }
+ 
+     it { is_expected.to equal(object) }
+ 
+-    it 'replaces the original attribute' do
+-      expect { subject }.to change { object.to_a }.from(attributes).to([attribute])
++    it "replaces the original attribute object" do
++      expect { subject }.to change { object.to_a.map(&:__id__) }.
++      from(attributes.map(&:__id__)).
++      to([attribute.__id__])
+     end
+   end
+ end
+--- /dev/null
++++ b/spec/unit/virtus/attribute/comparison_spec.rb
+@@ -0,0 +1,20 @@
++require 'spec_helper'
++
++describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do
++  let(:attribute) { described_class.build(String, :name => :name) }
++
++  it 'returns true when attributes have same type and options' do
++    equal_attribute = described_class.build(String, :name => :name)
++    expect(attribute == equal_attribute).to be_truthy
++  end
++
++  it 'returns false when attributes have different type' do
++    different_attribute = described_class.build(Integer, :name => :name)
++    expect(attribute == different_attribute).to be_falsey
++  end
++
++  it 'returns false when attributes have different options' do
++    different_attribute = described_class.build(Integer, :name => :name_two)
++    expect(attribute == different_attribute).to be_falsey
++  end
++end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d04b329
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-tests.patch

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



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