redis_test 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redis_test.rb +7 -2
- data/lib/redis_test/version.rb +1 -1
- data/spec/redis_test_spec.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25607cfbd958a0445b9c13e85b6e3ddda654e5dc
|
4
|
+
data.tar.gz: cd5fdb1b52a69190d5580ce801877d523c48625d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a52375381f2ba1bbcdfa2518b99d5d836281cec86a0ae499a05f81d2bc6a9afab36279b69ee30066ea94533b6e3214244996b7b3109f9472dfec9851893c480d
|
7
|
+
data.tar.gz: bf697589bca8c361103d7418912206adfc2cefe15ce45bc0f1280c72e216145a3f3447b4cbe3d275ff1546ab7f8ac11578677120c7ea10ef8968199f411ff928
|
data/lib/redis_test.rb
CHANGED
@@ -70,7 +70,7 @@ module RedisTest
|
|
70
70
|
begin
|
71
71
|
self.socket = TCPSocket.open("localhost", port)
|
72
72
|
clear
|
73
|
-
|
73
|
+
@started = true
|
74
74
|
rescue Exception => e
|
75
75
|
if wait_time_remaining > 0
|
76
76
|
wait_time_remaining -= 0.1
|
@@ -78,11 +78,15 @@ module RedisTest
|
|
78
78
|
else
|
79
79
|
raise "Cannot start redis server in 5 seconds. Pinging server yield\n#{e.inspect}"
|
80
80
|
end
|
81
|
-
end while(
|
81
|
+
end while(!@started)
|
82
82
|
|
83
83
|
ENV['REDIS_URL'] = server_url
|
84
84
|
end
|
85
85
|
|
86
|
+
def started?
|
87
|
+
@started
|
88
|
+
end
|
89
|
+
|
86
90
|
def stop
|
87
91
|
if File.file?(pidfile) && File.readable?(pidfile)
|
88
92
|
pid = File.read(pidfile).to_i
|
@@ -94,6 +98,7 @@ module RedisTest
|
|
94
98
|
end
|
95
99
|
end
|
96
100
|
FileUtils.rm_f("#{cache_path}#{db_filename}")
|
101
|
+
@started = false
|
97
102
|
end
|
98
103
|
|
99
104
|
def server_url
|
data/lib/redis_test/version.rb
CHANGED
data/spec/redis_test_spec.rb
CHANGED
@@ -4,17 +4,21 @@ RSpec.describe RedisTest do
|
|
4
4
|
describe '#start' do
|
5
5
|
describe "log_to_stdout = false" do
|
6
6
|
it "starts fine" do
|
7
|
+
expect(RedisTest.started?).to be_falsey
|
7
8
|
RedisTest.start
|
9
|
+
expect(RedisTest.started?).to be_truthy
|
8
10
|
RedisTest.stop
|
11
|
+
expect(RedisTest.started?).to be_falsey
|
9
12
|
end
|
10
13
|
end
|
11
|
-
end
|
12
14
|
|
13
|
-
describe '#start' do
|
14
15
|
describe "log_to_stdout = true" do
|
15
16
|
it "starts fine" do
|
17
|
+
expect(RedisTest.started?).to be_falsey
|
16
18
|
RedisTest.start(log_to_stdout: true)
|
19
|
+
expect(RedisTest.started?).to be_truthy
|
17
20
|
RedisTest.stop
|
21
|
+
expect(RedisTest.started?).to be_falsey
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phuong Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|