rspec-redis_helper 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/rspec-redis_helper.rb +10 -9
- data/lib/rspec-redis_helper/version.rb +1 -1
- metadata +7 -7
data/README.md
CHANGED
@@ -36,7 +36,7 @@ Configure RSpec in your support or helper file like so:
|
|
36
36
|
end
|
37
37
|
|
38
38
|
You will also need to configure your app to use one of these redis connections,
|
39
|
-
or to be initialized from RSpec::RedisHelper::
|
39
|
+
or to be initialized from RSpec::RedisHelper::CONFIG.
|
40
40
|
|
41
41
|
Then mark your Redis-using specs with redis: true, like so:
|
42
42
|
|
data/lib/rspec-redis_helper.rb
CHANGED
@@ -3,14 +3,15 @@ require "rspec-redis_helper/version"
|
|
3
3
|
module RSpec
|
4
4
|
module RedisHelper
|
5
5
|
|
6
|
-
|
6
|
+
CONFIG = { url: "redis://127.0.0.1:6379/1" }
|
7
|
+
TEST = CONFIG # deprecated
|
7
8
|
|
8
9
|
def redis
|
9
|
-
@redis ||= ::Redis.connect(
|
10
|
+
@redis ||= ::Redis.connect(CONFIG)
|
10
11
|
end
|
11
12
|
|
12
13
|
def redis2
|
13
|
-
@redis2 ||= ::Redis.connect(
|
14
|
+
@redis2 ||= ::Redis.connect(CONFIG)
|
14
15
|
end
|
15
16
|
|
16
17
|
def with_watch( redis, *args )
|
@@ -23,15 +24,15 @@ module RSpec
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def with_clean_redis(&block)
|
26
|
-
redis.client.disconnect
|
27
|
-
redis2.client.disconnect
|
28
|
-
redis.flushall
|
27
|
+
redis.client.disconnect # auto connect after fork
|
28
|
+
redis2.client.disconnect # auto connect after fork
|
29
|
+
redis.flushall # clean before run
|
29
30
|
begin
|
30
31
|
yield
|
31
32
|
ensure
|
32
|
-
redis.flushall
|
33
|
-
redis.quit
|
34
|
-
redis2.quit
|
33
|
+
redis.flushall # clean up after run
|
34
|
+
redis.quit # quit (close) connection
|
35
|
+
redis2.quit # quit (close) connection
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-redis_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease: !!null
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable: !!null
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: redis
|
17
|
-
requirement: &
|
17
|
+
requirement: &70134698045940 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70134698045940
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rake
|
28
|
-
requirement: &
|
28
|
+
requirement: &70134698045300 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70134698045300
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec
|
39
|
-
requirement: &
|
39
|
+
requirement: &70134698044680 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70134698044680
|
48
48
|
description: Helper for RSpec tests which use Redis
|
49
49
|
email:
|
50
50
|
- mark.lanett@gmail.com
|