bidu-core_ext 1.1.1 → 1.2.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: fb348c3d47b45a7c8cbfbe2501db5bce9c4761e6
4
- data.tar.gz: 5c97c0b953856f15bb523d6725f278a1d20d36cf
3
+ metadata.gz: 4f7d61fe9df81692ab64aaad48e92451e90c3c06
4
+ data.tar.gz: fbf5812c56fdd8c1031691c56c768a6eb053d23c
5
5
  SHA512:
6
- metadata.gz: 9e288ff1798c21ff2664f4c957722a3805139ec3879c360e1b6963728bd70a05c9bd3e7a91957d1495c18beb2da9d5ae46dd88eb7b2d2a6325b8f4322086419e
7
- data.tar.gz: a2235fde7dc2fab7e094956e050bd397b6bc796d63fb289868f5a38fa0a84021e94890b49d983e9b0b4bb0e275944e550b2ee6d9c1ff1c90fa7d757fc66a4453
6
+ metadata.gz: 785a326bf98f8713756b5651d031e2b3649277801be53cc28d5a2eb5f5a350d2de90c164f1e00f17c5ac8a574cfa9021dcab37a890dad2f27fa2bb553abaac7f
7
+ data.tar.gz: 8fbe5f84183bba7639c46be2963da339bf5ace96951678fb0e594ecff20cedaa7d4cd6cdd67ef61804d32f5c5f5a95b868399efd3e017ad601b3ee74f718e585
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bidu-core_ext (1.1.1)
4
+ bidu-core_ext (1.2.0)
5
5
  activesupport
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (4.2.1)
10
+ activesupport (4.2.4)
11
11
  i18n (~> 0.7)
12
12
  json (~> 1.7, >= 1.7.7)
13
13
  minitest (~> 5.1)
@@ -16,8 +16,8 @@ GEM
16
16
  diff-lcs (1.2.5)
17
17
  docile (1.1.5)
18
18
  i18n (0.7.0)
19
- json (1.8.2)
20
- minitest (5.6.1)
19
+ json (1.8.3)
20
+ minitest (5.8.0)
21
21
  multi_json (1.10.1)
22
22
  rake (10.3.2)
23
23
  rspec (2.99.0)
@@ -47,3 +47,6 @@ DEPENDENCIES
47
47
  rspec (~> 2.14)
48
48
  rspec-mocks
49
49
  simplecov
50
+
51
+ BUNDLED WITH
52
+ 1.10.6
data/lib/array.rb CHANGED
@@ -12,4 +12,8 @@ class Array
12
12
  def as_hash(keys)
13
13
  Array::HashBuilder.new(self, keys).build
14
14
  end
15
+
16
+ def random
17
+ self[rand(size)]
18
+ end
15
19
  end
@@ -1,5 +1,5 @@
1
1
  module Bidu
2
2
  module CoreExt
3
- VERSION = '1.1.1'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -90,4 +90,20 @@ describe Array do
90
90
  end
91
91
  end
92
92
  end
93
+
94
+ describe '#random' do
95
+ let(:array) { [ 7, 5, 3 ] }
96
+
97
+ (0..2).each do |index|
98
+ context "when random returns #{index}" do
99
+ before do
100
+ allow_any_instance_of(Array).to receive(:rand).with(array.size) { index }
101
+ end
102
+
103
+ it 'returns the randomized index of the array' do
104
+ expect(array.random).to eq(array[index])
105
+ end
106
+ end
107
+ end
108
+ end
93
109
  end
File without changes
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bidu-core_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bidu Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-31 00:00:00.000000000 Z
11
+ date: 2015-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.6'
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
40
  version: '1.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '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
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.14'
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
68
  version: '2.14'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec-mocks
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
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
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description:
@@ -101,8 +101,8 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rspec
104
+ - ".gitignore"
105
+ - ".rspec"
106
106
  - Gemfile
107
107
  - Gemfile.lock
108
108
  - LICENSE
@@ -146,17 +146,17 @@ require_paths:
146
146
  - lib
147
147
  required_ruby_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - '>='
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 2.4.6
159
+ rubygems_version: 2.4.5
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Core Extensions