rspec-collection_matchers 1.2.0 → 1.2.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
2
  SHA256:
3
- metadata.gz: e43660c5a2622eb036fd9c25df4db49d446d347544eb96c8a4358d9960c8bb57
4
- data.tar.gz: d6ab46976808a1f520e7234f0322589215d17316d5d5bc005dd7c50eaf89a33a
3
+ metadata.gz: 6f855370067f7ba87dab3a0ceccc86eb3037530ac096faf23cc34e95dc711018
4
+ data.tar.gz: 4dd38d0be031f4c7a865297398918cb28e49afcea17bd54ecca7d749136688f2
5
5
  SHA512:
6
- metadata.gz: ae4028c0f65583927c66b5917e33647cd4e56369147d1e5eda0d0dab714bc62e1c103349c32d74e2eebed3b5d14b4bfef12d6dc916ca54de2591205fe39f30b4
7
- data.tar.gz: bc98fed176296eea54ef79db04cf74b036a6399d11a9bfdc521458ac24c09224245d385acffb75f0da949392d4567c9d4d31aa7b460137e6fc36bc00d7ea6071
6
+ metadata.gz: 3f4ca52d387d060ec33a219aa373512c9a1d59359adb71aa9b08d3caf7657d9dfd01102f93e55190d9f5042e95e7f9bf8f5ac8c8f5aa97d7fa62d7e9475b56f2
7
+ data.tar.gz: 57b7a7046d617bf39369b993b69e455a91eb09f29dae8d0287f066489a8869e5cad920861330f96b4ccd99a447a14640c003f0629eb3ff329dd0a40b279196df
@@ -0,0 +1,5 @@
1
+ # This file was generated on 2019-12-05T21:32:24+00:00 from the rspec-dev repo.
2
+ # DO NOT modify it by hand as your changes will get lost the next time it is generated.
3
+
4
+ github: [JonRowe]
5
+ open_collective: rspec
@@ -0,0 +1,69 @@
1
+ name: RSpec CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - 'main'
6
+ - '*-maintenance'
7
+ - '*-dev'
8
+ - 'pr-*'
9
+ pull_request:
10
+ branches:
11
+ - '*'
12
+ permissions:
13
+ contents: read
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.github.head_ref || github.run_id }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ test:
20
+ name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}'
21
+ runs-on: ubuntu-20.04
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ include:
26
+ - ruby: '3.2'
27
+ - ruby: '3.1'
28
+ - ruby: '3.0'
29
+ - ruby: 2.7
30
+ - ruby: 2.6
31
+ - ruby: 2.5
32
+ - ruby: 2.3
33
+ - ruby: 2.2
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: ${{ matrix.ruby }}
39
+ - run: script/update_rubygems_and_install_bundler
40
+ - run: bundle install --binstubs
41
+ - run: script/run_build
42
+
43
+ legacy:
44
+ name: Legacy Ruby Builds (${{ matrix.container.version }})
45
+ runs-on: ubuntu-20.04
46
+ container:
47
+ image: ${{ matrix.container.tag }}
48
+ options: ${{ matrix.container.options || '--add-host github-complains-if-this-is-empty.com:127.0.0.1' }}
49
+ strategy:
50
+ fail-fast: false
51
+ matrix:
52
+ include:
53
+ - container:
54
+ version: "2.1.9"
55
+ tag: ghcr.io/rspec/docker-ci:2.1.9
56
+ post: git config --global --add safe.directory `pwd`
57
+ - container:
58
+ version: "2.0"
59
+ tag: ghcr.io/rspec/docker-ci:2.0.0
60
+ - container:
61
+ version: "1.9.3"
62
+ tag: ghcr.io/rspec/docker-ci:1.9.3
63
+ env:
64
+ LEGACY_CI: true
65
+ steps:
66
+ - uses: actions/checkout@v3
67
+ - run: script/legacy_setup.sh
68
+ - run: ${{ matrix.container.post }}
69
+ - run: script/run_build
data/.rspec CHANGED
@@ -1,2 +1 @@
1
1
  --format documentation
2
- --color
data/Changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 1.2.1 / 2023-09-28
2
+
3
+ Bug Fixes:
4
+
5
+ * Support modern RSpec by defining #supports_value_expectations? on matcher.
6
+ (Jon Rowe, #52)
7
+
1
8
  ### 1.2.0 / 2019-09-18
2
9
 
3
10
  Enhancements:
data/Gemfile CHANGED
@@ -2,25 +2,30 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- %w[rspec rspec-core rspec-expectations rspec-mocks].each do |lib|
5
+ %w[rspec rspec-support rspec-core rspec-expectations rspec-mocks].each do |lib|
6
6
  library_path = File.expand_path("../../#{lib}", __FILE__)
7
7
  if File.exist?(library_path) && !ENV['USE_GIT_REPOS']
8
8
  gem lib, :path => library_path
9
9
  else
10
- gem lib, :git => "git://github.com/rspec/#{lib}.git",
11
- :branch => ENV.fetch('BRANCH',"master")
10
+ gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => ENV.fetch('BRANCH', 'main')
12
11
  end
13
12
  end
14
13
 
15
- # only the master branch is supported on rspec-support
16
- gem "rspec-support", :git => "git://github.com/rspec/rspec-support.git"
17
-
18
14
  gem "aruba"
19
- gem "rake", "~> 10.0.0"
15
+
16
+ if RUBY_VERSION < '1.9.3'
17
+ gem "rake", "~> 10.0.0" # rake 11 requires Ruby 1.9.3 or later
18
+ elsif RUBY_VERSION < '2.0.0'
19
+ gem "rake", "~> 11.0.0" # rake 12 requires Ruby 2.0.0 or later
20
+ elsif RUBY_VERSION < '2.2.0'
21
+ gem "rake", "~> 12.3.2" # rake 13 requires Ruby 2.2.0 or later
22
+ else
23
+ gem "rake", "~> 13.0.0"
24
+ end
20
25
 
21
26
  version_file = File.expand_path("../.rails-version", __FILE__)
22
27
  rails_gem_args = case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp)
23
- when /master/
28
+ when /main/
24
29
  { :git => "git://github.com/rails/rails.git" }
25
30
  when /stable$/
26
31
  { :git => "git://github.com/rails/rails.git", :branch => version }
@@ -46,14 +51,11 @@ if RUBY_VERSION.to_f < 2
46
51
  gem 'tins', '~> 1.6.0' # used by term-ansicolor
47
52
  else
48
53
  gem "cucumber"
54
+ gem "json", "> 2.3.0"
49
55
  end
50
56
 
51
57
  if RUBY_VERSION < '1.9.3'
52
58
  gem 'i18n', '< 0.7.0'
53
59
  end
54
60
 
55
- platform :rbx do
56
- gem 'rubysl'
57
- end
58
-
59
61
  eval File.read('Gemfile-custom') if File.exist?('Gemfile-custom')
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RSpec::CollectionMatchers [![Build Status](https://secure.travis-ci.org/rspec/rspec-collection_matchers.svg?branch=master)](http://travis-ci.org/rspec/rspec-collection_matchers)
1
+ # RSpec::CollectionMatchers [![Build Status](https://secure.travis-ci.org/rspec/rspec-collection_matchers.svg?branch=main)](http://travis-ci.org/rspec/rspec-collection_matchers)
2
2
 
3
3
  RSpec::CollectionMatchers lets you express expected outcomes on collections
4
4
  of an object in an example.
@@ -66,6 +66,7 @@ expect(collection).to have(n).items
66
66
  expect(collection).to have_exactly(n).items
67
67
  expect(collection).to have_at_most(n).items
68
68
  expect(collection).to have_at_least(n).items
69
+ expect(collection).to have(:no).items
69
70
  ```
70
71
 
71
72
  ## See also
@@ -24,6 +24,10 @@ module RSpec
24
24
  }
25
25
  end
26
26
 
27
+ def supports_value_expectations?
28
+ true
29
+ end
30
+
27
31
  if RUBY_VERSION == '1.9.2'
28
32
  # On Ruby 1.9.2 items that don't return an array for `to_ary`
29
33
  # can't be flattened in arrays, we need to be able to do this
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module CollectionMatchers
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ # This file was generated on 2023-06-26T13:27:27+01:00 from the rspec-dev repo.
3
+ # DO NOT modify it by hand as your changes will get lost the next time it is generated.
4
+
5
+ set -e
6
+
7
+ bundle install --standalone --binstubs --without coverage documentation
8
+
9
+ if [ -x ./bin/rspec ]; then
10
+ echo "RSpec bin detected"
11
+ else
12
+ if [ -x ./exe/rspec ]; then
13
+ cp ./exe/rspec ./bin/rspec
14
+ echo "RSpec restored from exe"
15
+ else
16
+ echo "No RSpec bin available"
17
+ exit 1
18
+ fi
19
+ fi
@@ -18,4 +18,3 @@ echo "Running cucumber specs"
18
18
  # shells out (via aruba) and executes `rspec`--which can pick up the wrong
19
19
  # rspec version if we're not running with bundler.
20
20
  bundle exec cucumber
21
-
@@ -0,0 +1,33 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ function is_ruby_31_plus {
6
+ if ruby -e "exit(RUBY_VERSION.to_f >= 3.1)"; then
7
+ return 0
8
+ else
9
+ return 1
10
+ fi
11
+ }
12
+
13
+ function is_ruby_23_plus {
14
+ if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
15
+ return 0
16
+ else
17
+ return 1
18
+ fi
19
+ }
20
+
21
+ if is_ruby_31_plus; then
22
+ echo "Installing rubygems 3.3.6 / bundler 2.3.6"
23
+ yes | gem update --system '3.3.6'
24
+ yes | gem install bundler -v '2.3.6'
25
+ elif is_ruby_23_plus; then
26
+ echo "Installing rubygems 3.2.22 / bundler 2.2.22"
27
+ yes | gem update --system '3.2.22'
28
+ yes | gem install bundler -v '2.2.22'
29
+ else
30
+ echo "Warning installing older versions of Rubygems / Bundler"
31
+ gem update --system '2.7.8'
32
+ gem install bundler -v '1.17.3'
33
+ fi
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'stringio'
3
3
 
4
- describe "have matcher" do
4
+ RSpec.describe "have matcher" do
5
5
  let(:inflector) do
6
6
  Class.new do
7
7
  def self.pluralize(string)
@@ -560,14 +560,12 @@ end
560
560
 
561
561
  module RSpec
562
562
  module CollectionMatchers
563
- describe Syntax do
563
+ RSpec.describe Syntax do
564
564
  describe "expression generation" do
565
565
  let(:target) { "foo" }
566
566
  let(:expectation) { "eq('bar')" }
567
567
  let(:positive_expect_example) { "expect(foo).to eq('bar')" }
568
- let(:positive_should_example) { "foo.should eq('bar')" }
569
568
  let(:negative_expect_example) { "expect(foo).not_to eq('bar')" }
570
- let(:negative_should_example) { "foo.should_not eq('bar')" }
571
569
 
572
570
  def positive_expression
573
571
  Syntax.positive_expression(target, expectation)
@@ -577,52 +575,14 @@ module RSpec
577
575
  Syntax.negative_expression(target, expectation)
578
576
  end
579
577
 
580
- context "when only :expect is enabled", :uses_only_expect do
581
- before do
582
- expect(Expectations::Syntax.should_enabled?).to be_falsey
583
- expect(Expectations::Syntax.expect_enabled?).to be_truthy
584
- end
585
-
586
- it 'generates a positive expression using the expect syntax' do
587
- expect(positive_expression).to eq(positive_expect_example)
588
- end
589
-
590
- it 'generates a negative expression using the expect syntax' do
591
- expect(negative_expression).to eq(negative_expect_example)
592
- end
578
+ it 'generates a positive expression using the expect syntax' do
579
+ expect(positive_expression).to eq(positive_expect_example)
593
580
  end
594
581
 
595
- context "when both :should and :expect are enabled", :uses_should do
596
- before do
597
- expect(Expectations::Syntax.should_enabled?).to be_truthy
598
- expect(Expectations::Syntax.expect_enabled?).to be_truthy
599
- end
600
-
601
- it 'generates a positive expression using the expect syntax' do
602
- expect(positive_expression).to eq(positive_expect_example)
603
- end
604
-
605
- it 'generates a negative expression using the expect syntax' do
606
- expect(negative_expression).to eq(negative_expect_example)
607
- end
608
- end
609
-
610
- context "when only :should is enabled", :uses_only_should do
611
- before do
612
- Expectations::Syntax.should_enabled?.should be_truthy
613
- Expectations::Syntax.expect_enabled?.should be_falsey
614
- end
615
-
616
- it 'generates a positive expression using the expect syntax' do
617
- positive_expression.should eq(positive_should_example)
618
- end
619
-
620
- it 'generates a negative expression using the expect syntax' do
621
- negative_expression.should eq(negative_should_example)
622
- end
582
+ it 'generates a negative expression using the expect syntax' do
583
+ expect(negative_expression).to eq(negative_expect_example)
623
584
  end
624
585
  end
625
-
626
586
  end
627
587
  end
628
588
  end
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require 'active_model'
3
3
 
4
4
  module RSpec::CollectionMatchers
5
- describe "Have extensions for rails" do
5
+ RSpec.describe "Have extensions for rails" do
6
6
  describe "error_on" do
7
7
  it "provides a description including the name of what the error is on" do
8
8
  expect(have(1).error_on(:whatever).description).to eq "have 1 error on :whatever"
data/spec/spec_helper.rb CHANGED
@@ -9,56 +9,8 @@ require 'rspec/collection_matchers'
9
9
  Dir['./spec/support/**/*'].each {|f| require f}
10
10
 
11
11
  RSpec.configure do |config|
12
- config.treat_symbols_as_metadata_keys_with_true_values = true if RSpec::Expectations::Version::STRING < "3.0"
13
- config.run_all_when_everything_filtered = true
14
- config.filter_run :focus
15
-
16
12
  config.order = 'random'
17
13
 
18
- config.expect_with :rspec do |rspec|
19
- rspec.syntax = :expect
20
- end
21
-
22
- config.mock_with :rspec do |rspec|
23
- rspec.syntax = :expect
24
- end
25
- end
26
-
27
- shared_context "with #should enabled", :uses_should do
28
- orig_syntax = nil
29
-
30
- before(:all) do
31
- orig_syntax = RSpec::Matchers.configuration.syntax
32
- RSpec::Matchers.configuration.syntax = [:expect, :should]
33
- end
34
-
35
- after(:all) do
36
- RSpec::Matchers.configuration.syntax = orig_syntax
37
- end
38
- end
39
-
40
- shared_context "with #should exclusively enabled", :uses_only_should do
41
- orig_syntax = nil
42
-
43
- before(:all) do
44
- orig_syntax = RSpec::Matchers.configuration.syntax
45
- RSpec::Matchers.configuration.syntax = :should
46
- end
47
-
48
- after(:all) do
49
- RSpec::Matchers.configuration.syntax = orig_syntax
50
- end
51
- end
52
-
53
- shared_context "with #expect exclusively enabled", :uses_only_expect do
54
- orig_syntax = nil
55
-
56
- before(:all) do
57
- orig_syntax = RSpec::Matchers.configuration.syntax
58
- RSpec::Matchers.configuration.syntax = :expect
59
- end
60
-
61
- after(:all) do
62
- RSpec::Matchers.configuration.syntax = orig_syntax
63
- end
14
+ config.expect_with :rspec
15
+ config.mock_with :rspec
64
16
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for "an RSpec matcher" do |options|
1
+ RSpec.shared_examples_for "an RSpec matcher" do |options|
2
2
  let(:valid_value) { options.fetch(:valid_value) }
3
3
  let(:invalid_value) { options.fetch(:invalid_value) }
4
4
 
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.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugo Baraúna
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-18 00:00:00.000000000 Z
11
+ date: 2023-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-expectations
@@ -59,9 +59,10 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".github/FUNDING.yml"
63
+ - ".github/workflows/ci.yml"
62
64
  - ".gitignore"
63
65
  - ".rspec"
64
- - ".travis.yml"
65
66
  - Changelog.md
66
67
  - Gemfile
67
68
  - LICENSE.txt
@@ -75,7 +76,9 @@ files:
75
76
  - lib/rspec/collection_matchers/rails_extensions.rb
76
77
  - lib/rspec/collection_matchers/version.rb
77
78
  - rspec-collection_matchers.gemspec
78
- - script/test_all
79
+ - script/legacy_setup.sh
80
+ - script/run_build
81
+ - script/update_rubygems_and_install_bundler
79
82
  - spec/rspec/collection_matchers/have_spec.rb
80
83
  - spec/rspec/collection_matchers/rails_extensions_spec.rb
81
84
  - spec/spec_helper.rb
@@ -87,11 +90,11 @@ licenses:
87
90
  - MIT
88
91
  metadata:
89
92
  bug_tracker_uri: https://github.com/rspec/rspec-collection_matchers/issues
90
- changelog_uri: https://github.com/rspec/rspec-collection_matchers/blob/v1.2.0/Changelog.md
93
+ changelog_uri: https://github.com/rspec/rspec-collection_matchers/blob/v1.2.1/Changelog.md
91
94
  documentation_uri: https://rspec.info/documentation/
92
95
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
93
96
  source_code_uri: https://github.com/rspec/rspec-collection_matchers
94
- post_install_message:
97
+ post_install_message:
95
98
  rdoc_options: []
96
99
  require_paths:
97
100
  - lib
@@ -106,10 +109,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
109
  - !ruby/object:Gem::Version
107
110
  version: '0'
108
111
  requirements: []
109
- rubygems_version: 3.0.3
110
- signing_key:
112
+ rubygems_version: 3.3.3
113
+ signing_key:
111
114
  specification_version: 4
112
- summary: rspec-collection_matchers-1.2.0
115
+ summary: rspec-collection_matchers-1.2.1
113
116
  test_files:
114
117
  - features/have.feature
115
118
  - features/support/env.rb
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- language: ruby
2
- script: "script/test_all"
3
- bundler_args: "--standalone --binstubs --without documentation"
4
- before_install:
5
- - gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)
6
- - gem update bundler --conservative
7
-
8
- # In order to install old Rubies, we need to use old Ubuntu distibution.
9
- dist: trusty
10
-
11
- rvm:
12
- - 1.8.7
13
- - 1.9.2
14
- - 1.9.3
15
- - 2.0.0
16
- - 2.1
17
- - 2.2.10
18
- - 2.3.8
19
- - 2.4.6
20
- - 2.5.5
21
- - 2.6.3
22
- - ree
23
- - jruby-19mode
24
- - jruby-18mode
25
- env:
26
- - BRANCH=master
27
- - BRANCH=2-99-maintenance