From f2c70ca88f4cad1e8241eda6c780338d569fa702 Mon Sep 17 00:00:00 2001 From: CoderMiguel <52347827+CoderMiguel@users.noreply.github.com> Date: Thu, 4 Jan 2024 09:40:44 -0500 Subject: [PATCH] clean up after review --- Gemfile | 2 +- lib/mock_redis/set_methods.rb | 1 - spec/support/redis_multiplexer.rb | 26 +++++++++++++------------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 5c1022a..803ad5a 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,6 @@ gem 'rubocop', '1.44.1' gem 'simplecov', '~> 0.22.0' gem 'simplecov-lcov', '~> 0.8.0' -# added gems +# TODO: gems added for development, remove before merge # gem 'pry' gem 'redis', '>= 5.0.0' diff --git a/lib/mock_redis/set_methods.rb b/lib/mock_redis/set_methods.rb index 7dbb6ea..b5d5e0f 100644 --- a/lib/mock_redis/set_methods.rb +++ b/lib/mock_redis/set_methods.rb @@ -126,7 +126,6 @@ def srem(key, members) s.delete_if { |m| members.include?(m) } orig_size - s.size else - # !!s.delete?(members.to_s) s.delete?(members.to_s) ? 1 : 0 end end diff --git a/spec/support/redis_multiplexer.rb b/spec/support/redis_multiplexer.rb index 33f1986..1fd8fed 100644 --- a/spec/support/redis_multiplexer.rb +++ b/spec/support/redis_multiplexer.rb @@ -55,25 +55,25 @@ def _gsub_clear elsif !equalish?(mock_retval, real_retval) && !mock_error && !real_error # no exceptions, just different behavior raise MismatchedResponse, - "Mock failure: responses not equal.\n" \ - "Redis.#{method}(#{args.inspect}) returned #{real_retval.inspect}\n" \ - "MockRedis.#{method}(#{args.inspect}) returned #{mock_retval.inspect}\n" + "Mock failure: responses not equal.\n" \ + "Redis.#{method}(#{args.inspect}) returned #{real_retval.inspect}\n" \ + "MockRedis.#{method}(#{args.inspect}) returned #{mock_retval.inspect}\n" elsif !mock_error && real_error raise MismatchedResponse, - "Mock failure: didn't raise an error when it should have.\n" \ - "Redis.#{method}(#{args.inspect}) raised #{real_error.inspect}\n" \ - "MockRedis.#{method}(#{args.inspect}) raised nothing " \ - "and returned #{mock_retval.inspect}" + "Mock failure: didn't raise an error when it should have.\n" \ + "Redis.#{method}(#{args.inspect}) raised #{real_error.inspect}\n" \ + "MockRedis.#{method}(#{args.inspect}) raised nothing " \ + "and returned #{mock_retval.inspect}" elsif !real_error && mock_error raise MismatchedResponse, - "Mock failure: raised an error when it shouldn't have.\n" \ - "Redis.#{method}(#{args.inspect}) returned #{real_retval.inspect}\n" \ - "MockRedis.#{method}(#{args.inspect}) raised #{mock_error.inspect}" + "Mock failure: raised an error when it shouldn't have.\n" \ + "Redis.#{method}(#{args.inspect}) returned #{real_retval.inspect}\n" \ + "MockRedis.#{method}(#{args.inspect}) raised #{mock_error.inspect}" elsif mock_error && real_error && !equalish?(mock_error, real_error) raise MismatchedResponse, - "Mock failure: raised the wrong error.\n" \ - "Redis.#{method}(#{args.inspect}) raised #{real_error.inspect}\n" \ - "MockRedis.#{method}(#{args.inspect}) raised #{mock_error.inspect}" + "Mock failure: raised the wrong error.\n" \ + "Redis.#{method}(#{args.inspect}) raised #{real_error.inspect}\n" \ + "MockRedis.#{method}(#{args.inspect}) raised #{mock_error.inspect}" end raise mock_error if mock_error