hella-redis 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA512:
3
- data.tar.gz: 6b2cc12d83fbb6e7b9729c89a60bb39c583bcd52543f1f1d77b3c39c05c1c58f5faac2de941ae34d4d47b22ebfff5eb7bf2847fb3d1580609283c333a4332384
4
- metadata.gz: 570acf22296c63f86218648a9e02c9c8d11d34eeba378e86ea5014e3ea21ca6e26390d7edd3f849ab345fb17d5a8fe9696ba5411412b54d5e2da505134223ce5
5
- SHA1:
6
- data.tar.gz: a42078e26d25b13db394f27b31e44f41a2b4fba6
7
- metadata.gz: 4c3dd50a8c11051d7c263d9eab72f7b48c47ded5
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2c11849c706992fadaf24788eab0d8e5998350e08b429646c772097fc32cd048
4
+ data.tar.gz: c291e238be0cff2321ea88058c3c3eb22496702595b6f6900e9a80570901865e
5
+ SHA512:
6
+ metadata.gz: 7f8ea4a862606da3b802ff7a841320dfe05ca6cea1304aa05b089b022d7711f4bc2779c9032b4cc231a731e9b6e9b4c3ab096c7dab35cdd6c3b731f0c65bcbb8
7
+ data.tar.gz: fe824c06209a19cea1e0b72ac261bf788e9b6d044803acd3003e5216be0ea1429fd2c1e37fd5a34227831d32f0d822668729483710477333ae053e3a38aaf022
data/.l.yml ADDED
@@ -0,0 +1,9 @@
1
+ # https://github.com/redding/l.rb
2
+
3
+ linters:
4
+ - name: "Rubocop"
5
+ cmd: "bundle exec rubocop"
6
+ autocorrect_cmd: "bundle exec rubocop -A"
7
+ extensions:
8
+ - ".rb"
9
+ cli_abbrev: "u"
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ inherit_gem:
2
+ much-style-guide:
3
+ - "lib/much-style-guide/rubocop.yml"
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.3
data/.t.yml ADDED
@@ -0,0 +1,6 @@
1
+ # https://github.com/redding/t.rb
2
+
3
+ default_cmd: "bundle exec assert"
4
+ test_dir: "test"
5
+ test_file_suffixes:
6
+ - "_tests.rb"
data/Gemfile CHANGED
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
5
+ ruby "~> 2.5"
6
+
3
7
  gemspec
4
8
 
5
- gem 'pry', "~> 0.9.0"
9
+ gem "pry"
data/README.md CHANGED
@@ -8,13 +8,14 @@ This gem is a wrapper that builds a connection pool of redis connections. It al
8
8
 
9
9
  ```ruby
10
10
  # create
11
- @redis = HellaRedis.new({
12
- :timeout => 1,
13
- :size => 5,
14
- :redis_ns => 'hella-redis-test',
15
- :driver => 'ruby',
16
- :url => 'redis://localhost:6379/0'
17
- }) # => HellaRedis:ConnectionPool instance
11
+ @redis =
12
+ HellaRedis.new(
13
+ timeout: 1,
14
+ size: 5,
15
+ redis_ns: "hella-redis-test",
16
+ driver: "ruby",
17
+ url: "redis://localhost:6379/0"
18
+ ) # => HellaRedis:ConnectionPool instance
18
19
 
19
20
  # it's actually a pool of connections
20
21
  @redis.connection do |connection|
@@ -26,24 +27,25 @@ end
26
27
  ### Test Mode
27
28
 
28
29
  ```ruby
29
- ENV['HELLA_REDIS_TEST_MODE'] = 'yes' # set to anything "truthy"
30
-
31
- @redis_spy = HellaRedis.new({
32
- :timeout => 1,
33
- :size => 5,
34
- :redis_ns => 'hella-redis-test',
35
- :driver => 'ruby',
36
- :url => 'redis://localhost:6379/0'
37
- }) # => HellaRedis::ConnectionPoolSpy instance
38
-
39
- @redis_spy.connection do |connection_spy|
40
- connection_spy # => HellaRedis::ConnectionSpy instance
41
- connection_spy.info
30
+ ENV["HELLA_REDIS_TEST_MODE"] = "yes" # set to anything "truthy"
31
+
32
+ @redis_spy =
33
+ HellaRedis.new({
34
+ timeout: 1,
35
+ size: 5,
36
+ redis_ns: "hella-redis-test",
37
+ driver: "ruby",
38
+ url: "redis://localhost:6379/0"
39
+ }) # => HellaRedis::ConnectionPoolSpy instance
40
+
41
+ @redis_spy.connection do |connection|
42
+ connection # => HellaRedis::ConnectionSpy instance
43
+ connection.info
42
44
  end
43
45
 
44
46
  @redis_spy.calls.size # => 1
45
47
  @redis_spy.calls.first.tap do |call|
46
- call.command # => 'info'
48
+ call.command # => :info
47
49
  call.args # => nil
48
50
  call.block # => nil
49
51
  end
@@ -52,13 +54,20 @@ end
52
54
  @redis_spy.connection_calls.first.tap do |connection_call|
53
55
  connection_call.block # => block instance
54
56
  end
57
+
58
+ Assert.stub(@redis_spy.connection_spy, :get).with("some-key"){ "some-value" }
59
+ value = @redis_spy.connection do |connection|
60
+ connection.get("some_key")
61
+ end
62
+ assert_that("some-value").equals(value)
63
+ @redis_spy.calls.size # => 1 (unchanged b/c we stubbed the :get method)
55
64
  ```
56
65
 
57
66
  ## Installation
58
67
 
59
68
  Add this line to your application's Gemfile:
60
69
 
61
- gem 'hella-redis'
70
+ gem "hella-redis"
62
71
 
63
72
  And then execute:
64
73
 
data/hella-redis.gemspec CHANGED
@@ -1,5 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path("../lib", __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require "hella-redis/version"
5
7
 
@@ -8,20 +10,22 @@ Gem::Specification.new do |gem|
8
10
  gem.version = HellaRedis::VERSION
9
11
  gem.authors = ["Kelly Redding", "Collin Redding"]
10
12
  gem.email = ["kelly@kellyredding.com", "collin.redding@me.com"]
11
- gem.summary = %q{It's-a hella-redis!}
12
- gem.description = %q{It's-a hella-redis!}
13
+ gem.summary = "It's-a hella-redis!"
14
+ gem.description = "It's-a hella-redis!"
13
15
  gem.homepage = "http://github.com/redding/hella-redis"
14
- gem.license = 'MIT'
16
+ gem.license = "MIT"
15
17
 
16
- gem.files = `git ls-files`.split($/)
18
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
21
  gem.require_paths = ["lib"]
20
22
 
21
- gem.add_development_dependency("assert", ["~> 2.16.1"])
23
+ gem.required_ruby_version = "~> 2.5"
22
24
 
23
- gem.add_dependency("redis", ["~> 3.2"])
24
- gem.add_dependency("redis-namespace", ["~> 1.5"])
25
- gem.add_dependency("connection_pool", ["= 0.9.2"]) # temp, for 1.8.7 support
25
+ gem.add_development_dependency("assert", ["~> 2.19.6"])
26
+ gem.add_development_dependency("much-style-guide", ["~> 0.6.3"])
26
27
 
28
+ gem.add_dependency("redis", ["~> 4.2.5"])
29
+ gem.add_dependency("redis-namespace", ["~> 1.8.1"])
30
+ gem.add_dependency("connection_pool", ["~> 2.2.5"])
27
31
  end
data/lib/hella-redis.rb CHANGED
@@ -1,11 +1,12 @@
1
- require 'hella-redis/version'
2
- require 'hella-redis/connection_pool'
3
- require 'hella-redis/connection_pool_spy'
1
+ # frozen_string_literal: true
4
2
 
5
- module HellaRedis
3
+ require "hella-redis/version"
4
+ require "hella-redis/connection_pool"
5
+ require "hella-redis/connection_pool_spy"
6
6
 
7
+ module HellaRedis
7
8
  def self.new(args)
8
- self.send(ENV['HELLA_REDIS_TEST_MODE'] ? :mock : :real, args)
9
+ send(ENV["HELLA_REDIS_TEST_MODE"] ? :mock : :real, args)
9
10
  end
10
11
 
11
12
  def self.real(args)
@@ -17,7 +18,6 @@ module HellaRedis
17
18
  end
18
19
 
19
20
  class Config
20
-
21
21
  attr_reader :url, :driver, :redis_ns, :timeout, :size
22
22
 
23
23
  def initialize(args = nil)
@@ -29,18 +29,16 @@ module HellaRedis
29
29
  @size = args[:size] || 1
30
30
  end
31
31
 
32
- def ==(other_config)
33
- if other_config.kind_of?(Config)
34
- self.url == other_config.url &&
35
- self.driver == other_config.driver &&
36
- self.redis_ns == other_config.redis_ns &&
37
- self.timeout == other_config.timeout &&
38
- self.size == other_config.size
32
+ def ==(other)
33
+ if other.is_a?(Config)
34
+ url == other.url &&
35
+ driver == other.driver &&
36
+ redis_ns == other.redis_ns &&
37
+ timeout == other.timeout &&
38
+ size == other.size
39
39
  else
40
40
  super
41
41
  end
42
42
  end
43
-
44
43
  end
45
-
46
44
  end
@@ -1,23 +1,22 @@
1
- require 'connection_pool'
2
- require 'redis'
3
- require 'redis-namespace'
1
+ # frozen_string_literal: true
4
2
 
5
- module HellaRedis
3
+ require "connection_pool"
4
+ require "redis"
5
+ require "redis-namespace"
6
6
 
7
+ module HellaRedis
7
8
  class ConnectionPool
8
-
9
9
  def initialize(config)
10
- @pool = ::ConnectionPool.new({
11
- :timeout => config.timeout,
12
- :size => config.size
13
- }) do
14
- ::Redis::Namespace.new(config.redis_ns, {
15
- :redis => ::Redis.new({
16
- :url => config.url,
17
- :driver => config.driver
18
- })
19
- })
20
- end
10
+ @pool =
11
+ ::ConnectionPool.new(
12
+ timeout: config.timeout,
13
+ size: config.size,
14
+ ) do
15
+ ::Redis::Namespace.new(
16
+ config.redis_ns,
17
+ redis: ::Redis.new(url: config.url, driver: config.driver),
18
+ )
19
+ end
21
20
  end
22
21
 
23
22
  def connection
@@ -25,7 +24,5 @@ module HellaRedis
25
24
  yield connection if block_given?
26
25
  end
27
26
  end
28
-
29
27
  end
30
-
31
28
  end
@@ -1,11 +1,11 @@
1
- require 'redis'
2
- require 'hella-redis/connection_pool'
3
- require 'hella-redis/connection_spy'
1
+ # frozen_string_literal: true
4
2
 
5
- module HellaRedis
3
+ require "redis"
4
+ require "hella-redis/connection_pool"
5
+ require "hella-redis/connection_spy"
6
6
 
7
+ module HellaRedis
7
8
  class ConnectionPoolSpy
8
-
9
9
  attr_reader :config, :connection_spy, :connection_calls
10
10
 
11
11
  def initialize(config)
@@ -28,14 +28,10 @@ module HellaRedis
28
28
  @connection_spy.calls = []
29
29
  end
30
30
 
31
- def ==(other_pool_spy)
32
- if other_pool_spy.kind_of?(ConnectionPoolSpy)
33
- self.config == other_pool_spy.config
34
- end
31
+ def ==(other)
32
+ config == other.config if other.is_a?(ConnectionPoolSpy)
35
33
  end
36
34
 
37
35
  ConnectionCall = Struct.new(:block)
38
-
39
36
  end
40
-
41
37
  end
@@ -1,16 +1,17 @@
1
- require 'redis'
1
+ # frozen_string_literal: true
2
2
 
3
- module HellaRedis
3
+ require "redis"
4
4
 
5
+ module HellaRedis
5
6
  class ConnectionSpy
6
-
7
7
  attr_accessor :calls
8
8
 
9
9
  def initialize(config)
10
- @instance = ::Redis.new({
11
- :url => config.url,
12
- :driver => config.driver
13
- })
10
+ @instance =
11
+ ::Redis.new(
12
+ url: config.url,
13
+ driver: config.driver,
14
+ )
14
15
  @calls = []
15
16
  end
16
17
 
@@ -25,19 +26,17 @@ module HellaRedis
25
26
  end
26
27
 
27
28
  def method_missing(name, *args, &block)
28
- if self.respond_to?(name)
29
+ if respond_to?(name)
29
30
  @calls << ConnectionCall.new(name, args, block)
30
31
  else
31
32
  super
32
33
  end
33
34
  end
34
35
 
35
- def respond_to?(*args)
36
+ def respond_to_missing?(*args)
36
37
  super || @instance.respond_to?(*args)
37
38
  end
38
39
 
39
40
  ConnectionCall = Struct.new(:command, :args, :block)
40
-
41
41
  end
42
-
43
42
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HellaRedis
2
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
3
5
  end
File without changes
data/test/helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # this file is automatically required when you run `assert`
2
4
  # put any test helpers here
3
5
 
@@ -5,15 +7,6 @@
5
7
  $LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
6
8
 
7
9
  # require pry for debugging (`binding.pry`)
8
- require 'pry'
9
-
10
- require 'test/support/factory'
11
-
12
- # 1.8.7 backfills
10
+ require "pry"
13
11
 
14
- # Array#sample
15
- if !(a = Array.new).respond_to?(:sample) && a.respond_to?(:choice)
16
- class Array
17
- alias_method :sample, :choice
18
- end
19
- end
12
+ require "test/support/factory"
@@ -1,20 +1,21 @@
1
- require 'assert/factory'
2
- require 'hella-redis'
1
+ # frozen_string_literal: true
2
+
3
+ require "assert/factory"
4
+ require "hella-redis"
3
5
 
4
6
  module Factory
5
7
  extend Assert::Factory
6
8
 
7
9
  def self.config(args = nil)
8
- HellaRedis::Config.new(self.config_args(args))
10
+ HellaRedis::Config.new(config_args(args))
9
11
  end
10
12
 
11
13
  def self.config_args(args = nil)
12
- { :timeout => Factory.integer,
13
- :size => Factory.integer(5),
14
- :redis_ns => "hella-redis-test-#{Factory.string}",
15
- :url => 'redis://localhost:6379/0',
16
- :driver => 'ruby'
14
+ { timeout: Factory.integer,
15
+ size: Factory.integer(5),
16
+ redis_ns: "hella-redis-test-#{Factory.string}",
17
+ url: "redis://localhost:6379/0",
18
+ driver: "ruby",
17
19
  }.merge(args || {})
18
20
  end
19
-
20
21
  end
@@ -1,16 +1,16 @@
1
- require 'assert'
2
- require 'hella-redis/connection_pool_spy'
1
+ # frozen_string_literal: true
3
2
 
4
- require 'hella-redis/connection_spy'
3
+ require "assert"
4
+ require "hella-redis/connection_pool_spy"
5
5
 
6
- class HellaRedis::ConnectionPoolSpy
6
+ require "hella-redis/connection_spy"
7
7
 
8
+ class HellaRedis::ConnectionPoolSpy
8
9
  class UnitTests < Assert::Context
9
10
  desc "HellaRedis::ConnectionPoolSpy"
10
11
  setup do
11
- Assert.stub(HellaRedis::ConnectionSpy, :new) do |*args|
12
- @connection_spy_created_with = args
13
- Assert.stub_send(HellaRedis::ConnectionSpy, :new, *args)
12
+ Assert.stub_tap_on_call(HellaRedis::ConnectionSpy, :new) do |_, call|
13
+ @connection_spy_new_call = call
14
14
  end
15
15
 
16
16
  @config = Factory.config
@@ -22,55 +22,53 @@ class HellaRedis::ConnectionPoolSpy
22
22
  should have_imeths :calls, :connection, :reset!
23
23
 
24
24
  should "know its config and redis spy" do
25
- assert_equal @config, subject.config
26
- assert_instance_of HellaRedis::ConnectionSpy, subject.connection_spy
27
- exp = [@config]
28
- assert_equal exp, @connection_spy_created_with
25
+ assert_that(subject.config).is(@config)
26
+ assert_that(subject.connection_spy)
27
+ .is_an_instance_of(HellaRedis::ConnectionSpy)
28
+ assert_that(@connection_spy_new_call.args).equals([@config])
29
29
  end
30
30
 
31
31
  should "default its connection calls" do
32
- assert_equal [], subject.connection_calls
32
+ assert_that(subject.connection_calls).equals([])
33
33
  end
34
34
 
35
35
  should "know its calls" do
36
- assert_same subject.connection_spy.calls, subject.calls
36
+ assert_that(subject.calls).is(subject.connection_spy.calls)
37
37
  end
38
38
 
39
39
  should "yield its connection spy using `connection`" do
40
40
  yielded = nil
41
41
  subject.connection{ |c| yielded = c }
42
42
 
43
- assert_same subject.connection_spy, yielded
43
+ assert_that(yielded).is(subject.connection_spy)
44
44
  end
45
45
 
46
46
  should "track calls to connection" do
47
- block = proc{ |c| Factory.string }
47
+ block = proc{ |_c| Factory.string }
48
48
  subject.connection(&block)
49
49
 
50
50
  call = subject.connection_calls.last
51
- assert_equal block, call.block
51
+ assert_that(call.block).is(block)
52
52
  end
53
53
 
54
54
  should "remove all calls on `reset!`" do
55
- subject.connection{ |c| c.info }
55
+ subject.connection(&:info)
56
56
 
57
- assert_not_empty subject.calls
58
- assert_not_empty subject.connection_calls
57
+ assert_that(subject.calls.empty?).is_false
58
+ assert_that(subject.connection_calls.empty?).is_false
59
59
 
60
60
  subject.reset!
61
61
 
62
- assert_empty subject.calls
63
- assert_empty subject.connection_calls
62
+ assert_that(subject.calls.empty?).is_true
63
+ assert_that(subject.connection_calls.empty?).is_true
64
64
  end
65
65
 
66
66
  should "know if it is equal to another pool spy" do
67
67
  equal_pool_spy = HellaRedis::ConnectionPoolSpy.new(@config)
68
- assert_equal subject, equal_pool_spy
68
+ assert_that(equal_pool_spy).equals(subject)
69
69
 
70
70
  not_equal_config = HellaRedis::ConnectionPoolSpy.new(Factory.config)
71
- assert_not_equal subject, not_equal_config
71
+ assert_that(not_equal_config).does_not_equal(subject)
72
72
  end
73
-
74
73
  end
75
-
76
74
  end
@@ -1,10 +1,11 @@
1
- require 'assert'
2
- require 'hella-redis/connection_pool'
1
+ # frozen_string_literal: true
3
2
 
4
- require 'redis-namespace'
3
+ require "assert"
4
+ require "hella-redis/connection_pool"
5
5
 
6
- class HellaRedis::ConnectionPool
6
+ require "redis-namespace"
7
7
 
8
+ class HellaRedis::ConnectionPool
8
9
  class UnitTests < Assert::Context
9
10
  desc "HellaRedis::Connection"
10
11
  setup do
@@ -16,11 +17,9 @@ class HellaRedis::ConnectionPool
16
17
 
17
18
  should "build a redis namespace and yield it using `connection`" do
18
19
  subject.connection do |connection|
19
- assert_instance_of ::Redis::Namespace, connection
20
- assert_nothing_raised{ connection.info }
20
+ assert_that(connection).is_an_instance_of(::Redis::Namespace)
21
+ assert_that{ connection.get(Factory.string) }.does_not_raise
21
22
  end
22
23
  end
23
-
24
24
  end
25
-
26
25
  end
@@ -1,8 +1,9 @@
1
- require 'assert'
2
- require 'hella-redis/connection_spy'
1
+ # frozen_string_literal: true
3
2
 
4
- class HellaRedis::ConnectionSpy
3
+ require "assert"
4
+ require "hella-redis/connection_spy"
5
5
 
6
+ class HellaRedis::ConnectionSpy
6
7
  class UnitTests < Assert::Context
7
8
  desc "HellaRedis::ConnectionSpy"
8
9
  setup do
@@ -14,37 +15,35 @@ class HellaRedis::ConnectionSpy
14
15
  should have_imeths :pipelined, :multi
15
16
 
16
17
  should "default its calls" do
17
- assert_equal [], subject.calls
18
+ assert_that(subject.calls).equals([])
18
19
  end
19
20
 
20
21
  should "track redis calls made to it" do
21
- assert_true subject.respond_to?(:set)
22
+ assert_that(subject.respond_to?(:set)).is_true
22
23
 
23
24
  key, value = [Factory.string, Factory.string]
24
25
  subject.set(key, value)
25
26
 
26
27
  call = subject.calls.first
27
- assert_equal :set, call.command
28
- assert_equal [key, value], call.args
28
+ assert_that(call.command).equals(:set)
29
+ assert_that(call.args).equals([key, value])
29
30
  end
30
31
 
31
32
  should "track the call and yield itself using `pipelined`" do
32
33
  subject.pipelined{ |c| c.set(Factory.string, Factory.string) }
33
- assert_equal [:pipelined, :set], subject.calls.map(&:command)
34
+ assert_that(subject.calls.map(&:command)).equals([:pipelined, :set])
34
35
  end
35
36
 
36
37
  should "track the call and yield itself using `multi`" do
37
38
  subject.multi{ |c| c.set(Factory.string, Factory.string) }
38
- assert_equal [:multi, :set], subject.calls.map(&:command)
39
+ assert_that(subject.calls.map(&:command)).equals([:multi, :set])
39
40
  end
40
41
 
41
42
  should "raise no method errors for non-redis methods" do
42
- assert_false subject.respond_to?(:super_awesome_set)
43
- assert_raises(NoMethodError) do
43
+ assert_that(subject.respond_to?(:super_awesome_set)).is_false
44
+ assert_that{
44
45
  subject.super_awesome_set(Factory.string, Factory.string)
45
- end
46
+ }.raises(NoMethodError)
46
47
  end
47
-
48
48
  end
49
-
50
49
  end
@@ -1,8 +1,9 @@
1
- require 'assert'
2
- require 'hella-redis'
1
+ # frozen_string_literal: true
3
2
 
4
- module HellaRedis
3
+ require "assert"
4
+ require "hella-redis"
5
5
 
6
+ module HellaRedis
6
7
  class UnitTests < Assert::Context
7
8
  desc "HellaRedis"
8
9
  setup do
@@ -12,7 +13,6 @@ module HellaRedis
12
13
  subject{ @module }
13
14
 
14
15
  should have_imeths :new, :real, :mock
15
-
16
16
  end
17
17
 
18
18
  class NewRealMockTests < UnitTests
@@ -21,46 +21,44 @@ module HellaRedis
21
21
 
22
22
  @pool = ConnectionPool.new(@config)
23
23
  @pool_new_called_with = nil
24
- Assert.stub(ConnectionPool, :new) do |*args|
25
- @pool_new_called_with = args
24
+ Assert.stub_on_call(ConnectionPool, :new) do |call|
25
+ @pool_new_call = call
26
26
  @pool
27
27
  end
28
28
 
29
29
  @pool_spy = ConnectionPoolSpy.new(@config)
30
30
  @pool_spy_new_called_with = nil
31
- Assert.stub(ConnectionPoolSpy, :new) do |*args|
32
- @pool_spy_new_called_with = args
31
+ Assert.stub_on_call(ConnectionPoolSpy, :new) do |call|
32
+ @pool_spy_new_call = call
33
33
  @pool_spy
34
34
  end
35
35
  end
36
-
37
36
  end
38
37
 
39
38
  class NewTests < NewRealMockTests
40
39
  desc "`new`"
41
40
  setup do
42
- @current_test_mode = ENV['HELLA_REDIS_TEST_MODE']
43
- ENV['HELLA_REDIS_TEST_MODE'] = 'yes'
41
+ @current_test_mode = ENV["HELLA_REDIS_TEST_MODE"]
42
+ ENV["HELLA_REDIS_TEST_MODE"] = "yes"
44
43
  end
45
44
  teardown do
46
- ENV['HELLA_REDIS_TEST_MODE'] = @current_test_mode
45
+ ENV["HELLA_REDIS_TEST_MODE"] = @current_test_mode
47
46
  end
48
47
 
49
48
  should "build and return a new connection pool" do
50
- ENV.delete('HELLA_REDIS_TEST_MODE')
49
+ ENV.delete("HELLA_REDIS_TEST_MODE")
51
50
  redis = subject.new(@config_args)
52
51
 
53
- assert_equal [@config], @pool_new_called_with
54
- assert_equal @pool, redis
52
+ assert_that(@pool_new_call.args).equals([@config])
53
+ assert_that(redis).equals(@pool)
55
54
  end
56
55
 
57
56
  should "build and return a connection pool spy in test mode" do
58
57
  redis = subject.new(@config_args)
59
58
 
60
- assert_equal [@config], @pool_spy_new_called_with
61
- assert_equal @pool_spy, redis
59
+ assert_that(@pool_spy_new_call.args).equals([@config])
60
+ assert_that(redis).equals(@pool_spy)
62
61
  end
63
-
64
62
  end
65
63
 
66
64
  class RealTests < NewRealMockTests
@@ -69,10 +67,9 @@ module HellaRedis
69
67
  should "build and return a connection pool spy" do
70
68
  redis = subject.real(@config_args)
71
69
 
72
- assert_equal [@config], @pool_new_called_with
73
- assert_equal @pool, redis
70
+ assert_that(@pool_new_call.args).equals([@config])
71
+ assert_that(redis).equals(@pool)
74
72
  end
75
-
76
73
  end
77
74
 
78
75
  class MockTests < NewRealMockTests
@@ -81,10 +78,9 @@ module HellaRedis
81
78
  should "build and return a connection pool spy" do
82
79
  redis = subject.mock(@config_args)
83
80
 
84
- assert_equal [@config], @pool_spy_new_called_with
85
- assert_equal @pool_spy, redis
81
+ assert_that(@pool_spy_new_call.args).equals([@config])
82
+ assert_that(redis).equals(@pool_spy)
86
83
  end
87
-
88
84
  end
89
85
 
90
86
  class ConfigTests < UnitTests
@@ -97,27 +93,25 @@ module HellaRedis
97
93
  should have_readers :url, :driver, :redis_ns, :timeout, :size
98
94
 
99
95
  should "know its attributes" do
100
- assert_equal @config_args[:url], subject.url
101
- assert_equal @config_args[:driver], subject.driver
102
- assert_equal @config_args[:redis_ns], subject.redis_ns
103
- assert_equal @config_args[:timeout], subject.timeout
104
- assert_equal @config_args[:size], subject.size
96
+ assert_that(subject.url).equals(@config_args[:url])
97
+ assert_that(subject.driver).equals(@config_args[:driver])
98
+ assert_that(subject.redis_ns).equals(@config_args[:redis_ns])
99
+ assert_that(subject.timeout).equals(@config_args[:timeout])
100
+ assert_that(subject.size).equals(@config_args[:size])
105
101
  end
106
102
 
107
103
  should "default its size" do
108
104
  @config_args.delete(:size)
109
105
  config = Config.new(@config_args)
110
- assert_equal 1, config.size
106
+ assert_that(config.size).equals(1)
111
107
  end
112
108
 
113
109
  should "know if it is equal to another config" do
114
110
  equal_config = Config.new(@config_args)
115
- assert_equal subject, equal_config
111
+ assert_that(subject).equals(equal_config)
116
112
 
117
113
  not_equal_config = Config.new
118
- assert_not_equal subject, not_equal_config
114
+ assert_that(subject).does_not_equal(not_equal_config)
119
115
  end
120
-
121
116
  end
122
-
123
117
  end
metadata CHANGED
@@ -1,69 +1,99 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hella-redis
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Kelly Redding
8
8
  - Collin Redding
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2017-04-05 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2021-05-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: assert
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 2.19.6
21
+ type: :development
17
22
  prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 2.16.1
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 2.19.6
28
+ - !ruby/object:Gem::Dependency
29
+ name: much-style-guide
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.6.3
23
35
  type: :development
24
- version_requirements: *id001
25
- - !ruby/object:Gem::Dependency
26
- name: redis
27
36
  prerelease: false
28
- requirement: &id002 !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- version: "3.2"
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.6.3
42
+ - !ruby/object:Gem::Dependency
43
+ name: redis
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 4.2.5
33
49
  type: :runtime
34
- version_requirements: *id002
35
- - !ruby/object:Gem::Dependency
36
- name: redis-namespace
37
50
  prerelease: false
38
- requirement: &id003 !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
42
- version: "1.5"
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 4.2.5
56
+ - !ruby/object:Gem::Dependency
57
+ name: redis-namespace
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 1.8.1
43
63
  type: :runtime
44
- version_requirements: *id003
45
- - !ruby/object:Gem::Dependency
46
- name: connection_pool
47
64
  prerelease: false
48
- requirement: &id004 !ruby/object:Gem::Requirement
49
- requirements:
50
- - - "="
51
- - !ruby/object:Gem::Version
52
- version: 0.9.2
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.1
70
+ - !ruby/object:Gem::Dependency
71
+ name: connection_pool
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 2.2.5
53
77
  type: :runtime
54
- version_requirements: *id004
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 2.2.5
55
84
  description: It's-a hella-redis!
56
- email:
85
+ email:
57
86
  - kelly@kellyredding.com
58
87
  - collin.redding@me.com
59
88
  executables: []
60
-
61
89
  extensions: []
62
-
63
90
  extra_rdoc_files: []
64
-
65
- files:
66
- - .gitignore
91
+ files:
92
+ - ".gitignore"
93
+ - ".l.yml"
94
+ - ".rubocop.yml"
95
+ - ".ruby-version"
96
+ - ".t.yml"
67
97
  - Gemfile
68
98
  - LICENSE
69
99
  - README.md
@@ -73,41 +103,38 @@ files:
73
103
  - lib/hella-redis/connection_pool_spy.rb
74
104
  - lib/hella-redis/connection_spy.rb
75
105
  - lib/hella-redis/version.rb
76
- - log/.gitkeep
106
+ - log/.keep
77
107
  - test/helper.rb
78
108
  - test/support/factory.rb
79
109
  - test/unit/connection_pool_spy_tests.rb
80
110
  - test/unit/connection_pool_tests.rb
81
111
  - test/unit/connection_spy_tests.rb
82
112
  - test/unit/hella-redis_tests.rb
83
- - tmp/.gitkeep
113
+ - tmp/.keep
84
114
  homepage: http://github.com/redding/hella-redis
85
- licenses:
115
+ licenses:
86
116
  - MIT
87
117
  metadata: {}
88
-
89
118
  post_install_message:
90
119
  rdoc_options: []
91
-
92
- require_paths:
120
+ require_paths:
93
121
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
95
- requirements:
96
- - &id005
97
- - ">="
98
- - !ruby/object:Gem::Version
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- requirements:
102
- - *id005
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '2.5'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
103
132
  requirements: []
104
-
105
- rubyforge_project:
106
- rubygems_version: 2.6.6
133
+ rubygems_version: 3.1.6
107
134
  signing_key:
108
135
  specification_version: 4
109
136
  summary: It's-a hella-redis!
110
- test_files:
137
+ test_files:
111
138
  - test/helper.rb
112
139
  - test/support/factory.rb
113
140
  - test/unit/connection_pool_spy_tests.rb