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 60eefdd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ This format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## 0.16.3
### Changed
- Instead of appending to enum message, we're replacing it.
- Fixed our CI by locking 3 version of google-protobuf dependency
- Instead of appending to repeated enum message, we're replacing it to aboid duplicated values.
- Fixed our CI by locking 3 version of google-protobuf dependency.

## 0.16.2
### Added
Expand Down
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 60eefdd

Please sign in to comment.