-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3477 from betagouv/clean_code_naf
Clean code_naf with point in match_filter
- Loading branch information
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe MatchFilter do | ||
describe 'getter' do | ||
subject { match_filter.raw_accepted_naf_codes } | ||
|
||
let(:match_filter) { create :match_filter, accepted_naf_codes: accepted_naf_codes } | ||
|
||
context 'with full accepted_naf_codes' do | ||
let(:accepted_naf_codes) { ["9001Z", "9002Z"] } | ||
|
||
it { is_expected.to eq "9001Z 9002Z" } | ||
end | ||
|
||
context 'with empty accepted_naf_codes' do | ||
let(:accepted_naf_codes) { [] } | ||
|
||
it { is_expected.to eq '' } | ||
end | ||
end | ||
|
||
describe 'setter' do | ||
subject { match_filter.accepted_naf_codes } | ||
|
||
let(:match_filter) { create :match_filter, raw_accepted_naf_codes: raw_accepted_naf_codes } | ||
|
||
context 'with empty data' do | ||
let(:raw_accepted_naf_codes) { '' } | ||
|
||
it { is_expected.to eq [] } | ||
end | ||
|
||
context 'with proper values' do | ||
let(:raw_accepted_naf_codes) { '90.01Z 9002Z' } | ||
|
||
it { is_expected.to eq ["9001Z", "9002Z"] } | ||
end | ||
|
||
end | ||
end |