Skip to content

Commit

Permalink
adding a test
Browse files Browse the repository at this point in the history
  • Loading branch information
skatkov committed Mar 20, 2024
1 parent 8cf9353 commit ae33b13
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/pbbuilder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit ae33b13

Please sign in to comment.