redis_test 0.0.10 → 0.1.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
  SHA1:
3
- metadata.gz: 56a568c5f2562c7f6706b516ec168ad7c3558d61
4
- data.tar.gz: 6005392133cddc42aaa211bf54aec8be7d8f97ad
3
+ metadata.gz: 4be8e56fff156dd9c2f045c4e01f650193dd1705
4
+ data.tar.gz: b4697eb739bd1ee8c611e04f0bc3502b4fa7fc0f
5
5
  SHA512:
6
- metadata.gz: 07b5e0325a8a9bd78feed00de25aa146deb6706629ef9b072638a606cb2906cc95cc3f34fdb5bd55a47eaf756eedc8a2e1ecd5f211d7a3aae2331607c533d158
7
- data.tar.gz: bd1cccbbfca84344933b4ddbc13bceaff4531888f760d42c9c384bd8da3d8cda5295852fdb4a3f7120455dafa442d77c425dd8903995dfa15ba59f0c0751e26c
6
+ metadata.gz: fae08172bf6af746eb069ba9652f3ffde471a91f70e8acab8a2ff75c7e32f666910e71a6ce60e0748ba5ecb83e220fe85a4294c8924c057c60d62081d9b5aab8
7
+ data.tar.gz: cbc852ed5325bf6d4a31ba4456a1330880ea937b24259cf38091470ab21b1221f195744e5d949c1b8ba2a661ba1fabc94c67900c4c70efa591f711d7fa5bc9b9
@@ -3,7 +3,7 @@ require "redis_test/version"
3
3
  module RedisTest
4
4
  class << self
5
5
  def port
6
- (ENV['TEST_REDIS_PORT'] || 9736).to_i
6
+ @port ||= (ENV['TEST_REDIS_PORT'] || find_available_port).to_i
7
7
  end
8
8
 
9
9
  def db_filename
@@ -90,7 +90,7 @@ module RedisTest
90
90
  case option
91
91
  when :default
92
92
  Redis.current = Redis.new
93
-
93
+ RedisClassy.redis = Redis.current if defined? RedisClassy
94
94
  when :sidekiq
95
95
  Sidekiq.configure_server do |config|
96
96
  config.redis = { url: server_url, namespace: 'sidekiq' }
@@ -119,6 +119,13 @@ module RedisTest
119
119
  socket.gets # wait for redis server to reply with "OK"
120
120
  end
121
121
 
122
+ def find_available_port
123
+ server = TCPServer.new("127.0.0.1", 0)
124
+ server.addr[1]
125
+ ensure
126
+ server.close if server
127
+ end
128
+
122
129
  private
123
130
  attr_accessor :socket
124
131
  end
@@ -1,3 +1,3 @@
1
1
  module RedisTest
2
- VERSION = "0.0.10"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phuong Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
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: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
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: '0'
41
41
  description: A helper to launch redis server during test
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
48
+ - ".gitignore"
49
49
  - Gemfile
50
50
  - LICENSE.txt
51
51
  - README.md
@@ -63,17 +63,17 @@ require_paths:
63
63
  - lib
64
64
  required_ruby_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - '>='
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.0.14
76
+ rubygems_version: 2.6.11
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: A helper to launch redis server during test