Skip to content

Commit

Permalink
Fix rubocop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nzwsch committed Nov 6, 2023
1 parent 2ccc5c6 commit 9b46fd7
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 36 deletions.
2 changes: 2 additions & 0 deletions lib/kredis/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Kredis
VERSION = "1.6.0"
end
20 changes: 10 additions & 10 deletions test/attributes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class AttributesTest < ActiveSupport::TestCase
assert_not @person.special?

@person.special.mark
assert @person.special?
assert_predicate @person, :special?

@person.special.remove
assert_not @person.special?
Expand All @@ -170,7 +170,7 @@ class AttributesTest < ActiveSupport::TestCase
assert_not @person.address.assigned?

@person.address.value = "Copenhagen"
assert @person.address.assigned?
assert_predicate @person.address, :assigned?
assert_equal "Copenhagen", @person.address.to_s

@person.address.clear
Expand Down Expand Up @@ -234,7 +234,7 @@ class AttributesTest < ActiveSupport::TestCase
assert_not @person.attention.reserve

@person.attention.release
assert @person.attention.available?
assert_predicate @person.attention, :available?

used_attention = false

Expand All @@ -251,15 +251,15 @@ class AttributesTest < ActiveSupport::TestCase

test "slots" do
assert @person.meetings.reserve
assert @person.meetings.available?
assert_predicate @person.meetings, :available?

assert @person.meetings.reserve
assert @person.meetings.reserve
assert_not @person.meetings.available?
assert_not @person.meetings.reserve

@person.meetings.release
assert @person.meetings.available?
assert_predicate @person.meetings, :available?

used_meeting = false

Expand All @@ -276,22 +276,22 @@ class AttributesTest < ActiveSupport::TestCase
end

test "enum" do
assert @person.morning.bright?
assert_predicate @person.morning, :bright?

assert @person.morning.value = "blue"
assert @person.morning.blue?
assert_predicate @person.morning, :blue?

assert_not @person.morning.black?

assert @person.morning.value = "nonsense"
assert @person.morning.blue?
assert_predicate @person.morning, :blue?

@person.morning.reset
assert @person.morning.bright?
assert_predicate @person.morning, :bright?
end

test "enum with default proc value" do
assert @person.eye_color_with_default_via_lambda.hazel?
assert_predicate @person.eye_color_with_default_via_lambda, :hazel?
end


Expand Down
2 changes: 1 addition & 1 deletion test/migration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MigrationTest < ActiveSupport::TestCase

Kredis::Migration.migrate from: "old_proxy", to: @proxy.key
assert_equal "hello there", @proxy.value
assert old_proxy.assigned?, "just copying the data"
assert_predicate old_proxy, :assigned?, "just copying the data"
end

test "migrate with blank keys" do
Expand Down
2 changes: 1 addition & 1 deletion test/types/counter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class CounterTest < ActiveSupport::TestCase
assert_not @counter.exists?

@counter.increment
assert @counter.exists?
assert_predicate @counter, :exists?
end

test "default value" do
Expand Down
16 changes: 8 additions & 8 deletions test/types/enum_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,39 @@ class EnumTest < ActiveSupport::TestCase
end

test "predicates" do
assert @enum.one?
assert_predicate @enum, :one?

@enum.value = "two"
assert @enum.two?
assert_predicate @enum, :two?

assert_not @enum.three?

@enum.three!
assert @enum.three?
assert_predicate @enum, :three?

assert_not @enum.two?
end

test "validated value" do
assert @enum.one?
assert_predicate @enum, :one?

@enum.value = "nonesense"
assert @enum.one?
assert_predicate @enum, :one?
end

test "reset" do
@enum.value = "two"
assert @enum.two?
assert_predicate @enum, :two?

@enum.reset
assert @enum.one?
assert_predicate @enum, :one?
end

test "exists?" do
enum = Kredis.enum "numbers", values: %w[ one two three ], default: nil
assert_not enum.exists?

enum.value = "one"
assert enum.exists?
assert_predicate enum, :exists?
end
end
10 changes: 5 additions & 5 deletions test/types/flag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ class FlagTest < ActiveSupport::TestCase
assert_not @flag.marked?

@flag.mark
assert @flag.marked?
assert_predicate @flag, :marked?

@flag.remove
assert_not @flag.marked?
end

test "expiring mark" do
@flag.mark(expires_in: 1.second)
assert @flag.marked?
assert_predicate @flag, :marked?

sleep 0.5.seconds
assert @flag.marked?
assert_predicate @flag, :marked?

sleep 0.6.seconds
assert_not @flag.marked?
Expand All @@ -33,10 +33,10 @@ class FlagTest < ActiveSupport::TestCase
assert @flag.mark(expires_in: 1.second, force: true)
assert_not @flag.mark(expires_in: 10.seconds, force: false)

assert @flag.marked?
assert_predicate @flag, :marked?

sleep 0.5.seconds
assert @flag.marked?
assert_predicate @flag, :marked?

sleep 0.6.seconds
assert_not @flag.marked?
Expand Down
2 changes: 1 addition & 1 deletion test/types/hash_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class HashTest < ActiveSupport::TestCase
assert_not @hash.exists?

@hash[:key] = :value
assert @hash.exists?
assert_predicate @hash, :exists?
end

test "default value" do
Expand Down
2 changes: 1 addition & 1 deletion test/types/list_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ListTest < ActiveSupport::TestCase
assert_not @list.exists?

@list.append(%w[ 1 2 3 ])
assert @list.exists?
assert_predicate @list, :exists?
end

test "ltrim" do
Expand Down
2 changes: 1 addition & 1 deletion test/types/ordered_set_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class OrderedSetTest < ActiveSupport::TestCase
assert_not @set.exists?

@set.append [ 1, 2 ]
assert @set.exists?
assert_predicate @set, :exists?
end

test "include?" do
Expand Down
2 changes: 1 addition & 1 deletion test/types/scalar_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ScalarTest < ActiveSupport::TestCase
assert_not string.assigned?

string.value = "Something!"
assert string.assigned?
assert_predicate string, :assigned?
end

test "clear" do
Expand Down
2 changes: 1 addition & 1 deletion test/types/set_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class SetTest < ActiveSupport::TestCase
assert_not @set.exists?

@set.add(%w[ 1 2 3 ])
assert @set.exists?
assert_predicate @set, :exists?
end

test "srandmember" do
Expand Down
10 changes: 5 additions & 5 deletions test/types/slots_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class SlotsTest < ActiveSupport::TestCase

test "reserve until no availability" do
assert @slots.reserve
assert @slots.available?
assert_predicate @slots, :available?

assert @slots.reserve
assert @slots.available?
assert_predicate @slots, :available?

assert @slots.reserve
assert_not @slots.available?
Expand All @@ -25,7 +25,7 @@ class SlotsTest < ActiveSupport::TestCase
assert_not @slots.available?

@slots.release
assert @slots.available?
assert_predicate @slots, :available?
end

test "release when slots are reserved" do
Expand Down Expand Up @@ -53,7 +53,7 @@ class SlotsTest < ActiveSupport::TestCase
false # ensure that block return value isn't returned from #reserve
})

assert @slots.available?
assert_predicate @slots, :available?
end

test "failed reserve with block" do
Expand Down Expand Up @@ -115,6 +115,6 @@ class SlotsTest < ActiveSupport::TestCase
assert_not @slots.exists?

@slots.reserve
assert @slots.exists?
assert_predicate @slots, :exists?
end
end
2 changes: 1 addition & 1 deletion test/types/unique_list_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class UniqueListTest < ActiveSupport::TestCase
assert_not @list.exists?

@list.append [ 1, 2 ]
assert @list.exists?
assert_predicate @list, :exists?
end

test "appending over limit" do
Expand Down

0 comments on commit 9b46fd7

Please sign in to comment.