-
Notifications
You must be signed in to change notification settings - Fork 3
missing_field_behavior 's default to ignore #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ec1d7c5
2b758cf
0ace492
e2729b5
654020a
99350d8
c0b2da6
9b5eae2
117ce59
649836d
8e3167f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec| | |
| spec.add_development_dependency "rspec", "~> 3.0" | ||
| spec.add_development_dependency "rubocop", "0.67.2" # for onkcop | ||
| spec.add_development_dependency "sqlite3", "~> 1.4" | ||
| spec.add_development_dependency "simplecov", "~> 0.18.5" | ||
| spec.add_development_dependency "simplecov-cobertura", "~> 1.3" | ||
| spec.add_development_dependency "simplecov", "~> 0.19" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] reported by reviewdog 🐶 |
||
| spec.add_development_dependency "simplecov-cobertura", "~> 3.1" | ||
| spec.add_development_dependency "concurrent-ruby", "1.3.4" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] reported by reviewdog 🐶 |
||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ | |
| allow(Pb::Serializer).to receive(:configuration).and_return(config) | ||
|
|
||
| Pb::Serializer.configure do |c| | ||
| c.missing_field_behavior = missing_field_behavior | ||
| c.missing_field_behavior = missing_field_behavior if missing_field_behavior | ||
| c.logger = Logger.new(log_buffer) | ||
| end | ||
| end | ||
|
|
@@ -72,6 +72,29 @@ | |
| it { expect(log_buffer.string).to be_empty } | ||
| it { is_expected.to be_a TestFixture::Simple::Message } | ||
| end | ||
|
|
||
| context 'when missing_field_behavior is not configured (default behavior)' do | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] reported by reviewdog 🐶 |
||
| before do | ||
| # Reset configuration to test default behavior | ||
| Pb::Serializer.instance_variable_set(:@configuraiton, nil) | ||
| allow(Pb::Serializer).to receive(:configuration).and_call_original | ||
|
|
||
| # Don't configure missing_field_behavior to test default | ||
| Pb::Serializer.configure do |c| | ||
| c.logger = Logger.new(log_buffer) | ||
| end | ||
| end | ||
|
|
||
| # Override the parent's before block to avoid setting missing_field_behavior | ||
| let(:missing_field_behavior) { nil } | ||
|
|
||
| it 'uses default value :ignore' do | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] reported by reviewdog 🐶 |
||
| expect(Pb::Serializer.configuration.missing_field_behavior).to eq(:ignore) | ||
| end | ||
|
|
||
| it { expect(log_buffer.string).to be_empty } | ||
| it { is_expected.to be_a TestFixture::Simple::Message } | ||
| end | ||
| end | ||
|
|
||
| it 'raises when set invalid param to missing_field_behavior config' do | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macos-latestの2.5はもうサポートされていなかったので、
excludeを使ってみようとすると、Expected — Waiting for status to be reported なってしまいCIが
終わらない。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Branch Protection Rule で、
Status checks that are requiredからも消す必要があります(わかりづらいですよね... 自分も前にハマりました)https://github.com/wantedly/pb-serializer/settings/branch_protection_rules/15047227
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI で動かしている Ruby のバージョン、
[ 2.5, 2.6, 2.7 ]だと古すぎるので、3.0 以降とかにしてしまっていいと思いますね。gemspec にある Rails (activerecord)のバージョン指定が、
rails_versions = [">= 5.2", "< 6.1"]になっているので、Rails バージョンも一緒に上げてしまいたいですね。差分多くなりそうなので、別PRでやりましょう。