limit_detectors 1.0.0 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f398636cec36bb15d61697a991d57a6c68601e1e0c36fa1bc43331e07691dfd
4
- data.tar.gz: 8124df6653bdd41a652d8bbef5227af8f786623dd79a896d93570ac259530c73
3
+ metadata.gz: 1f2739af3259c36d8c55f08aba4d814781ebe7c1e2c5a84f8ac4a8af26b0cb94
4
+ data.tar.gz: '068d5a56be49cb9a7f3e2b5e01e206aeb8a077027ae9f1fad60eb164df27c4d5'
5
5
  SHA512:
6
- metadata.gz: fb52a0fe84e61ed1d555829baf489470e51ae6cbefa30fd5e9480aa59ef8e1470efe82c2ed0b4d9097e34353f9902535f6e6ac877346674eb6f2b2465cb284ef
7
- data.tar.gz: d131a52a266b894d03d9909213cd62b5edf6b2b6bece70d4ad3259da8becba4fc3e2b62203c59f62298fa16df9cf131bd06c603fe0d37e865f61c2f10d19065f
6
+ metadata.gz: c811dd513ff00ffe3a0137793c5beac36b3b3bc8f1195e3ba8e509e996803f1412580ecde191c6079cddd1d1252b2a51e8ca3bfc3e59ac31dac635ba8f1f4b33
7
+ data.tar.gz: e9a2166787d9fd5023e6fd5eda58b60900a48a05ca56f59e9e045df2ddbfb5368f0f2edfe31e90c7c587e9d1ba73df469c39769b1691200b7a3121931b72fe65
@@ -0,0 +1,32 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.7', '3.0', '3.1', 'jruby', 'truffleruby']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ - name: Run tests
32
+ run: bundle exec rake
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ Exclude:
4
+ - 'bin/**/*'
5
+
6
+ Style/EmptyMethod:
7
+ Enabled: false
8
+
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in limit_detectors.gemspec
4
6
  gemspec
5
-
data/README.md CHANGED
@@ -4,11 +4,12 @@ Some methods to detect whether an Enumberable object contains a constrained numb
4
4
 
5
5
  A second reason to create this gem is to explore various other services -- see the status list below.
6
6
 
7
- ## Stati
7
+
8
+ ## Status & Links
8
9
 
9
10
  * Version: [![Gem Version](https://badge.fury.io/rb/limit_detectors.svg)](http://badge.fury.io/rb/limit_detectors)
10
- * Travis CI: [![Build Status](https://travis-ci.org/s2k/limit_detectors.svg?branch=master)](https://travis-ci.org/s2k/limit_detectors)
11
- * Code Climate: [![Code Climate](https://codeclimate.com/github/s2k/limit_detectors.png)](https://codeclimate.com/github/s2k/limit_detectors)
11
+ * GitHub Actions: [![Main workflow: unit tests](https://github.com/s2k/limit_detectors/actions/workflows/ruby.yml/badge.svg)](https://github.com/s2k/limit_detectors/actions)
12
+ * Code Climate: [![Maintainability](https://api.codeclimate.com/v1/badges/f29deb5bcd4e2ad44d25/maintainability)](https://codeclimate.com/github/s2k/limit_detectors/maintainability)
12
13
 
13
14
 
14
15
  ## Installation
@@ -25,53 +26,84 @@ Or install it yourself as:
25
26
 
26
27
  $ gem install limit_detectors
27
28
 
29
+
28
30
  ## Usage
29
31
 
30
- In your code you can `require 'limit_detectors'` then define you classes (or use built-in classes like Array, Hash
31
- or other enumerable objects), extend these objects with LimitDetectors (or include the module in your class) and
32
- then call `at_most?` (or àt_least?') on your object.
32
+ In your code, you can `require 'limit_detectors'` then define your classes and `include` module `LimitDetectors` in your class, or create enumerable objects and `extend` these objects with `LimitDetectors`. Then call `at_most?` (or `t_least?`) on your object.
33
33
 
34
- For example:
34
+ For example using `pry`(you can use `irb` as well) you can do this:
35
35
 
36
- $pry -I lib -r limit_detectors
37
- [1] pry(main)> a = [1, 2, 3, 4, 5]
38
- => [1, 2, 3, 4, 5]
39
- [2] pry(main)> a.extend LimitDetectors
40
- => [1, 2, 3, 4, 5]
41
- [3] pry(main)> a.at_most?(4){|e| e.odd?}
42
- => true # There are indeed no more than 4 odd numbers in the array
43
- [4] pry(main)> a.at_most?(1){|e| e.even?}
44
- => false # In fact there are two even numbers in the array
36
+ ```ruby
37
+ [3] pry(main)> a.at_most?(4){|e| e.odd?}
38
+ => true # There are indeed no more than 4 odd numbers in the array
39
+ [4] pry(main)> a.at_most?(1){|e| e.even?}
40
+ => false # In fact there are two even numbers in the array
45
41
 
46
- ## Compatibility
42
+ $ pry -I lib -r limit_detectors
43
+ [1] pry(main)> a = [1, 2, 3, 4, 5]
44
+ => [1, 2, 3, 4, 5]
45
+ [2] pry(main)> a.extend LimitDetectors
46
+ => [1, 2, 3, 4, 5]
47
+ [3] pry(main)> a.at_most?(4){|e| e.odd?}
48
+ => true # There are indeed no more than 4 odd numbers in the array
49
+ [4] pry(main)> a.at_most?(4, &:odd?)
50
+ => true # The same behaviour using a different notation
51
+ [5] pry(main)> a.at_most?(1){|e| e.even?}
52
+ => false # In fact there are two even numbers in the array
53
+ ```
54
+
55
+ In code the usage may look like this (see example/example.rb for the file):
56
+
57
+ ```ruby
58
+ require 'limit_detectors'
59
+
60
+ class Example
61
+ include Enumerable
62
+ def each
63
+ ('a'..'d').each { |c| yield c }
64
+ end
65
+ end
66
+
67
+ e = Example.new
68
+ e.extend LimitDetectors
47
69
 
48
- Please note the current version of 0.0.something, which means the future releases
49
- may not be compatible with the current version.
70
+
71
+ puts e.at_least?(1) { |c| 'f' == c }
72
+ puts e.at_least?(1) { |c| 'b' == c }
73
+ puts e.at_most?(0) { |c| 'b' == c }
74
+ puts e.at_most?(42) { |c| 'b' == c }
75
+ ```
76
+
77
+
78
+ ## Compatibility
50
79
 
51
80
  This gem is tested with these Ruby versions (MRI, unless JRuby):
52
81
 
53
- - 2.5.8
54
- - 2.6.6
55
- - 2.7.1
82
+ - 2.7
83
+ - 3.0
84
+ - 3.1
56
85
 
57
- as well as a current version of JRuby.
86
+ as well as a current version of JRuby and TruffleRuby
58
87
 
59
88
  ## Contributing
60
89
 
61
- 1. Fork it ( https://github.com/[my-github-username]/limit_detectors/fork )
90
+ 1. Fork it ( https://github.com/[my-github-username]/limit_detectors/fork)
62
91
  2. Create your feature branch (`git checkout -b my-new-feature`)
63
92
  3. Commit your changes (`git commit -am 'Add some feature'`)
64
93
  4. Push to the branch (`git push origin my-new-feature`)
65
94
  5. Create a new Pull Request
66
95
 
96
+ A more detailed description is at https://opensource.com/article/19/7/create-pull-request-github
97
+
98
+
67
99
  ### Reporting a bug
68
100
 
69
101
  Please, provide answers to the following questions, when submitting a bug report:
70
102
 
71
- 1. What's actually happening? What the observed behaviour?
72
- 2. What's the expectation, i.e. what should have happened?
103
+ 1. What's _actually_ happening? What is the observed behaviour?
104
+ 2. What's the _expectation_, i.e. what should have happened?
73
105
  3. Why did you expect this behaviour?
74
106
 
75
- If you provide an RSpec check that demonstrates the bug, would give extra good karma,
107
+ If you provide an `RSpec` check that demonstrates the bug, would give extra good karma,
76
108
  especially in case of a minimal check, something that just demonstrates the bug without
77
109
  any (or much) overhead.
data/Rakefile CHANGED
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new :spec
5
7
 
6
- task :default => :spec
8
+ task default: :spec
7
9
 
8
10
  task :console do
9
11
  exec 'irb -I ./lib -r limit_detectors'
@@ -0,0 +1 @@
1
+ 99d4f0e4ec4d0b8b5cd4aadbd4e163d8d8d24de394061aa94d030d9149cf3f8e7420a8a9c46a3ec1c2036573c83b45a74a2c7f6f6ff51ae9539a0170164281ab
@@ -0,0 +1 @@
1
+ 16082d01316b0e5b34dbaf6ceacfcb94b5ed95aa46de740bb7272d03cac20ee2bfdcc71f290c2da1b7eb1c2aeaee0635760d37f257610c03ec02895a73c7d6e3
@@ -0,0 +1 @@
1
+ 97b5ec7acfdea83cdf0d55e3eff98ea27fc729fa95c56ee4599f7651140c1c872e140a1cf50f6c1da8b4f538dfd0a7b202a30e643b4d510dc62fbb277d211217
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'limit_detectors'
4
+
5
+ class Example
6
+ include Enumerable
7
+ def each(&block)
8
+ ('a'..'d').each(&block)
9
+ end
10
+ end
11
+
12
+ e = Example.new
13
+ e.extend LimitDetectors
14
+
15
+ puts e.at_least?(1) { |c| c == 'f' }
16
+ puts e.at_least?(1) { |c| c == 'b' }
17
+ puts e.at_most?(0) { |c| c == 'b' }
18
+ puts e.at_most?(42) { |c| c == 'b' }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LimitDetectors
2
- VERSION = '1.0.0'
4
+ VERSION = '1.0.4'
3
5
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'limit_detectors/version'
2
4
 
3
5
  module LimitDetectors
4
-
5
6
  # Deprecated, use at_most? instead
6
7
  def at_most(limit, &block)
7
8
  Kernel.warn "'at_most' is deprecated, use 'at_most?' instead"
@@ -17,22 +18,21 @@ module LimitDetectors
17
18
  # Check whether the condition given in the block
18
19
  # occurs at most limit times in the collection
19
20
  def at_most?(limit, &block)
20
- ocurrences_of(&block) <= limit
21
+ occurrences_of(&block) <= limit
21
22
  end
22
23
 
23
24
  # Check whether the condition given in the block
24
25
  # occurs at least limit times in the collection
25
26
  def at_least?(limit, &block)
26
- ocurrences_of(&block) >= limit
27
+ occurrences_of(&block) >= limit
27
28
  end
28
29
 
29
30
  # Count how often the condition given in the block
30
31
  # is met for the collection
31
- def ocurrences_of &block
32
- inject(0) { |res, el|
32
+ def occurrences_of
33
+ inject(0) do |res, el|
33
34
  res += 1 if yield el
34
35
  res
35
- }
36
+ end
36
37
  end
37
-
38
38
  end
@@ -1,5 +1,6 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'limit_detectors/version'
5
6
 
@@ -8,10 +9,11 @@ Gem::Specification.new do |spec|
8
9
  spec.version = LimitDetectors::VERSION
9
10
  spec.authors = ['Stephan Kämper']
10
11
  spec.email = ['the.tester@seasidetesting.com']
11
- spec.summary = %q{Detect certain conditions of elements of an Enumerable object}
12
- spec.description = %q{Some methods to detect whether an Enumerable object contains a constrained number of elements that match a given condition.}
12
+ spec.summary = 'Detect certain conditions of elements of an Enumerable object'
13
+ spec.description = 'Some methods to detect whether an Enumerable object contains a constrained number of elements that match a given condition.'
13
14
  spec.homepage = ''
14
15
  spec.license = 'MIT'
16
+ spec.required_ruby_version = '>= 2.7.0'
15
17
 
16
18
  spec.files = `git ls-files -z`.split("\x0")
17
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -19,8 +21,11 @@ Gem::Specification.new do |spec|
19
21
  spec.require_paths = ['lib']
20
22
 
21
23
  spec.add_development_dependency 'bundler'
22
- spec.add_development_dependency 'rake', '~> 13.0.3'
23
- spec.add_development_dependency 'rspec', '~> 3.10'
24
24
  spec.add_development_dependency 'pry', '~> 0.14.1'
25
- spec.add_development_dependency 'pry-doc', '~> 1.1.0'
25
+ spec.add_development_dependency 'pry-doc', '~> 1.2.0'
26
+ spec.add_development_dependency 'rake', '~> 13.0.6'
27
+ spec.add_development_dependency 'rspec', '~> 3.10'
28
+ spec.metadata = {
29
+ 'rubygems_mfa_required' => 'true'
30
+ }
26
31
  end
@@ -1,140 +1,137 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
 
3
- Array.send :include, LimitDetectors
5
+ Array.include LimitDetectors
4
6
 
5
7
  describe '#at_most' do
6
-
7
8
  it 'is true for an empty Array' do
8
9
  expect(Kernel).to_not receive(:warn)
9
- expect([].at_most?(5){ true }).to be_truthy
10
- expect([].at_most?(0){ true }).to be_truthy
11
- expect([].at_most?(1){ true }).to be_truthy
12
- expect([].at_most?(5){ :foo }).to be_truthy
10
+ expect([].at_most?(5) { true }).to be_truthy
11
+ expect([].at_most?(0) { true }).to be_truthy
12
+ expect([].at_most?(1) { true }).to be_truthy
13
+ expect([].at_most?(5) { :foo }).to be_truthy
13
14
  end
14
15
 
15
16
  it 'is true if the criterion is met once' do
16
- expect(["it's there"].at_most?(1){ |el| el == "it's there"}).to be_truthy
17
+ expect(["it's there"].at_most?(1) { |el| el == "it's there" }).to be_truthy
17
18
  end
18
19
 
19
20
  it 'is true if all elements meet the criterion and the size is the given maximum number' do
20
- expect([1,1,1].at_most?(3){|e| e == 1})
21
+ expect([1, 1, 1].at_most?(3) { |e| e == 1 })
21
22
  end
22
23
 
23
24
  it 'is false if not enough elements meet the criterion' do
24
- expect([1, 2, 4].at_most?(1){|e| e.even?}).to be_falsey
25
+ expect([1, 2, 4].at_most?(1, &:even?)).to be_falsey
25
26
  end
26
27
 
27
28
  it 'is true if 0 elements are expected to match' do
28
- r = Array.new(10){rand}
29
- expect(r.at_most?(0){ |i| i > 2 }).to be_truthy
29
+ r = Array.new(10) { rand }
30
+ expect(r.at_most?(0) { |i| i > 2 }).to be_truthy
30
31
  end
31
32
 
32
33
  describe 'Hash#at_most' do
33
- Hash.send :include, LimitDetectors
34
+ Hash.include LimitDetectors
34
35
  it 'detects a condition based on key as well as value properties' do
35
- h = { 'foo' => 1, 'bar' => 4, 'baz' => 5, 'bum' => 1, 'fum' => 0}
36
- expect( h.at_most?(3){|ky,vl| ky.match(/^b/) || vl > 1 }).to be_truthy
36
+ h = { 'foo' => 1, 'bar' => 4, 'baz' => 5, 'bum' => 1, 'fum' => 0 }
37
+ expect(h.at_most?(3) { |ky, vl| ky.match(/^b/) || vl > 1 }).to be_truthy
37
38
  end
38
39
  end
39
-
40
40
  end
41
41
 
42
42
  describe '#at_least' do
43
-
44
43
  it 'is false for an empty Array, if at least one is expected' do
45
44
  expect(Kernel).to_not receive(:warn)
46
- expect([].at_least?(1){ true }).to be_falsey
45
+ expect([].at_least?(1) { true }).to be_falsey
47
46
  end
48
47
 
49
48
  it 'is true if the expected number is 0 and Array is empty' do
50
- expect([].at_least?(0){ true }).to be_truthy
51
- expect({}.at_least?(0){ false }).to be_truthy
49
+ expect([].at_least?(0) { true }).to be_truthy
50
+ expect({}.at_least?(0) { false }).to be_truthy
52
51
  end
53
52
 
54
53
  it 'is false if the container ist smaller than the expected number' do
55
54
  size = 10
56
- expect(Array.new(10).at_least?(size + 1){true}).to be_falsey
55
+ expect(Array.new(10).at_least?(size + 1) { true }).to be_falsey
57
56
  end
58
57
 
59
58
  it 'is true if the criterion is met and expected once' do
60
- expect(["it's there"].at_least?(1){ |el| el == "it's there"}).to be_truthy
59
+ expect(["it's there"].at_least?(1) { |el| el == "it's there" }).to be_truthy
61
60
  end
62
61
 
63
- it 'is false for an empty Array if you expect at leat 1' do
64
- expect([].at_least?(1){ true }).to be_falsey
62
+ it 'is false for an empty Array if you expect at least 1' do
63
+ expect([].at_least?(1) { true }).to be_falsey
65
64
  end
66
65
 
67
- it 'is true for an empty Array if you expect at leat 0' do
68
- expect([].at_least?(0){ }).to be_truthy
66
+ it 'is true for an empty Array if you expect at least 0' do
67
+ expect([].at_least?(0) {}).to be_truthy
69
68
  end
70
69
 
71
70
  it 'is true if the criterion is met once' do
72
- expect(["it's there"].at_least?(1){ |el| el == "it's there"}).to be_truthy
71
+ expect(["it's there"].at_least?(1) { |el| el == "it's there" }).to be_truthy
73
72
  end
74
73
 
75
74
  it 'is true if all elements meet the criterion and the size is the given minimum number' do
76
- expect([1,1,1].at_least?(3){|e| e == 1}).to be_truthy
75
+ expect([1, 1, 1].at_least?(3) { |e| e == 1 }).to be_truthy
77
76
  end
78
77
 
79
78
  it 'is true if enough elements meet the criterion' do
80
- expect([1, 2, 4, 8].at_least?(2){|e| e.even?}).to be_truthy
79
+ expect([1, 2, 4, 8].at_least?(2, &:even?)).to be_truthy
81
80
  end
82
81
 
83
82
  it 'is true if there are enough elements to match' do
84
- r = Array.new(10){|i|i}
85
- expect(r.at_least?(7){ |i| i > 2 }).to be_truthy
86
- expect(r.at_least?(8){ |i| i > 2 }).to be_falsey
83
+ r = Array.new(10) { |i| i }
84
+ expect(r.at_least?(7) { |i| i > 2 }).to be_truthy
85
+ expect(r.at_least?(8) { |i| i > 2 }).to be_falsey
87
86
  end
88
-
89
87
  end
90
88
 
91
89
  describe '#ocurrences_of' do
92
90
  context 'collection with content' do
93
- Set.send :include, LimitDetectors
94
- subject{ Set.new( [1, 2, 3, 4, 5, 6, 7]) }
91
+ Set.include LimitDetectors
92
+ subject { Set.new([1, 2, 3, 4, 5, 6, 7]) }
95
93
 
96
- it('counts 3 even numbers') { expect( subject.ocurrences_of &:even?).to be 3 }
97
- it('counts 4 odd numbers') { expect( subject.ocurrences_of &:odd?).to be 4 }
98
- it('counts no number < 0') { expect( subject.ocurrences_of{ |e| e < 0}).to be 0 }
99
- it('counts 7 positive numbers') { expect( subject.ocurrences_of{ |e| e > 0}).to be 7 }
94
+ it('counts 3 even numbers') { expect(subject.occurrences_of(&:even?)).to be 3 }
95
+ it('counts 4 odd numbers') { expect(subject.occurrences_of(&:odd?)).to be 4 }
96
+ it('counts no number < 0') { expect(subject.occurrences_of { |e| e < 0 }).to be 0 }
97
+ it('counts 7 positive numbers') { expect(subject.occurrences_of { |e| e > 0 }).to be 7 }
100
98
  end
101
99
 
102
100
  context 'empty collection' do
103
101
  it 'counts 0 for any empty collection' do
104
- [[], Set.new, {}].each do | obj |
105
- expect(obj.ocurrences_of {true}).to be(0), "Expected to count 0, for an empty #{obj.class}"
102
+ [[], Set.new, {}].each do |obj|
103
+ expect(obj.occurrences_of { true }).to be(0), "Expected to count 0, for an empty #{obj.class}"
106
104
  end
107
105
  end
108
106
  end
109
107
 
110
- it('doen\'t return nil') { expect([1].ocurrences_of {}).not_to be_nil }
108
+ it("doesn't return nil") { expect([1].occurrences_of {}).not_to be_nil }
111
109
  end
112
110
 
113
-
114
- describe 'Using an object that doesn\'t respond to #inject' do
111
+ describe "Using an object that doesn't respond to #inject" do
115
112
  object = Object.new
116
113
  object.extend LimitDetectors
117
114
  it 'will raise an exception, if it\'s sent #at_most' do
118
- expect{ object.at_most?(1){ |el| el.condition? } }.to raise_exception(NoMethodError, /undefined method .inject./)
115
+ expect { object.at_most?(1, &:condition?) }.to raise_exception(NoMethodError, /undefined method .inject./)
119
116
  end
120
117
  end
121
118
 
122
119
  describe 'Give a warning, if non-predicate versions are used' do
123
120
  it 'yields a warning for old-style at_most' do
124
121
  expect(Kernel).to receive(:warn).with(/'at_most'.+deprecated.+'at_most\?'/)
125
- [1,2,4,8].at_most(2) {|e| e.even?}
122
+ [1, 2, 4, 8].at_most(2, &:even?)
126
123
  end
127
124
 
128
125
  it 'yields a warning for old-style at_least' do
129
126
  expect(Kernel).to receive(:warn).with(/'at_least'.+deprecated.+'at_least\?'/)
130
- [1,2,4,8].at_least(2) {|e| e.even?}
131
- end
127
+ [1, 2, 4, 8].at_least(2, &:even?)
132
128
  end
129
+ end
133
130
 
134
131
  describe 'When the provided block raises an exception' do
135
- subject{ [1] }
132
+ subject { [1] }
136
133
  it 'passes up the stack unchanged' do
137
- expect{ subject.at_most?(1) { raise ArgumentError, 'BoomError' } }.to raise_error(ArgumentError, 'BoomError')
138
- expect{ subject.ocurrences_of { raise ArgumentError, 'BoomError'} }.to raise_error(ArgumentError, 'BoomError')
134
+ expect { subject.at_most?(1) { raise ArgumentError, 'BoomError' } }.to raise_error(ArgumentError, 'BoomError')
135
+ expect { subject.occurrences_of { raise ArgumentError, 'BoomError' } }.to raise_error(ArgumentError, 'BoomError')
139
136
  end
140
137
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'limit_detectors'
2
4
 
3
5
  # This file was generated by the `rspec --init` command. Conventionally, all
@@ -7,9 +9,9 @@ require 'limit_detectors'
7
9
  #
8
10
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
9
11
  RSpec.configure do |config|
10
- #config.treat_symbols_as_metadata_keys_with_true_values = true
11
- #config.run_all_when_everything_filtered = true
12
- #config.filter_run :focus
12
+ # config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ # config.run_all_when_everything_filtered = true
14
+ # config.filter_run :focus
13
15
 
14
16
  # Run specs in random order to surface order dependencies. If you find an
15
17
  # order dependency and want to debug it, you can fix the order by providing
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: limit_detectors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephan Kämper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-01 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 13.0.3
33
+ version: 0.14.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 13.0.3
40
+ version: 0.14.1
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: pry-doc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.10'
47
+ version: 1.2.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.10'
54
+ version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: pry
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.14.1
61
+ version: 13.0.6
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.14.1
68
+ version: 13.0.6
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry-doc
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.1.0
75
+ version: '3.10'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.1.0
82
+ version: '3.10'
83
83
  description: Some methods to detect whether an Enumerable object contains a constrained
84
84
  number of elements that match a given condition.
85
85
  email:
@@ -88,13 +88,18 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
+ - ".github/workflows/ruby.yml"
91
92
  - ".gitignore"
92
93
  - ".rspec"
93
- - ".travis.yml"
94
+ - ".rubocop.yml"
94
95
  - Gemfile
95
96
  - LICENSE.txt
96
97
  - README.md
97
98
  - Rakefile
99
+ - checksums/limit_detectors-1.0.2.gem.sha512
100
+ - checksums/limit_detectors-1.0.3.gem.sha512
101
+ - checksums/limit_detectors-1.0.4.gem.sha512
102
+ - example/example.rb
98
103
  - lib/limit_detectors.rb
99
104
  - lib/limit_detectors/version.rb
100
105
  - limit_detectors.gemspec
@@ -103,7 +108,8 @@ files:
103
108
  homepage: ''
104
109
  licenses:
105
110
  - MIT
106
- metadata: {}
111
+ metadata:
112
+ rubygems_mfa_required: 'true'
107
113
  post_install_message:
108
114
  rdoc_options: []
109
115
  require_paths:
@@ -112,14 +118,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
118
  requirements:
113
119
  - - ">="
114
120
  - !ruby/object:Gem::Version
115
- version: '0'
121
+ version: 2.7.0
116
122
  required_rubygems_version: !ruby/object:Gem::Requirement
117
123
  requirements:
118
124
  - - ">="
119
125
  - !ruby/object:Gem::Version
120
126
  version: '0'
121
127
  requirements: []
122
- rubygems_version: 3.2.16
128
+ rubygems_version: 3.3.4
123
129
  signing_key:
124
130
  specification_version: 4
125
131
  summary: Detect certain conditions of elements of an Enumerable object
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- sudo: false
4
-
5
- rvm:
6
- - 2.6.7
7
- - 2.7.3
8
- - 3.0.1
9
- - jruby