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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 841053341b54ef4b39e1c083e84c381dd611c7f0
4
- data.tar.gz: a4318f475dff064bcd25367b245a76c0ed46fcb5
3
+ metadata.gz: 25607cfbd958a0445b9c13e85b6e3ddda654e5dc
4
+ data.tar.gz: cd5fdb1b52a69190d5580ce801877d523c48625d
5
5
  SHA512:
6
- metadata.gz: 9b54682423119694e914a9657f1aea21d7a06dbb7579bed76b901f0897d986667c72ea64a8fe6a1c194e8f42b3861cd721e71ff52fc81d6e55a0a699d5270bcf
7
- data.tar.gz: 78967833b090a5f9de1daba744acb1f591d5fa0cb1bc2d4f1fe795046c3b1a99be6a4298c98aac0be82ad1cff3be3356d29cd74f0dfe705f7b4b00fd58794cb9
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
- success = true
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(!success)
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
@@ -1,3 +1,3 @@
1
1
  module RedisTest
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -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.2.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-02 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler