From ae33b13d202be0cde30a45e4924e2067e4fb3822 Mon Sep 17 00:00:00 2001 From: Stanislav Katkov Date: Wed, 20 Mar 2024 19:54:59 +0100 Subject: [PATCH] adding a test --- test/pbbuilder_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/pbbuilder_test.rb b/test/pbbuilder_test.rb index b8cb682..fca62eb 100644 --- a/test/pbbuilder_test.rb +++ b/test/pbbuilder_test.rb @@ -30,6 +30,22 @@ class PbbuilderTest < ActiveSupport::TestCase assert_equal "Eggs", person.favourite_foods["Breakfast"] end + test "duplicated enum fields don't happen" do + person = Pbbuilder.new(API::Person.new) do |pb| + pb.field_mask do + pb.paths ["ok", "that's"] + end + end.target! + + p = Pbbuilder.new(person) do |pb| + pb.field_mask do + pb.paths ["ok", "that's"] + end + end.target! + + assert_equal(["ok", "that's"], p.field_mask.paths) + end + test "it can extract fields in a nice way" do klass = Struct.new(:name) friends = [klass.new("Friend 1"), klass.new("Friend 2")]