Skip to content

Commit

Permalink
clean up after review
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderMiguel committed Jan 4, 2024
1 parent 504d2a8 commit f2c70ca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
1 change: 0 additions & 1 deletion lib/mock_redis/set_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions spec/support/redis_multiplexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f2c70ca

Please sign in to comment.