diff --git a/app/services/protocol_importers/build_protocol_from_client_service.rb b/app/services/protocol_importers/build_protocol_from_client_service.rb index 3fbc90ab8..d4c449f96 100644 --- a/app/services/protocol_importers/build_protocol_from_client_service.rb +++ b/app/services/protocol_importers/build_protocol_from_client_service.rb @@ -24,10 +24,8 @@ module ProtocolImporters pio = ProtocolImporters::ProtocolIntermediateObject.new(normalized_json: normalized_hash, user: @user, team: @team) - @pio_protocol = pio.build - unless @pio_protocol.valid? - @errors[:protocol] = pio.protocol.errors - end + + @errors[:protocol] = pio.protocol.errors unless @pio_protocol.valid? rescue StandardError => e @errors[:build_protocol] = e.message ensure diff --git a/app/utilities/protocol_importers/protocol_normalizer.rb b/app/utilities/protocol_importers/protocol_normalizer.rb index bd98725b8..a05c0ed4b 100644 --- a/app/utilities/protocol_importers/protocol_normalizer.rb +++ b/app/utilities/protocol_importers/protocol_normalizer.rb @@ -2,11 +2,11 @@ module ProtocolImporters class ProtocolNormalizer - def normalize_all_protocols(client_data) + def normalize_all_protocols(_client_data) raise NotImplementedError end - def normalize_protocol(client_data) + def normalize_protocol(_client_data) raise NotImplementedError end end diff --git a/spec/utilities/protocol_importers/protocols_io/v3/protocol_normalizer_spec.rb b/spec/utilities/protocol_importers/protocols_io/v3/protocol_normalizer_spec.rb index 6ba04df62..55a42d7e4 100644 --- a/spec/utilities/protocol_importers/protocols_io/v3/protocol_normalizer_spec.rb +++ b/spec/utilities/protocol_importers/protocols_io/v3/protocol_normalizer_spec.rb @@ -30,7 +30,7 @@ describe ProtocolImporters::ProtocolsIO::V3::ProtocolNormalizer do context 'when have all data' do it 'should normalize data correctly' do 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 end @@ -39,7 +39,7 @@ describe ProtocolImporters::ProtocolsIO::V3::ProtocolNormalizer do context 'when do not have name' do it 'sets nil for name' do 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 end