[DRE-commits] [ruby-attr-required] 01/01: Fix tests to support RSpec 3
Balasankar C
balasankarc-guest at moszumanska.debian.org
Mon Jun 29 12:36:54 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-attr-required.
commit a66c017e210eb51e4068389bb16a8c9c48a56505
Author: Balasankar C <balasankarc at autistici.org>
Date: Sat Jun 27 12:44:18 2015 +0530
Fix tests to support RSpec 3
---
debian/changelog | 6 +
debian/patches/rspec3 | 377 ++++++++++++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 384 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 73b0f6f..b7b1dc9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ruby-attr-required (1.0.0-2) unstable; urgency=medium
+
+ * Modify tests to support RSpec 3
+
+ -- Balasankar C <balasankarc at autistici.org> Sat, 27 Jun 2015 12:43:31 +0530
+
ruby-attr-required (1.0.0-1) unstable; urgency=medium
* Initial release (Closes: #785550)
diff --git a/debian/patches/rspec3 b/debian/patches/rspec3
new file mode 100644
index 0000000..3dadb89
--- /dev/null
+++ b/debian/patches/rspec3
@@ -0,0 +1,377 @@
+Description: Patch tests to support RSpec 3
+ Change `should` to `expect` and similar changes so as to support RSpec 3.
+Author: Balasankar C <balasankarc at autistici.org>
+Forwarded: not-needed
+Last-Update: 2015-06-27
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/spec/attr_optional_spec.rb
++++ b/spec/attr_optional_spec.rb
+@@ -1,75 +1,75 @@
+ require 'spec_helper.rb'
+
+ describe AttrOptional do
+- before do
+- @a, @b, @c = A.new, B.new, C.new
+- end
+-
+- describe '.attr_optional' do
+- it 'should define accessible attributes' do
+- @a.should respond_to :attr_optional_a
+- @a.should respond_to :attr_optional_a=
+- @b.should respond_to :attr_optional_b
+- @b.should respond_to :attr_optional_b=
+- end
+-
+- it 'should be inherited' do
+- @b.should respond_to :attr_optional_a
+- @b.should respond_to :attr_optional_a=
+- end
+-
+- context 'when already required' do
+- it 'should be optional' do
+- @c.attr_required?(:attr_required_b).should be_false
+- @c.attr_optional?(:attr_required_b).should be_true
+- end
+- end
+-
+- context 'when AttrRequired not included' do
+- it 'should do nothing' do
+- OnlyOptional.optional_attributes.should == [:only_optional]
+- end
+- end
+- end
+-
+- describe '.attr_optional?' do
+- it 'should answer whether the attributes is optional or not' do
+- A.attr_optional?(:attr_optional_a).should be_true
+- B.attr_optional?(:attr_optional_a).should be_true
+- B.attr_optional?(:attr_optional_b).should be_true
+- B.attr_optional?(:to_s).should be_false
+- end
+- end
+-
+- describe '#attr_optional?' do
+- it 'should answer whether the attributes is optional or not' do
+- @a.attr_optional?(:attr_optional_a).should be_true
+- @b.attr_optional?(:attr_optional_a).should be_true
+- @b.attr_optional?(:attr_optional_b).should be_true
+- @b.attr_optional?(:to_s).should be_false
+- end
+- end
+-
+- describe '.optional_attributes' do
+- it 'should return all optional attributes keys' do
+- A.optional_attributes.should == [:attr_optional_a]
+- B.optional_attributes.should == [:attr_optional_a, :attr_optional_b]
+- end
+- end
+-
+- describe '#optional_attributes' do
+- it 'should return optional attributes keys' do
+- @a.optional_attributes.should == [:attr_optional_a]
+- @b.optional_attributes.should == [:attr_optional_a, :attr_optional_b]
++ before do
++ @a, @b, @c = A.new, B.new, C.new
+ end
+- end
+
+- describe '.undef_optional_attributes' do
+- it 'should undefine accessors and remove from optional attributes' do
+- C.optional_attributes.should_not include :attr_optional_a
+- @c.optional_attributes.should_not include :attr_optional_a
+- @c.should_not respond_to :attr_optional_a
+- @c.should_not respond_to :attr_optional_a=
++ describe '.attr_optional' do
++ it 'should define accessible attributes' do
++ expect(@a).to respond_to :attr_optional_a
++ expect(@a).to respond_to :attr_optional_a=
++ expect(@b).to respond_to :attr_optional_b
++ expect(@b).to respond_to :attr_optional_b=
++ end
++
++ it 'should be inherited' do
++ expect(@b).to respond_to :attr_optional_a
++ expect(@b).to respond_to :attr_optional_a=
++ end
++
++ context 'when already required' do
++ it 'should be optional' do
++ expect(@c.attr_required?(:attr_required_b)).to be_falsey
++ expect(@c.attr_optional?(:attr_required_b)).to be_truthy
++ end
++ end
++
++ context 'when AttrRequired not included' do
++ it 'should do nothing' do
++ expect(OnlyOptional.optional_attributes).to eq([:only_optional])
++ end
++ end
++ end
++
++ describe '.attr_optional?' do
++ it 'should answer whether the attributes is optional or not' do
++ expect(A.attr_optional?(:attr_optional_a)).to be_truthy
++ expect(B.attr_optional?(:attr_optional_a)).to be_truthy
++ expect(B.attr_optional?(:attr_optional_b)).to be_truthy
++ expect(B.attr_optional?(:to_s)).to be_falsey
++ end
++ end
++
++ describe '#attr_optional?' do
++ it 'should answer whether the attributes is optional or not' do
++ expect(@a.attr_optional?(:attr_optional_a)).to be_truthy
++ expect(@b.attr_optional?(:attr_optional_a)).to be_truthy
++ expect(@b.attr_optional?(:attr_optional_b)).to be_truthy
++ expect(@b.attr_optional?(:to_s)).to be_falsey
++ end
++ end
++
++ describe '.optional_attributes' do
++ it 'should return all optional attributes keys' do
++ expect(A.optional_attributes).to eq([:attr_optional_a])
++ expect(B.optional_attributes).to eq([:attr_optional_a, :attr_optional_b])
++ end
++ end
++
++ describe '#optional_attributes' do
++ it 'should return optional attributes keys' do
++ expect(@a.optional_attributes).to eq([:attr_optional_a])
++ expect(@b.optional_attributes).to eq([:attr_optional_a, :attr_optional_b])
++ end
++ end
++
++ describe '.undef_optional_attributes' do
++ it 'should undefine accessors and remove from optional attributes' do
++ expect(C.optional_attributes).not_to include :attr_optional_a
++ expect(@c.optional_attributes).not_to include :attr_optional_a
++ expect(@c).not_to respond_to :attr_optional_a
++ expect(@c).not_to respond_to :attr_optional_a=
++ end
+ end
+- end
+ end
+--- a/spec/attr_required_spec.rb
++++ b/spec/attr_required_spec.rb
+@@ -1,113 +1,113 @@
+ require 'spec_helper.rb'
+
+ describe AttrRequired do
+- before do
+- @a, @b, @c = A.new, B.new, C.new
+- end
+-
+- describe '.attr_required' do
+- it 'should define accessible attributes' do
+- @a.should respond_to :attr_required_a
+- @a.should respond_to :attr_required_a=
+- @b.should respond_to :attr_required_b
+- @b.should respond_to :attr_required_b=
+- end
+-
+- it 'should be inherited' do
+- @b.should respond_to :attr_required_a
+- @b.should respond_to :attr_required_a=
+- end
+-
+- context 'when already optional' do
+- it 'should be optional' do
+- @c.attr_required?(:attr_optional_b).should be_true
+- @c.attr_optional?(:attr_optional_b).should be_false
+- end
+- end
+-
+- context 'when AttrOptional not included' do
+- it 'should do nothing' do
+- OnlyRequired.required_attributes.should == [:only_required]
+- end
+- end
+- end
+-
+- describe '.attr_required?' do
+- it 'should answer whether the attributes is required or not' do
+- A.attr_required?(:attr_required_a).should be_true
+- B.attr_required?(:attr_required_a).should be_true
+- B.attr_required?(:attr_required_b).should be_true
+- B.attr_required?(:to_s).should be_false
+- end
+- end
+-
+- describe '#attr_required?' do
+- it 'should answer whether the attributes is required or not' do
+- @a.attr_required?(:attr_required_a).should be_true
+- @b.attr_required?(:attr_required_a).should be_true
+- @b.attr_required?(:attr_required_b).should be_true
+- @a.attr_required?(:attr_required_b).should be_false
+- @b.attr_required?(:to_s).should be_false
+- end
+- end
+-
+- describe '#attr_missing?' do
+- it 'should answer whether any attributes are missing' do
+- @a.attr_missing?.should be_true
+- @b.attr_missing?.should be_true
+- @a.attr_required_a = 'attr_required_a'
+- @b.attr_required_a = 'attr_required_a'
+- @a.attr_missing?.should be_false
+- @b.attr_missing?.should be_true
+- @b.attr_required_b = 'attr_required_b'
+- @b.attr_missing?.should be_false
+- end
+- end
+-
+- describe '#attr_missing!' do
+- it 'should raise AttrMissing error when any attributes are missing' do
+- lambda { @a.attr_missing! }.should raise_error(AttrRequired::AttrMissing)
+- lambda { @b.attr_missing! }.should raise_error(AttrRequired::AttrMissing)
+- @a.attr_required_a = 'attr_required_a'
+- @b.attr_required_a = 'attr_required_a'
+- lambda { @a.attr_missing! }.should_not raise_error
+- lambda { @b.attr_missing! }.should raise_error(AttrRequired::AttrMissing)
+- @b.attr_required_b = 'attr_required_b'
+- lambda { @b.attr_missing! }.should_not raise_error
+- end
+- end
+-
+- describe '#attr_missing' do
+- it 'should return missing attributes keys' do
+- @a.attr_missing.should == [:attr_required_a]
+- @b.attr_missing.should == [:attr_required_a, :attr_required_b]
+- @a.attr_required_a = 'attr_required_a'
+- @b.attr_required_a = 'attr_required_a'
+- @a.attr_missing.should == []
+- @b.attr_missing.should == [:attr_required_b]
+- end
+- end
+-
+- describe '.required_attributes' do
+- it 'should return all required attributes keys' do
+- A.required_attributes.should == [:attr_required_a]
+- B.required_attributes.should == [:attr_required_a, :attr_required_b]
+- end
+- end
+-
+- describe '#required_attributes' do
+- it 'should return required attributes keys' do
+- @a.required_attributes.should == [:attr_required_a]
+- @b.required_attributes.should == [:attr_required_a, :attr_required_b]
+- end
+- end
+-
+- describe '.undef_required_attributes' do
+- it 'should undefine accessors and remove from required attributes' do
+- C.required_attributes.should_not include :attr_required_a
+- @c.required_attributes.should_not include :attr_required_a
+- @c.should_not respond_to :attr_required_a
+- @c.should_not respond_to :attr_required_a=
++ before do
++ @a, @b, @c = A.new, B.new, C.new
++ end
++
++ describe '.attr_required' do
++ it 'should define accessible attributes' do
++ expect(@a).to respond_to :attr_required_a
++ expect(@a).to respond_to :attr_required_a=
++ expect(@b).to respond_to :attr_required_b
++ expect(@b).to respond_to :attr_required_b=
++ end
++
++ it 'should be inherited' do
++ expect(@b).to respond_to :attr_required_a
++ expect(@b).to respond_to :attr_required_a=
++ end
++
++ context 'when already optional' do
++ it 'should be optional' do
++ expect(@c.attr_required?(:attr_optional_b)).to be_truthy
++ expect(@c.attr_optional?(:attr_optional_b)).to be_falsey
++ end
++ end
++
++ context 'when AttrOptional not included' do
++ it 'should do nothing' do
++ expect(OnlyRequired.required_attributes).to eq([:only_required])
++ end
++ end
++ end
++
++ describe '.attr_required?' do
++ it 'should answer whether the attributes is required or not' do
++ expect(A.attr_required?(:attr_required_a)).to be_truthy
++ expect(B.attr_required?(:attr_required_a)).to be_truthy
++ expect(B.attr_required?(:attr_required_b)).to be_truthy
++ expect(B.attr_required?(:to_s)).to be_falsey
++ end
++ end
++
++ describe '#attr_required?' do
++ it 'should answer whether the attributes is required or not' do
++ expect(@a.attr_required?(:attr_required_a)).to be_truthy
++ expect(@b.attr_required?(:attr_required_a)).to be_truthy
++ expect(@b.attr_required?(:attr_required_b)).to be_truthy
++ expect(@a.attr_required?(:attr_required_b)).to be_falsey
++ expect(@b.attr_required?(:to_s)).to be_falsey
++ end
++ end
++
++ describe '#attr_missing?' do
++ it 'should answer whether any attributes are missing' do
++ expect(@a.attr_missing?).to be_truthy
++ expect(@b.attr_missing?).to be_truthy
++ @a.attr_required_a = 'attr_required_a'
++ @b.attr_required_a = 'attr_required_a'
++ expect(@a.attr_missing?).to be_falsey
++ expect(@b.attr_missing?).to be_truthy
++ @b.attr_required_b = 'attr_required_b'
++ expect(@b.attr_missing?).to be_falsey
++ end
++ end
++
++ describe '#attr_missing!' do
++ it 'should raise AttrMissing error when any attributes are missing' do
++ expect(lambda { @a.attr_missing! }).to raise_error(AttrRequired::AttrMissing)
++ expect(lambda { @b.attr_missing! }).to raise_error(AttrRequired::AttrMissing)
++ @a.attr_required_a = 'attr_required_a'
++ @b.attr_required_a = 'attr_required_a'
++ expect(lambda { @a.attr_missing! }).not_to raise_error
++ expect(lambda { @b.attr_missing! }).to raise_error(AttrRequired::AttrMissing)
++ @b.attr_required_b = 'attr_required_b'
++ expect(lambda { @b.attr_missing! }).not_to raise_error
++ end
++ end
++
++ describe '#attr_missing' do
++ it 'should return missing attributes keys' do
++ expect(@a.attr_missing).to eq([:attr_required_a])
++ expect(@b.attr_missing).to eq([:attr_required_a, :attr_required_b])
++ @a.attr_required_a = 'attr_required_a'
++ @b.attr_required_a = 'attr_required_a'
++ expect(@a.attr_missing).to eq([])
++ expect(@b.attr_missing).to eq([:attr_required_b])
++ end
++ end
++
++ describe '.required_attributes' do
++ it 'should return all required attributes keys' do
++ expect(A.required_attributes).to eq([:attr_required_a])
++ expect(B.required_attributes).to eq([:attr_required_a, :attr_required_b])
++ end
++ end
++
++ describe '#required_attributes' do
++ it 'should return required attributes keys' do
++ expect(@a.required_attributes).to eq([:attr_required_a])
++ expect(@b.required_attributes).to eq([:attr_required_a, :attr_required_b])
++ end
++ end
++
++ describe '.undef_required_attributes' do
++ it 'should undefine accessors and remove from required attributes' do
++ expect(C.required_attributes).not_to include :attr_required_a
++ expect(@c.required_attributes).not_to include :attr_required_a
++ expect(@c).not_to respond_to :attr_required_a
++ expect(@c).not_to respond_to :attr_required_a=
++ end
+ end
+- end
+ end
diff --git a/debian/patches/series b/debian/patches/series
index f958273..5362c01 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
+rspec3
simplecov
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-attr-required.git
More information about the Pkg-ruby-extras-commits
mailing list