elabs_matchers 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ea9a74fa4f2ca64a3012cfc9a346b1e777d33d06
4
- data.tar.gz: d121cad77df6dbb96f2f62db863f78ebf9a66018
2
+ SHA256:
3
+ metadata.gz: 764469411826ae33c1be2491791a22ac35d8e89687c989360cd69fdcc4588a54
4
+ data.tar.gz: 9d99ee28c4935b3dffada4cc265fdfbae3ef66b088ac814e68d6b1455a6f3c63
5
5
  SHA512:
6
- metadata.gz: ea7c889c95d905c3d4aeade51a8fc31aded76c1cb184d4ed5e8304a06e1dfa4eb6675b327cf7a9c1a5ff26863c58bd1d0605ef6b860fdb18dbf2eab95361bb7a
7
- data.tar.gz: 22d264bc8501ed5723c050d8437696e0cc8699a440909eeab00521405877b34c3824857d6fb37a67608bd02505357f5a83706f407100b59246a45b03ba8bf05b
6
+ metadata.gz: b3ab4350c66faad2115534871c6cc207cf66dc6cb13cfde7a95e3d58f1ffbfa3a814aa48407303f5697bd27cc316a52ab5832570a441d35d3379bf175687d7d5
7
+ data.tar.gz: d3036201216b23d22fe9c735206a53c2c95ced67f5750d3b86c37489124c963f37205dccfdb9eb5aa39af411512334f7b6c125b38441112e6da5a5f3eb39e158
data/README.md CHANGED
@@ -24,7 +24,6 @@ gem "elabs_matchers"
24
24
  ```ruby
25
25
  record.should be_valid_with("Blog post").as(:title)
26
26
  hash.contain_hash({ "baz" => "bar" })
27
- array.only_include("bar", "foo")
28
27
  record.should persist(:title, "Blog post")
29
28
  ```
30
29
 
@@ -79,7 +78,7 @@ The gem's test suite should also serve as detailed documentation for each matche
79
78
 
80
79
  ## Development
81
80
 
82
- See [devlopment.txt](https://github.com/elabs/elabs_matchers/blob/master/development.rb)
81
+ See [development.md](https://github.com/elabs/elabs_matchers/blob/master/development.md)
83
82
 
84
83
  ## Contributors
85
84
 
@@ -1,5 +1,5 @@
1
1
  ## Setting up:
2
- #
2
+
3
3
  1. Fork the gem
4
4
  2. Clone you fork to your local machine
5
5
  3. Run:
@@ -8,7 +8,7 @@
8
8
  rspec
9
9
 
10
10
  ## Pull requests:
11
- #
11
+
12
12
  Pull requests are appreciated. Before submitting please consider the following:
13
13
 
14
14
  * Public methods are documented.
data/history.txt CHANGED
@@ -1,3 +1,9 @@
1
+ # Version 2.0.1
2
+
3
+ - Use `attribute_names` in favor of `keys` due to Rails 6.1 deprecation (#8)
4
+ - Deprecate `only_include` in favor of Rspec's own (#10)
5
+ - Documentation and file-name fixes (#7)
6
+
1
7
  # Version 2.0.0
2
8
 
3
9
  ### Changed
@@ -83,7 +83,7 @@ module ElabsMatchers
83
83
  record.valid?
84
84
 
85
85
  attributes.map do |attribute|
86
- record.errors.keys.include?(attribute)
86
+ record.errors.attribute_names.include?(attribute)
87
87
  end
88
88
  end
89
89
 
@@ -7,6 +7,8 @@ module ElabsMatchers
7
7
  attr_reader :actual
8
8
 
9
9
  def matches?(actual)
10
+ deprecated
11
+
10
12
  @actual = actual
11
13
  elements.uniq.length == elements.length and
12
14
  actual.length == elements.length and
@@ -22,6 +24,14 @@ module ElabsMatchers
22
24
  "Expected #{actual.inspect} to not only include #{elements.inspect}, but it did."
23
25
  end
24
26
  alias_method :failure_message_for_should_not, :failure_message_when_negated
27
+
28
+ private
29
+
30
+ def deprecated
31
+ warn %Q{
32
+ [DEPRECATION] `only_include` is deprecated. Please use rspec's `contain_exactly` instead. Called from #{Kernel.caller.first}
33
+ }
34
+ end
25
35
  end
26
36
 
27
37
  ##
@@ -1,3 +1,3 @@
1
1
  module ElabsMatchers
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -4,6 +4,10 @@ describe ElabsMatchers::Matchers::OnlyInclude do
4
4
  subject { %w[foo bar] }
5
5
 
6
6
  describe "#only_include" do
7
+ before do
8
+ allow_any_instance_of(ElabsMatchers::Matchers::OnlyInclude::OnlyIncludeMatcher).to receive(:deprecated)
9
+ end
10
+
7
11
  it "returns true when all the elements are passed in the wrong order" do
8
12
  should only_include("bar", "foo")
9
13
  expect { should only_include("quox", "foo") }.to fail_assertion
@@ -28,5 +32,14 @@ describe ElabsMatchers::Matchers::OnlyInclude do
28
32
  should_not only_include("foo", "bar", "baz")
29
33
  expect { should_not only_include("foo", "bar") }.to fail_assertion
30
34
  end
35
+
36
+ it "is deprecated" do
37
+ matcher = ElabsMatchers::Matchers::OnlyInclude::OnlyIncludeMatcher.new(
38
+ elements: %w[foo bar]
39
+ )
40
+ allow(matcher).to receive(:deprecated)
41
+ matcher.matches?("foo")
42
+ expect(matcher).to have_received(:deprecated)
43
+ end
31
44
  end
32
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elabs_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Everyone at Elabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-14 00:00:00.000000000 Z
11
+ date: 2021-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -148,7 +148,7 @@ files:
148
148
  - Gemfile
149
149
  - README.md
150
150
  - Rakefile
151
- - development.txt
151
+ - development.md
152
152
  - doc/ElabsMatchers.html
153
153
  - doc/ElabsMatchers/Helpers.html
154
154
  - doc/ElabsMatchers/Helpers/Fixtures.html
@@ -245,8 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  - !ruby/object:Gem::Version
246
246
  version: '0'
247
247
  requirements: []
248
- rubyforge_project: elabs_matchers
249
- rubygems_version: 2.6.14
248
+ rubygems_version: 3.2.25
250
249
  signing_key:
251
250
  specification_version: 4
252
251
  summary: Provides a set of useful rspec matchers