limit_detectors 0.0.5 → 0.0.6

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: 31a734b1d732fbc68adedf43ac4cb5ea4b19d7e9
4
- data.tar.gz: 24a9827e6429aaa1d60ae8e507b481974aedf25e
3
+ metadata.gz: 3bfeb23a1532e16e237e63c348f1daccf83dde17
4
+ data.tar.gz: bcf2d367841832e8517250a85992cfaa7583ba2c
5
5
  SHA512:
6
- metadata.gz: 9fafa8b5a6d6886587fc4f329893d5eebb75552691d138e8ea0a5509daac3e6643cb959020a24797a662920b20b926e1cf930cf9a5ac3622dbdb4262cabb229a
7
- data.tar.gz: 5f05f660b06669f3ae01eedb2a6a53f0780a3f1728d43a95ab6d77ed084b85440d49906b8cf21244bddea49eca0fced0c8ab3567efa0b41ea6bf9da30ebc40f1
6
+ metadata.gz: 484a1bb78bf51122fe69ff9867fecf5e3c2623e81c3b8d6690543f3c7e64cb0789770661ed1371c93496cba161017be762d5190b67b87b2f789280555279a0dc
7
+ data.tar.gz: 45d8da7f52c723f25d502f67382279b9f141915fbe2f2045580d146b3ee4428a754789f24a1a4330eb75e84e84ccd51a9d14c808682248d653955adcb1d38057
data/.gitignore CHANGED
@@ -22,5 +22,5 @@ spec/reports
22
22
  test/tmp
23
23
  test/version_tmp
24
24
  tmp
25
-
26
25
  /.idea/
26
+ bin
data/.travis.yml CHANGED
@@ -1,9 +1,11 @@
1
1
  language: ruby
2
+ cache: bundler
3
+ sudo: false
4
+
2
5
  rvm:
3
- - "1.9.3"
4
- - "1.8.7"
5
- - "2.0"
6
- - "2.1"
7
- - "2.1.1"
6
+ - 1.9.3
7
+ - 1.8.7
8
+ - 2.0
9
+ - 2.1
10
+ - 2.2.2
8
11
  - jruby
9
- - rbx
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gemspec
7
7
  # To support Rubinius on Travis-CI
8
8
  platforms :rbx do
9
9
  gem 'racc'
10
- gem 'rubysl', '~> 2.0'
10
+ gem 'minitest'
11
+ gem 'rubysl'#, '~> 2.0'
11
12
  gem 'psych'
12
13
  end
data/README.md CHANGED
@@ -48,13 +48,14 @@ may not be compatible with the current version.
48
48
 
49
49
  This gem is tested with these (MRI) Ruby versions:
50
50
 
51
- * 1.8.7,
52
- * 1.9.3,
53
- * 2.0,
54
- * 2.1,
55
- * 2.1.1,
56
-
57
- as well as current version of JRuby and Rubinius.
51
+ - 1.9.3
52
+ - 1.8.7
53
+ - 2.0
54
+ - 2.1
55
+ - 2.2.2
56
+ - jruby
57
+
58
+ as well as a current version of JRuby.
58
59
 
59
60
  ## Contributing
60
61
 
@@ -1,3 +1,3 @@
1
1
  module LimitDetectors
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -8,7 +8,7 @@ module LimitDetectors
8
8
  at_most? limit, &block
9
9
  end
10
10
 
11
- # Deprecated, use at_most? instead
11
+ # Deprecated, use at_least? instead
12
12
  def at_least(limit, &block)
13
13
  Kernel.warn "'at_least' is deprecated, use 'at_least?' instead"
14
14
  at_least? limit, &block
@@ -6,7 +6,7 @@ require 'limit_detectors/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'limit_detectors'
8
8
  spec.version = LimitDetectors::VERSION
9
- spec.authors = ['Stephan Kämper']
9
+ spec.authors = ['Stephan Kämper']
10
10
  spec.email = ['the.tester@seasidetesting.com']
11
11
  spec.summary = %q{Detect certain conditions of elements of an Enumerable object}
12
12
  spec.description = %q{Some methods to detect whether an Enumerable object contains a constrained number of elements that match a given condition.}
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency 'bundler'
22
- spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'rspec'
24
- spec.add_development_dependency 'pry'
22
+ spec.add_development_dependency 'rake', '~> 10.4'
23
+ spec.add_development_dependency 'rspec', '~> 3.0'
24
+ spec.add_development_dependency 'pry', '~> 0.10'
25
25
  spec.add_development_dependency 'pry-doc'
26
26
  end
@@ -7,14 +7,14 @@ describe '#at_most' do
7
7
 
8
8
  it 'is true for an empty Array' do
9
9
  expect(Kernel).to_not receive(:warn)
10
- expect([].at_most?(5){ true }).to be_true
11
- expect([].at_most?(0){ true }).to be_true
12
- expect([].at_most?(1){ true }).to be_true
13
- expect([].at_most?(5){ :foo }).to be_true
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
14
14
  end
15
15
 
16
16
  it 'is true if the criterion is met once' do
17
- expect(["it's there"].at_most?(1){ |el| el == "it's there"}).to be_true
17
+ expect(["it's there"].at_most?(1){ |el| el == "it's there"}).to be_truthy
18
18
  end
19
19
 
20
20
  it 'is true if all elements meet the criterion and the size is the given maximum number' do
@@ -22,19 +22,19 @@ describe '#at_most' do
22
22
  end
23
23
 
24
24
  it 'is false if not enough elements meet the criterion' do
25
- expect([1, 2, 4].at_most?(1){|e| e.even?}).to be_false
25
+ expect([1, 2, 4].at_most?(1){|e| e.even?}).to be_falsey
26
26
  end
27
27
 
28
28
  it 'is true if 0 elements are expected to match' do
29
29
  r = Array.new(10){rand}
30
- expect(r.at_most?(0){ |i| i > 2 }).to be_true
30
+ expect(r.at_most?(0){ |i| i > 2 }).to be_truthy
31
31
  end
32
32
 
33
33
  describe 'Hash#at_most' do
34
34
  Hash.send :include, LimitDetectors
35
35
  it 'detects a condition based on key as well as value properties' do
36
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_true
37
+ expect( h.at_most?(3){|ky,vl| ky.match(/^b/) || vl > 1 }).to be_truthy
38
38
  end
39
39
  end
40
40
 
@@ -44,47 +44,47 @@ describe '#at_least' do
44
44
 
45
45
  it 'is false for an empty Array, if at least one is expected' do
46
46
  expect(Kernel).to_not receive(:warn)
47
- expect([].at_least?(1){ true }).to be_false
47
+ expect([].at_least?(1){ true }).to be_falsey
48
48
  end
49
49
 
50
50
  it 'is true if the expected number is 0 and Array is empty' do
51
- expect([].at_least?(0){ true }).to be_true
52
- expect({}.at_least?(0){ false }).to be_true
51
+ expect([].at_least?(0){ true }).to be_truthy
52
+ expect({}.at_least?(0){ false }).to be_truthy
53
53
  end
54
54
 
55
55
  it 'is false if the container ist smaller than the expected number' do
56
56
  size = 10
57
- expect(Array.new(10).at_least?(size + 1){true}).to be_false
57
+ expect(Array.new(10).at_least?(size + 1){true}).to be_falsey
58
58
  end
59
59
 
60
60
  it 'is true if the criterion is met and expected once' do
61
- expect(["it's there"].at_least?(1){ |el| el == "it's there"}).to be_true
61
+ expect(["it's there"].at_least?(1){ |el| el == "it's there"}).to be_truthy
62
62
  end
63
63
 
64
64
  it 'is false for an empty Array if you expect at leat 1' do
65
- expect([].at_least?(1){ true }).to be_false
65
+ expect([].at_least?(1){ true }).to be_falsey
66
66
  end
67
67
 
68
68
  it 'is true for an empty Array if you expect at leat 0' do
69
- expect([].at_least?(0){ }).to be_true
69
+ expect([].at_least?(0){ }).to be_truthy
70
70
  end
71
71
 
72
72
  it 'is true if the criterion is met once' do
73
- expect(["it's there"].at_least?(1){ |el| el == "it's there"}).to be_true
73
+ expect(["it's there"].at_least?(1){ |el| el == "it's there"}).to be_truthy
74
74
  end
75
75
 
76
76
  it 'is true if all elements meet the criterion and the size is the given minimum number' do
77
- expect([1,1,1].at_least?(3){|e| e == 1}).to be_true
77
+ expect([1,1,1].at_least?(3){|e| e == 1}).to be_truthy
78
78
  end
79
79
 
80
80
  it 'is true if enough elements meet the criterion' do
81
- expect([1, 2, 4, 8].at_least?(2){|e| e.even?}).to be_true
81
+ expect([1, 2, 4, 8].at_least?(2){|e| e.even?}).to be_truthy
82
82
  end
83
83
 
84
84
  it 'is true if there are enough elements to match' do
85
85
  r = Array.new(10){|i|i}
86
- expect(r.at_least?(7){ |i| i > 2 }).to be_true
87
- expect(r.at_least?(8){ |i| i > 2 }).to be_false
86
+ expect(r.at_least?(7){ |i| i > 2 }).to be_truthy
87
+ expect(r.at_least?(8){ |i| i > 2 }).to be_falsey
88
88
  end
89
89
 
90
90
  end
@@ -112,10 +112,10 @@ describe '#ocurrences_of' do
112
112
  end
113
113
 
114
114
 
115
- describe 'Using an object that doesn\'t respond to #inject will raise an exception' do
115
+ describe 'Using an object that doesn\'t respond to #inject' do
116
116
  object = Object.new
117
117
  object.extend LimitDetectors
118
- it 'will raise an exception, if it\'s sent #atmost' do
118
+ it 'will raise an exception, if it\'s sent #at_most' do
119
119
  expect{ object.at_most?(1){ |el| el.condition? } }.to raise_exception(NoMethodError, /undefined method .inject./)
120
120
  end
121
121
  end
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: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
- - Stephan Kämper
7
+ - Stephan Kämper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,44 +28,44 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10.4'
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: '0'
40
+ version: '10.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.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: '0'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.10'
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'
68
+ version: '0.10'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry-doc
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.2.2
123
+ rubygems_version: 2.4.8
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Detect certain conditions of elements of an Enumerable object