rspec-collection_matchers 1.0.0 → 1.1.0

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
2
  SHA1:
3
- metadata.gz: 86033281a3678444334d1e1cf880efa504c4266d
4
- data.tar.gz: 1cca65c5b89d5ba99522ccf4e6e97bd9baca32e5
3
+ metadata.gz: faaf9c8611959593b7239c07f886daa9574880ae
4
+ data.tar.gz: f655c3df99261b8fe162c11c5915a9b5c2f9e29e
5
5
  SHA512:
6
- metadata.gz: 2d79a9e118392ac26979226c828600a65e2686f36a3f97c1bfdf7dc198bab48d3fb89e9538002410e437f1c536c099f662f7516992beaef48f1200f174f8d63e
7
- data.tar.gz: bab2277dd6b827e6cfe7c8ed758896afc896a5b06c77f02f6cb22f9abd08c399a31f86dd9bd822af59a1256881d323f470927293a661f7a6073a6be4aa1ef4d7
6
+ metadata.gz: d169d56403d92a256ad2efe912c28714816ffb9dcac8b77fbb34b20bc6126b159bd5b4456980c8a2234193ecb7aceaf234102115bf634c57910d1cddfa44c94d
7
+ data.tar.gz: e1bb78d0844f4c94c266649e08e42b39edb9ac6bf362b0e634884606fb33f7d941547973715b05cb8f6d7a9a3c622c15a4d1db429e4541e3c051fdc763b45572
@@ -1,3 +1,15 @@
1
+ ### Development
2
+
3
+ [full changelog](http://github.com/rspec/rspec-collection_matchers/compare/v1.0.0...master)
4
+
5
+ Enhancements:
6
+
7
+ * Make matchers composable on RSpec 3 and above. (Johnson Denen, #19)
8
+
9
+ ### 1.0.0 / 2014-06-09
10
+
11
+ [full changelog](http://github.com/rspec/rspec-collection_matchers/compare/v0.0.4...v1.0.0)
12
+
1
13
  ### 0.0.4 / 2014-04-24
2
14
 
3
15
  [full changelog](http://github.com/rspec/rspec-collection_matchers/compare/v0.0.3...v0.0.4)
@@ -1,6 +1,8 @@
1
1
  module RSpec
2
2
  module CollectionMatchers
3
3
  class Have
4
+ include RSpec::Matchers::Composable unless RSpec::Core::Version::STRING.to_f < 3.0
5
+
4
6
  QUERY_METHODS = [:size, :length, :count].freeze
5
7
  IGNORED_CLASSES = [Integer].freeze
6
8
 
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module CollectionMatchers
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -384,6 +384,52 @@ EOF
384
384
  end
385
385
  end
386
386
 
387
+ describe "expectations compounded with RSpec::Matchers::Composable", :if => defined?(RSpec::Matchers::Composable) do
388
+ context "using #and" do
389
+ it "fails with relevant error when only first expectation fails" do
390
+ expect {
391
+ expect([1, 2, 3]).to be_falsey.and have(3).items
392
+ }.to fail_matching "expected: falsey value"
393
+ end
394
+
395
+ it "fails with relevant error when only second expectation fails" do
396
+ expect {
397
+ expect([1, 2, 3]).to have(3).items.and be_falsey
398
+ }.to fail_matching "expected: falsey value"
399
+ end
400
+
401
+ it "fails with relevant error when both expectations fail" do
402
+ expect {
403
+ expect([1, 2, 3]).to be_falsey.and have(0).items
404
+ }.to fail_matching "...and:"
405
+ end
406
+
407
+ it "passes when both expectations are met" do
408
+ expect([1, 2, 3]).to have(3).items.and be_truthy
409
+ end
410
+ end
411
+
412
+ context "using #or" do
413
+ it "fails with relevant error when neither expectation is met" do
414
+ expect {
415
+ expect([1, 2, 3]).to be_falsey.or have(0).items
416
+ }.to fail_matching "...or:"
417
+ end
418
+
419
+ it "passes when only first expectation is met" do
420
+ expect([1, 2, 3]).to have(3).items.or be_falsey
421
+ end
422
+
423
+ it "passes when only second expectation is met" do
424
+ expect([1, 2, 3]).to be_falsey.or have(3).items
425
+ end
426
+
427
+ it "passes when both expectations are met" do
428
+ expect([1, 2, 3]).to be_truthy.or have(3).items
429
+ end
430
+ end
431
+ end
432
+
387
433
  describe RSpec::CollectionMatchers::Have, "for a collection owner that implements #send" do
388
434
  before(:each) do
389
435
  @collection = Object.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-collection_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugo Baraúna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-expectations
@@ -105,7 +105,7 @@ rubyforge_project:
105
105
  rubygems_version: 2.2.2
106
106
  signing_key:
107
107
  specification_version: 4
108
- summary: rspec-collection_matchers-1.0.0
108
+ summary: rspec-collection_matchers-1.1.0
109
109
  test_files:
110
110
  - features/have.feature
111
111
  - features/support/env.rb