Skip to content

Commit

Permalink
Avoid breaking current enum functionality, allowing setting an invali…
Browse files Browse the repository at this point in the history
…d default
  • Loading branch information
lewispb committed Aug 2, 2023
1 parent c32c663 commit c808076
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/kredis/types/enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def define_predicates_for_values
end

def set_default
self.value = default
set default
end
end
2 changes: 1 addition & 1 deletion test/types/enum_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class EnumTest < ActiveSupport::TestCase
enum = Kredis.enum "myenum3", values: [ 1, 2, 3 ], default: ->() { nil }
assert_nil enum.value
enum = Kredis.enum "myenum4", values: [ 1, 2, 3 ], default: ->() { 4 }
assert_nil enum.value
assert_equal "4", enum.value
end

test "predicates" do
Expand Down

0 comments on commit c808076

Please sign in to comment.