Skip to content

Commit

Permalink
Update enum.test.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Nov 21, 2023
1 parent ca336a5 commit 20ad488
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/literal/enum.test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def toggle = Switch::On
end
end

test "index" do
test "where" do
expect(
Color.where(rgb: [0, 0, 255])
) == [Color::Blue]
Expand All @@ -49,6 +49,16 @@ def toggle = Switch::On
) == [Color::Blue]
end

test "find_by" do
expect(
Color.find_by(rgb: [0, 0, 255])
) == Color::Blue

expect(
Color.find_by(hex: "0000ff")
) == Color::Blue
end

test "handle" do
output = Color::Red.handle do |c|
c.when(Color::Red) { "red" }
Expand Down

0 comments on commit 20ad488

Please sign in to comment.