Hound fixes

This commit is contained in:
Jure Grabnar 2019-06-10 13:39:53 +02:00 committed by Urban Rotnik
parent 640f6c1211
commit 362b0cd45d
3 changed files with 6 additions and 8 deletions

View file

@ -24,10 +24,8 @@ module ProtocolImporters
pio = ProtocolImporters::ProtocolIntermediateObject.new(normalized_json: normalized_hash, pio = ProtocolImporters::ProtocolIntermediateObject.new(normalized_json: normalized_hash,
user: @user, user: @user,
team: @team) team: @team)
@pio_protocol = pio.build
unless @pio_protocol.valid? @errors[:protocol] = pio.protocol.errors unless @pio_protocol.valid?
@errors[:protocol] = pio.protocol.errors
end
rescue StandardError => e rescue StandardError => e
@errors[:build_protocol] = e.message @errors[:build_protocol] = e.message
ensure ensure

View file

@ -2,11 +2,11 @@
module ProtocolImporters module ProtocolImporters
class ProtocolNormalizer class ProtocolNormalizer
def normalize_all_protocols(client_data) def normalize_all_protocols(_client_data)
raise NotImplementedError raise NotImplementedError
end end
def normalize_protocol(client_data) def normalize_protocol(_client_data)
raise NotImplementedError raise NotImplementedError
end end
end end

View file

@ -30,7 +30,7 @@ describe ProtocolImporters::ProtocolsIO::V3::ProtocolNormalizer do
context 'when have all data' do context 'when have all data' do
it 'should normalize data correctly' do it 'should normalize data correctly' do
allow(client_data).to receive_message_chain(:parsed_response) allow(client_data).to receive_message_chain(:parsed_response)
.and_return(response) .and_return(response)
expect(subject.normalize_protocol(client_data).deep_stringify_keys).to be == normalized_result expect(subject.normalize_protocol(client_data).deep_stringify_keys).to be == normalized_result
end end
@ -39,7 +39,7 @@ describe ProtocolImporters::ProtocolsIO::V3::ProtocolNormalizer do
context 'when do not have name' do context 'when do not have name' do
it 'sets nil for name' do it 'sets nil for name' do
allow(client_data).to receive_message_chain(:parsed_response) allow(client_data).to receive_message_chain(:parsed_response)
.and_return(response_without_title) .and_return(response_without_title)
expect(subject.normalize_protocol(client_data)[:protocol][:name]).to be_nil expect(subject.normalize_protocol(client_data)[:protocol][:name]).to be_nil
end end