mock_redis 0.30.0 → 0.31.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
  SHA256:
3
- metadata.gz: 15bcc9fb58837462df30acd61176547493ce217061459f2c73e134f8ce15c5ab
4
- data.tar.gz: 46df9da818b1b4cdf817a2d8700d6321c182934379974aaa21393bd588b6ab04
3
+ metadata.gz: 2870385004370b0471f3cf495184d8e11f138e0cb13b9bef9bd43ed7ce2b35ff
4
+ data.tar.gz: 75475cf000d2075ad2565440aea2521fa1034248726b5070ff149d9518c00c3a
5
5
  SHA512:
6
- metadata.gz: 7322c682d6b702f98afcfd42aac3fe7c6676d63e064d977ddbbfdbaf0f40bca96cd88636e7fd43384dc00455e4421f56555342aabe5707af28ea084587060db9
7
- data.tar.gz: 36fa3abf3f2eef55e305a79ea6010edf90ba561e89b10466942f4f8f587c82cb400d97dae0cd330ff8bb73a494cff5171a8b3ab09485cdf76ae0804e9d1af0bb
6
+ metadata.gz: 6e6f75b19c46fd81ef553dfe1af1f32b2dceb13e4b660835cd58b1760fa8445c09c2ef26bf67cf64adcf87e196de24798333350e0a07ca0fac39939e296659e4
7
+ data.tar.gz: 77c2c5fc3f67f654d402161541b1527c6779859a0ec6e61a5fb6048b7abfcab50728ba2c25617a2adf303b22a23e662a8f2ee7236085db02682e0e8ca690438a
@@ -43,3 +43,21 @@ jobs:
43
43
 
44
44
  - name: Run tests
45
45
  run: bundle exec rspec
46
+
47
+ - name: Code coverage reporting
48
+ uses: coverallsapp/github-action@master
49
+ with:
50
+ github-token: ${{ secrets.github_token }}
51
+ flag-name: ruby${{ matrix.ruby-version }}-${{ matrix.redis-version }}
52
+ parallel: true
53
+
54
+ finish:
55
+ needs: rspec
56
+ runs-on: ubuntu-latest
57
+
58
+ steps:
59
+ - name: Finalize code coverage report
60
+ uses: coverallsapp/github-action@master
61
+ with:
62
+ github-token: ${{ secrets.github_token }}
63
+ parallel-finished: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # MockRedis Changelog
2
2
 
3
+ ### 0.31.0
4
+
5
+ * Allow `ping` to take argument
6
+ * Raise `CommandError` on `hmget` with empty list of fields
7
+
3
8
  ### 0.30.0
4
9
 
5
10
  * Drop support for Ruby 2.4 and Ruby 2.5 since they are EOL
data/Gemfile CHANGED
@@ -9,4 +9,5 @@ gem 'overcommit', '0.53.0'
9
9
  # Pin tool versions (which are executed by Overcommit) for Travis builds
10
10
  gem 'rubocop', '0.82.0'
11
11
 
12
- gem 'coveralls', require: false
12
+ gem 'simplecov', '~> 0.21.0'
13
+ gem 'simplecov-lcov', '~> 0.8.0'
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # MockRedis
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/mock_redis.svg)](http://badge.fury.io/rb/mock_redis)
4
- [![Build Status](https://travis-ci.org/sds/mock_redis.svg)](https://travis-ci.org/sds/mock_redis)
4
+ ![Build Status](https://github.com/sds/mock_redis/actions/workflows/tests.yml/badge.svg)
5
5
  [![Coverage Status](https://coveralls.io/repos/sds/mock_redis/badge.svg)](https://coveralls.io/r/sds/mock_redis)
6
6
 
7
7
  MockRedis provides the same interface as `redis-rb`, but it stores its
@@ -178,8 +178,8 @@ class MockRedis
178
178
  end
179
179
  end
180
180
 
181
- def ping
182
- 'PONG'
181
+ def ping(response = 'PONG')
182
+ response
183
183
  end
184
184
 
185
185
  def quit
@@ -75,8 +75,10 @@ class MockRedis
75
75
  end
76
76
 
77
77
  def hmget(key, *fields)
78
+ fields.flatten!
79
+
78
80
  assert_has_args(fields, 'hmget')
79
- fields.flatten.map { |f| hget(key, f) }
81
+ fields.map { |f| hget(key, f) }
80
82
  end
81
83
 
82
84
  def mapped_hmget(key, *fields)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  class MockRedis
5
- VERSION = '0.30.0'
5
+ VERSION = '0.31.0'
6
6
  end
@@ -21,7 +21,7 @@ describe '#expire(key, seconds)' do
21
21
 
22
22
  it 'raises an error if seconds is bogus' do
23
23
  lambda do
24
- @redises.expireat(@key, 'a couple minutes or so')
24
+ @redises.expire(@key, 'a couple minutes or so')
25
25
  end.should raise_error(Redis::CommandError)
26
26
  end
27
27
 
@@ -36,5 +36,11 @@ describe '#hmget(key, field [, field, ...])' do
36
36
  end.should raise_error(Redis::CommandError)
37
37
  end
38
38
 
39
+ it 'raises an error if given an empty list of fields' do
40
+ lambda do
41
+ @redises.hmget(@key, [])
42
+ end.should raise_error(Redis::CommandError)
43
+ end
44
+
39
45
  it_should_behave_like 'a hash-only command'
40
46
  end
@@ -21,7 +21,7 @@ describe '#pexpire(key, ms)' do
21
21
 
22
22
  it 'raises an error if ms is bogus' do
23
23
  lambda do
24
- @redises.pexpireat(@key, 'a couple minutes or so')
24
+ @redises.pexpire(@key, 'a couple minutes or so')
25
25
  end.should raise_error(Redis::CommandError)
26
26
  end
27
27
 
@@ -1,7 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe '#ping' do
4
- it "returns 'PONG'" do
4
+ it 'returns "PONG" with no arguments' do
5
5
  @redises.ping.should == 'PONG'
6
6
  end
7
+
8
+ it 'returns the argument' do
9
+ @redises.ping('HELLO').should == 'HELLO'
10
+ end
7
11
  end
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,17 @@
1
- if ENV['TRAVIS']
2
- # When running in Travis, report coverage stats to Coveralls.
3
- require 'coveralls'
4
- Coveralls.wear!
5
- else
6
- # Otherwise render coverage information in coverage/index.html and display
7
- # coverage percentage in the console.
8
- require 'simplecov'
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter 'spec/'
4
+
5
+ if ENV['CI']
6
+ require 'simplecov-lcov'
7
+
8
+ SimpleCov::Formatter::LcovFormatter.config do |c|
9
+ c.report_with_single_file = true
10
+ c.single_report_path = 'coverage/lcov.info'
11
+ end
12
+
13
+ formatter SimpleCov::Formatter::LcovFormatter
14
+ end
9
15
  end
10
16
 
11
17
  require 'rspec/its'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock_redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.0
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-17 00:00:00.000000000 Z
12
+ date: 2022-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby2_keywords