Add spec to exercise numeric Enum deserialization

This commit is contained in:
Jamie Gaskins 2022-10-21 22:21:05 -04:00
parent b7a594e00a
commit a13f0f0f4e
3 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ describe DB::Database do
db.setup_connection do |cnn|
cnn_setup += 1
cnn.scalar("1").should eq "1"
cnn.scalar("a").should eq "a"
end
cnn_setup.should eq(2)

View file

@ -187,7 +187,7 @@ class DummyDriver < DB::Driver
return (@statement.as(DummyStatement)).params[0]
end
return n
n.to_i64? || n
end
def next_column_index : Int32

View file

@ -90,10 +90,10 @@ struct ModelWithEnum
getter c2 : MyOtherEnum
enum MyEnum
Foo
Bar
Baz
Quux
Foo = 0
Bar = 1
Baz = 2
Quux = 3
end
enum MyOtherEnum
@ -196,7 +196,7 @@ describe "DB::Serializable" do
end
it "should initialize a model with an enum property" do
expect_model("1,Baz,LOL", ModelWithEnum, {
expect_model("1,2,LOL", ModelWithEnum, {
c0: 1,
c1: ModelWithEnum::MyEnum::Baz,
c2: ModelWithEnum::MyOtherEnum::LOL,