From 6ed28f1ebadaeb85df3dbdf42d4104a5635c70cd Mon Sep 17 00:00:00 2001 From: Andrew Sparkes Date: Mon, 29 Jul 2024 11:08:31 +0100 Subject: [PATCH 001/141] activate GBS plus ANOSPP version of bed verification --- config/robots.rb | 52 +++++------------------------------------------- 1 file changed, 5 insertions(+), 47 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index 01435992e..d636d8974 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -1179,64 +1179,22 @@ } ) - # WIP: Activate for ANOSPP release # GBS pipeline bed verification # Allows use of either GBS or ANOSPP 96-well source plates # GBS-96 Stock or LANS-96 Lysate to GBS PCR1 # Transfers 4:1 (1-4 source 96-well plates of either type to 1 destination 384-well plate) - # custom_robot( - # 'mosquito-gbs-96-stock-to-gbs-pcr1', - # name: 'Mosquito GBS-96 Stock or LANS-96 Lysate => GBS PCR1', - # beds: { - # bed(1).barcode => { - # purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], - # states: %w[passed qc_complete], - # child: bed(3).barcode, - # label: 'Bed 1' - # }, - # bed(2).barcode => { - # purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], - # states: %w[passed qc_complete], - # child: bed(3).barcode, - # label: 'Bed 2' - # }, - # bed(3).barcode => { - # purpose: 'GBS PCR1', - # states: %w[pending], - # parents: [bed(1).barcode, bed(2).barcode, bed(4).barcode, bed(5).barcode], - # target_state: 'passed', - # label: 'Bed 3' - # }, - # bed(4).barcode => { - # purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], - # states: %w[passed qc_complete], - # child: bed(3).barcode, - # label: 'Bed 4' - # }, - # bed(5).barcode => { - # purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], - # states: %w[passed qc_complete], - # child: bed(3).barcode, - # label: 'Bed 5' - # } - # }, - # destination_bed: bed(3).barcode, - # class: 'Robots::QuadrantRobot' - # ) - - # WIP: Delete this version for ANOSPP release custom_robot( 'mosquito-gbs-96-stock-to-gbs-pcr1', - name: 'Mosquito GBS-96 Stock => GBS PCR1', + name: 'Mosquito GBS-96 Stock or LANS-96 Lysate => GBS PCR1', beds: { bed(1).barcode => { - purpose: 'GBS-96 Stock', + purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], states: %w[passed qc_complete], child: bed(3).barcode, label: 'Bed 1' }, bed(2).barcode => { - purpose: 'GBS-96 Stock', + purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], states: %w[passed qc_complete], child: bed(3).barcode, label: 'Bed 2' @@ -1249,13 +1207,13 @@ label: 'Bed 3' }, bed(4).barcode => { - purpose: 'GBS-96 Stock', + purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], states: %w[passed qc_complete], child: bed(3).barcode, label: 'Bed 4' }, bed(5).barcode => { - purpose: 'GBS-96 Stock', + purpose: ['GBS-96 Stock', 'LANS-96 Lysate'], states: %w[passed qc_complete], child: bed(3).barcode, label: 'Bed 5' From 0441d49a6606a4de08d9fe19ad3ed3ee2b8ad765 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 18:12:18 +0100 Subject: [PATCH 002/141] Add model for new bait_library_layouts endpoint on Sequencescape --- .../sequencescape/api/v2/bait_library_layout.rb | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/sequencescape/sequencescape/api/v2/bait_library_layout.rb diff --git a/app/sequencescape/sequencescape/api/v2/bait_library_layout.rb b/app/sequencescape/sequencescape/api/v2/bait_library_layout.rb new file mode 100644 index 000000000..bb5bb251d --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/bait_library_layout.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +# bait library layout resource +class Sequencescape::Api::V2::BaitLibraryLayout < Sequencescape::Api::V2::Base + custom_endpoint :preview, on: :collection, request_method: :post +end From d83859b333227fc9cdd4a414afbe24dcc221c8b0 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 18:27:52 +0100 Subject: [PATCH 003/141] Use SS API v2 endpoint for BaitLibraryLayout preview and creation --- app/models/labware_creators/baited_plate.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/labware_creators/baited_plate.rb b/app/models/labware_creators/baited_plate.rb index b4a49ccc6..bdefd362b 100644 --- a/app/models/labware_creators/baited_plate.rb +++ b/app/models/labware_creators/baited_plate.rb @@ -25,12 +25,13 @@ def plate end def bait_library_layout_preview - @bait_library_layout_preview ||= api.bait_library_layout.preview!(plate: parent_uuid, user: user_uuid).layout + @bait_library_layout_preview ||= + Sequencescape::Api::V2::BaitLibraryLayout.preview!(plate_uuid: parent_uuid, user_uuid: user_uuid).layout end def create_labware! create_plate_with_standard_transfer! do |child| - api.bait_library_layout.create!(plate: child.uuid, user: user_uuid) + Sequencescape::Api::V2::BaitLibraryLayout.create!(plate_uuid: child.uuid, user_uuid: user_uuid) end end From fc92a1e9becd700bb78ac2f0632d44c65555fdcf Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 18:41:45 +0100 Subject: [PATCH 004/141] Update the way the preview method is called --- app/models/labware_creators/baited_plate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/labware_creators/baited_plate.rb b/app/models/labware_creators/baited_plate.rb index bdefd362b..ebddd05c7 100644 --- a/app/models/labware_creators/baited_plate.rb +++ b/app/models/labware_creators/baited_plate.rb @@ -26,7 +26,7 @@ def plate def bait_library_layout_preview @bait_library_layout_preview ||= - Sequencescape::Api::V2::BaitLibraryLayout.preview!(plate_uuid: parent_uuid, user_uuid: user_uuid).layout + Sequencescape::Api::V2::BaitLibraryLayout.preview(plate_uuid: parent_uuid, user_uuid: user_uuid).first.layout end def create_labware! From 044a8bd870bb52145e0fecdd81ce608916fb823b Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 19:22:35 +0100 Subject: [PATCH 005/141] Fix tests for BaitLibraryLayout operations --- .../bait_library_layout_factories.rb | 8 ++--- .../bait_library_layout_factory_spec.rb | 32 ------------------- .../features/creating_plate_with_bait_spec.rb | 29 ++++++----------- .../labware_creators/baited_plate_spec.rb | 31 +++--------------- spec/support/api_url_helper.rb | 14 ++++---- 5 files changed, 24 insertions(+), 90 deletions(-) delete mode 100644 spec/factory_outputs/bait_library_layout_factory_spec.rb diff --git a/spec/factories/bait_library_layout_factories.rb b/spec/factories/bait_library_layout_factories.rb index 9301e066e..f5fc1bc58 100644 --- a/spec/factories/bait_library_layout_factories.rb +++ b/spec/factories/bait_library_layout_factories.rb @@ -3,11 +3,9 @@ require_relative '../support/factory_bot_extensions' FactoryBot.define do - # Generates a BaitLibraryLayout (API V1) - factory :bait_library_layout, class: Sequencescape::BaitLibraryLayout, traits: [:api_object] do - json_root { 'bait_library_layout' } - - with_belongs_to_associations 'plate' + # Generates an incomplete, but sufficient for testing, V2 BaitLibraryLayout + factory :bait_library_layout, class: Sequencescape::Api::V2::BaitLibraryLayout do + skip_create transient do # Provide an array of pools, describing the number of wells in each diff --git a/spec/factory_outputs/bait_library_layout_factory_spec.rb b/spec/factory_outputs/bait_library_layout_factory_spec.rb deleted file mode 100644 index 784db8853..000000000 --- a/spec/factory_outputs/bait_library_layout_factory_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe 'bait library layout factory' do - subject { json(:bait_library_layout, plate_uuid: 'plate-uuid', uuid: 'bait-library-layout-uuid') } - - let(:json_content) do - '{ - "bait_library_layout": { - "actions": {"read": "http://example.com:3000/bait-library-layout-uuid"}, - "plate": { - "actions": { - "read": "http://example.com:3000/plate-uuid" - }, - "uuid": "plate-uuid" - }, - "uuid": "bait-library-layout-uuid", - "layout": { - "A1": "Human all exon 50MB", - "B1": "Human all exon 50MB", - "C1": "Mouse all exon", - "D1": "Mouse all exon" - } - } - }' - end - - it 'should match the expected json' do - expect(JSON.parse(subject)['bait_library_layout']).to eq JSON.parse(json_content)['bait_library_layout'] - end -end diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index d7625dd66..9186a7f24 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -21,6 +21,8 @@ let(:transfer_template) { json :transfer_template, uuid: transfer_template_uuid } let(:expected_transfers) { WellHelpers.stamp_hash(96) } + let(:bait_library_layout) { create :bait_library_layout } + let(:transfer_requests) do WellHelpers.column_order(96)[0, 6].map do |well_name| { 'source_asset' => "2-well-#{well_name}", 'target_asset' => "3-well-#{well_name}", 'submission_id' => '2' } @@ -44,16 +46,11 @@ # end of stubs for plate show page # These stubs are required to render plate_creation baiting page - stub_api_post( - 'bait_library_layouts', - 'preview', - body: json(:bait_library_layout), - payload: { - bait_library_layout: { - plate: plate_uuid, - user: user_uuid - } - } + expect_api_v2_posts( + 'BaitLibraryLayout', + [{ plate_uuid: plate_uuid, user_uuid: user_uuid }], + [[bait_library_layout]], + method: :preview ) # end of stubs for plate_creation baiting page @@ -80,16 +77,8 @@ }, body: '{}' ) - stub_api_post( - 'bait_library_layouts', - body: json(:bait_library_layout), - payload: { - bait_library_layout: { - plate: 'child-uuid', - user: user_uuid - } - } - ) + + expect_api_v2_posts('BaitLibraryLayout', [{ plate_uuid: 'child-uuid', user_uuid: user_uuid }]) # end of stubs for creating a new plate with baits # Stub the requests for the next plate page diff --git a/spec/models/labware_creators/baited_plate_spec.rb b/spec/models/labware_creators/baited_plate_spec.rb index 798f39901..c8f11c6c8 100644 --- a/spec/models/labware_creators/baited_plate_spec.rb +++ b/spec/models/labware_creators/baited_plate_spec.rb @@ -23,6 +23,8 @@ let(:form_attributes) { { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:bait_library_layout) { create :bait_library_layout } + let(:transfer_requests) do WellHelpers.column_order(96)[0, 6].map do |well_name| { 'source_asset' => "2-well-#{well_name}", 'target_asset' => "3-well-#{well_name}", 'submission_id' => '2' } @@ -36,32 +38,6 @@ context 'create plate' do has_a_working_api - let!(:bait_library_layout_preview_request) do - stub_api_post( - 'bait_library_layouts/preview', - payload: { - bait_library_layout: { - plate: parent_uuid, - user: user_uuid - } - }, - body: json(:bait_library_layout) - ) - end - - let!(:bait_library_layout_request) do - stub_api_post( - 'bait_library_layouts', - payload: { - bait_library_layout: { - plate: 'child-uuid', - user: user_uuid - } - }, - body: json(:bait_library_layout) - ) - end - let!(:plate_creation_request) do stub_api_post( 'plate_creations', @@ -79,6 +55,9 @@ before do stub_v2_plate(parent, stub_search: false) stub_v2_plate(child, stub_search: false) + + stub_api_v2_post('BaitLibraryLayout') + stub_api_v2_post('BaitLibraryLayout', [bait_library_layout], method: :preview) end let!(:transfer_creation_request) do diff --git a/spec/support/api_url_helper.rb b/spec/support/api_url_helper.rb index 4894b46af..f9db6d946 100644 --- a/spec/support/api_url_helper.rb +++ b/spec/support/api_url_helper.rb @@ -89,16 +89,16 @@ def stub_api_v2_save(klass) allow_any_instance_of(receiving_class).to receive(:save).and_return(true) end - def stub_api_v2_post(klass, return_value = nil) - # intercepts the 'create!' method for any class beginning with - # 'Sequencescape::Api::V2::' and returns the given value or else true. + def stub_api_v2_post(klass, return_value = nil, method: :create!) + # intercepts the specified `method` for any class beginning with + # 'Sequencescape::Api::V2::' and returns the given `return_value`, or else `true`. receiving_class = "Sequencescape::Api::V2::#{klass}".constantize return_value ||= true - allow(receiving_class).to receive(:create!).and_return(return_value) + allow(receiving_class).to receive(method).and_return(return_value) end - def expect_api_v2_posts(klass, args_list, return_values = []) - # Expects the 'create!' method for any class beginning with + def expect_api_v2_posts(klass, args_list, return_values = [], method: :create!) + # Expects the specified `method` for any class beginning with # 'Sequencescape::Api::V2::' to be called with given arguments, in sequence, and returns the given values. # If return_values is empty, it will return true. receiving_class = "Sequencescape::Api::V2::#{klass}".constantize @@ -106,7 +106,7 @@ def expect_api_v2_posts(klass, args_list, return_values = []) .zip(return_values) .each do |args, ret| ret ||= true - expect(receiving_class).to receive(:create!).with(args).and_return(ret) + expect(receiving_class).to receive(method).with(args).and_return(ret) end end From 339464938131c0de9c17e2a1692ff0687485c118 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 6 Sep 2024 10:41:18 +0100 Subject: [PATCH 006/141] Add pry short aliases for debugging --- .pryrc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .pryrc diff --git a/.pryrc b/.pryrc new file mode 100644 index 000000000..ca997213f --- /dev/null +++ b/.pryrc @@ -0,0 +1,7 @@ +# frozen_string_literal: true +if defined?(PryByebug) + Pry.commands.alias_command 's', 'step' + Pry.commands.alias_command 'n', 'next' + Pry.commands.alias_command 'f', 'finish' + Pry.commands.alias_command 'c', 'continue' +end From e9baf7dd68e5ea46f4608f3f95b56cae809a9ade Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 6 Sep 2024 16:17:53 +0100 Subject: [PATCH 007/141] Use API v2 to create TagLayout during CustomTaggedPlate labware creator --- .../components/CustomTaggedPlate.vue | 4 ++-- app/models/labware_creators/custom_tagged_plate.rb | 12 +++++++----- app/sequencescape/sequencescape/api/v2/tag_layout.rb | 5 +++++ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 app/sequencescape/sequencescape/api/v2/tag_layout.rb diff --git a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue index 07220aff2..e4f92be76 100644 --- a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue +++ b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue @@ -619,8 +619,8 @@ export default { purpose_uuid: this.purposeUuid, parent_uuid: this.parentUuid, tag_layout: { - tag_group: this.tag1GroupUuid, - tag2_group: this.tag2GroupUuid, + tag_group_uuid: this.tag1GroupUuid, + tag2_group_uuid: this.tag2GroupUuid, direction: this.direction, walking_by: this.walkingBy, initial_tag: initialTag, diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 8892620e5..31a85dd98 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -18,10 +18,10 @@ class CustomTaggedPlate < Base { tag_plate: %i[asset_uuid template_uuid state], tag_layout: [ - :user, - :plate, - :tag_group, - :tag2_group, + :user_uuid, + :plate_uuid, + :tag_group_uuid, + :tag2_group_uuid, :direction, :walking_by, :initial_tag, @@ -107,7 +107,9 @@ def tag_layout_attributes def create_labware! create_plate! do |plate_uuid| - api.tag_layout.create!(tag_layout_attributes.merge(plate: plate_uuid, user: user_uuid)) + Sequencescape::Api::V2::TagLayout.create!( + tag_layout_attributes.merge(plate_uuid: plate_uuid, user_uuid: user_uuid) + ) end end end diff --git a/app/sequencescape/sequencescape/api/v2/tag_layout.rb b/app/sequencescape/sequencescape/api/v2/tag_layout.rb new file mode 100644 index 000000000..2e5f92fda --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/tag_layout.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +# tag layout resource +class Sequencescape::Api::V2::TagLayout < Sequencescape::Api::V2::Base +end From bc053a4ac9f31c398a9c7427f85054b1dec5c1af Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 10 Sep 2024 17:43:53 +0100 Subject: [PATCH 008/141] Update tests to match expectations from creating TagLayouts --- .../custom_tagged_plate_spec.rb | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 4c605f864..522fd4bd3 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -114,30 +114,48 @@ let(:expected_transfers) { WellHelpers.stamp_hash(96) } - def expect_transfer_creation + def expect_state_change_creation expect_api_v2_posts( - 'Transfer', + 'StateChange', + [ + { + reason: 'Used in Library creation', + target_uuid: tag_plate_uuid, + target_state: 'exhausted', + user_uuid: user_uuid + } + ] + ) + end + + def expect_tag_layout_creation + expect_api_v2_posts( + 'TagLayout', [ { user_uuid: user_uuid, - source_uuid: plate_uuid, - destination_uuid: child_plate_uuid, - transfer_template_uuid: transfer_template_uuid, - transfers: expected_transfers + plate_uuid: child_plate_uuid, + tag_group_uuid: 'tag-group-uuid', + tag2_group_uuid: 'tag2-group-uuid', + direction: 'column', + walking_by: 'manual by plate', + initial_tag: '1', + tags_per_well: 1 } ] ) end - def expect_state_change_creation + def expect_transfer_creation expect_api_v2_posts( - 'StateChange', + 'Transfer', [ { - reason: 'Used in Library creation', - target_uuid: tag_plate_uuid, - target_state: 'exhausted', - user_uuid: user_uuid + user_uuid: user_uuid, + source_uuid: plate_uuid, + destination_uuid: child_plate_uuid, + transfer_template_uuid: transfer_template_uuid, + transfers: expected_transfers } ] ) @@ -157,9 +175,9 @@ def expect_state_change_creation state: tag_plate_state }, tag_layout: { - user: 'user-uuid', - tag_group: 'tag-group-uuid', - tag2_group: 'tag2-group-uuid', + user_uuid: 'user-uuid', + tag_group_uuid: 'tag-group-uuid', + tag2_group_uuid: 'tag2-group-uuid', direction: 'column', walking_by: 'manual by plate', initial_tag: '1', @@ -176,37 +194,20 @@ def expect_state_change_creation it_behaves_like 'it has a custom page', 'custom_tagged_plate' context 'on save' do - let!(:custom_tag_layout_creation_request) do - stub_api_post( - 'tag_layouts', - payload: { - tag_layout: { - user: 'user-uuid', - plate: child_plate_uuid, - tag_group: 'tag-group-uuid', - tag2_group: 'tag2-group-uuid', - direction: 'column', - walking_by: 'manual by plate', - initial_tag: '1', - tags_per_well: 1 - } - } - ) - end - context 'with an available tag plate' do let(:tag_plate_state) { 'available' } it 'creates a tag plate' do - expect_transfer_creation expect_state_change_creation + expect_tag_layout_creation + expect_transfer_creation expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - expect(custom_tag_layout_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') stub_api_v2_post('StateChange') @@ -218,12 +219,12 @@ def expect_state_change_creation context 'when a user has exhausted the plate in another tab' do it 'creates a tag plate' do - expect_transfer_creation expect_state_change_creation + expect_tag_layout_creation + expect_transfer_creation expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - expect(custom_tag_layout_creation_request).to have_been_made.once end end end @@ -232,17 +233,18 @@ def expect_state_change_creation let(:tag_plate_state) { 'exhausted' } it 'creates a tagged plate' do + # This one will be VERY different + expect_tag_layout_creation + expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - - # This one will be VERY different - expect(custom_tag_layout_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true @@ -258,15 +260,16 @@ def expect_state_change_creation let(:parents) { [plate_uuid] } it 'creates a tag plate' do + expect_tag_layout_creation expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - expect(custom_tag_layout_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true From 4bad88ca83eb310bd30ac944501b76e909273c00 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 10 Sep 2024 17:51:11 +0100 Subject: [PATCH 009/141] Update Javascript tests --- .../custom-tagged-plate/components/CustomTaggedPlate.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js index 037afeb9c..954bfc22e 100644 --- a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js +++ b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js @@ -833,8 +833,8 @@ describe('CustomTaggedPlate', () => { purpose_uuid: 'purpose-uuid', parent_uuid: 'parent-plate-uuid', tag_layout: { - tag_group: 'tag-1-group-uuid', - tag2_group: 'tag-2-group-uuid', + tag_group_uuid: 'tag-1-group-uuid', + tag2_group_uuid: 'tag-2-group-uuid', direction: 'column', walking_by: 'manual by plate', initial_tag: 1, From 5ebd2467cb6e388eb606e56f9ccc3c8a4a5a8709 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 13 Sep 2024 11:35:16 +0100 Subject: [PATCH 010/141] Switch SpecificTubeCreation requests to go through API v2 --- .../labware_creators/plate_split_to_tube_racks.rb | 11 +++++------ app/models/labware_creators/pooled_tubes_base.rb | 11 +++++------ app/models/labware_creators/pooled_tubes_by_sample.rb | 11 +++++------ .../pooled_tubes_by_submission_with_phi_x.rb | 9 ++++----- .../pooled_tubes_from_whole_plates.rb | 11 +++++------ .../sequencescape/api/v2/specific_tube_creation.rb | 8 ++++++++ 6 files changed, 32 insertions(+), 29 deletions(-) create mode 100644 app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb diff --git a/app/models/labware_creators/plate_split_to_tube_racks.rb b/app/models/labware_creators/plate_split_to_tube_racks.rb index da3e2098d..f869083cd 100644 --- a/app/models/labware_creators/plate_split_to_tube_racks.rb +++ b/app/models/labware_creators/plate_split_to_tube_racks.rb @@ -405,13 +405,12 @@ def parent_wells_for_contingency # @param tube_attributes [Hash] A hash of attributes to use for the created tubes. # @return [Hash] A hash of the created tubes indexed by name. def create_tubes(tube_purpose_uuid, number_of_tubes, tube_attributes) - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parent_uuid, - child_purposes: [tube_purpose_uuid] * number_of_tubes, - tube_attributes: tube_attributes + child_purpose_uuids: [tube_purpose_uuid] * number_of_tubes, + parent_uuids: [parent_uuid], + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_base.rb b/app/models/labware_creators/pooled_tubes_base.rb index f55e8bc3a..e8ae7a7e2 100644 --- a/app/models/labware_creators/pooled_tubes_base.rb +++ b/app/models/labware_creators/pooled_tubes_base.rb @@ -20,13 +20,12 @@ def create_labware! end def create_child_stock_tubes - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + child_purpose_uuids: [purpose_uuid] * pool_uuids.length, + parent_uuids: [parent_uuid], + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_by_sample.rb b/app/models/labware_creators/pooled_tubes_by_sample.rb index 29121318a..6504e0c76 100644 --- a/app/models/labware_creators/pooled_tubes_by_sample.rb +++ b/app/models/labware_creators/pooled_tubes_by_sample.rb @@ -47,13 +47,12 @@ def parent_v1 # Have we made this class so cardinal-specific (e.g. lookup of ancestor vac tubes) that it cannot be re-used? def create_child_stock_tubes - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + child_purpose_uuids: [purpose_uuid] * pool_uuids.length, + parent_uuids: [parent_uuid], + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index f0d6103f0..50d7a916d 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -15,13 +15,12 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission attr_accessor :spikedbuffer_tube_barcode def create_child_stock_tubes - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parents: parents, child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + parent_uuids: parents, + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb index 41a09f490..33f9034ca 100644 --- a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb +++ b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb @@ -17,13 +17,12 @@ def create_labware! # Create a single tube # TODO: This should link to multiple parents in production @child = - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parents.first.uuid, - child_purposes: [purpose_uuid], - tube_attributes: [{ name: "#{stock_plate_barcode}+" }] + child_purpose_uuids: [purpose_uuid], + parent_uuids: [parents.first.uuid], + tube_attributes: [{ name: "#{stock_plate_barcode}+" }], + user_uuid: user_uuid ) .children .first diff --git a/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb new file mode 100644 index 000000000..035a70c5a --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Represents a specific tube creation in Limber via the Sequencescape API +class Sequencescape::Api::V2::SpecificTubeCreation < Sequencescape::Api::V2::Base + has_many :children, class_name: 'Sequencescape::Api::V2::Tube' + has_many :parents, class_name: 'Sequencescape::Api::V2::Asset' + has_one :user, class_name: 'Sequencescape::Api::V2::User' +end From 1860cce4e0dcc49e02bf84dc8b67c6a11ac3355e Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 16 Sep 2024 16:58:38 +0100 Subject: [PATCH 011/141] Fix tests for pooling multiple plates into one tube --- .../pooled_tubes_from_whole_plates.rb | 6 ++- ...ling_multiple_plates_into_one_tube_spec.rb | 51 +++++++------------ 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb index 33f9034ca..937e23569 100644 --- a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb +++ b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb @@ -15,7 +15,7 @@ class PooledTubesFromWholePlates < Base def create_labware! # Create a single tube - # TODO: This should link to multiple parents in production + # TODO: {Y24-190} See if we can do all the transfers as part of the SpecificTubeCreation instead of separately. @child = Sequencescape::Api::V2::SpecificTubeCreation .create!( @@ -39,6 +39,10 @@ def stock_plate_barcode "#{parents.first.stock_plate.barcode.prefix}#{parents.first.stock_plate.barcode.number}" end + def redirection_target + TubeProxy.new(@child.uuid) + end + # TODO: This should probably be asynchronous def available_plates @search_options = OngoingPlate.new(purposes: [parent.plate_purpose.uuid], include_used: false, states: ['passed']) diff --git a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb index 73937a3d7..1e2487b1a 100644 --- a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb @@ -57,32 +57,13 @@ end let(:example_plate_3_listed) { associated(*example_plate3_args) } - let(:child_tube_uuid) { 'tube-0' } - let(:child_tube) do - create :v2_tube, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool tube', uuid: child_tube_uuid - end + let(:child_tube) { create :v2_tube, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool tube' } - let(:tube_creation_request_uuid) { SecureRandom.uuid } - - let!(:tube_creation_request) do - # TODO: In reality we want to link in all four parents. - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - user: user_uuid, - parent: plate_uuid, - child_purposes: ['child-purpose-0'], - tube_attributes: [{ name: 'DN2+' }] - } - }, - body: json(:specific_tube_creation, uuid: tube_creation_request_uuid, children_count: 1) - ) - end + let(:specific_tube_creation) do + response = double + allow(response).to receive(:children).and_return([child_tube]) - # Find out what tubes we've just made! - let!(:tube_creation_children_request) do - stub_api_get(tube_creation_request_uuid, 'children', body: json(:tube_collection, names: ['DN1+'])) + response end # Used to fetch the pools. This is the kind of thing we could pass through from a custom form @@ -119,8 +100,6 @@ stub_v2_plate(example_plate_new_api) - stub_v2_plate(example_plate_new_api) - stub_api_get(plate_uuid, body: example_plate) stub_api_get(plate_uuid, 'wells', body: well_set_a) @@ -132,13 +111,25 @@ scenario 'creates multiple plates' do stub_v2_plate(example_plate_2) + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: ['child-purpose-0'], + parent_uuids: [plate_uuid], + tube_attributes: [{ name: 'DN2+' }], + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) expect_api_v2_posts( 'Transfer', [plate_uuid, plate_uuid_2].map do |source_uuid| { user_uuid: user_uuid, source_uuid: source_uuid, - destination_uuid: 'tube-0', + destination_uuid: child_tube.uuid, transfer_template_uuid: 'whole-plate-to-tube' } end @@ -156,15 +147,11 @@ click_on('Make Pool') expect(page).to have_text('New empty labware added to the system') expect(page).to have_text('Pool tube') - - # This isn't strictly speaking correct to test. But there isn't a great way - # of confirming that the right information got passed to the back end otherwise. - # (Although you expect it to fail on an incorrect request) - expect(tube_creation_request).to have_been_made end scenario 'detects tag clash' do stub_v2_plate(example_plate_3) + fill_in_swipecard_and_barcode(user_swipecard, plate_barcode_1) plate_title = find('#plate-title') expect(plate_title).to have_text('example-purpose') From 1d5fc5f29be24452fdfa28cc7da04732a5fac702 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 16 Sep 2024 17:02:21 +0100 Subject: [PATCH 012/141] Fix test for pooled tubes from whole plates --- .../pooled_tubes_from_whole_plates_spec.rb | 49 +++++++------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb index e5ce80273..993edb48b 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb @@ -53,54 +53,43 @@ { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid, barcodes: barcodes } end - let(:tube_creation_request_uuid) { SecureRandom.uuid } + let(:child_tube) { create :v2_tube } + let(:specific_tube_creation) do + response = double + allow(response).to receive(:children).and_return([child_tube]) - let(:tube_creation_request) do - # TODO: In reality we want to link in all four parents. - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid], - tube_attributes: [{ name: 'DN2+' }] - } - }, - body: json(:specific_tube_creation, uuid: tube_creation_request_uuid, children_count: 1) - ) + response end - # Find out what tubes we've just made! - let(:tube_creation_children_request) do - stub_api_get(tube_creation_request_uuid, 'children', body: json(:tube_collection, names: ['DN2+'])) - end - - # Used to fetch the pools. This is the kind of thing we could pass through from a custom form - let(:stub_barcode_searches) { stub_asset_search(barcodes, [parent, parent2, parent3, parent4]) } - - before do - stub_barcode_searches - tube_creation_children_request - tube_creation_request - end + before { stub_asset_search(barcodes, [parent, parent2, parent3, parent4]) } context 'with compatible plates' do it 'pools from all the plates' do + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [purpose_uuid], + parent_uuids: [parent_uuid], + tube_attributes: [{ name: 'DN2+' }], + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) expect_api_v2_posts( 'Transfer', [parent_uuid, parent2_uuid, parent3_uuid, parent4_uuid].map do |source_uuid| { user_uuid: user_uuid, source_uuid: source_uuid, - destination_uuid: 'tube-0', + destination_uuid: child_tube.uuid, transfer_template_uuid: 'whole-plate-to-tube' } end ) expect(subject.save!).to be_truthy - expect(tube_creation_request).to have_been_made.once end end end From a4a38082c09ab4cc636603e0e0b3460bc96503b7 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 13:24:13 +0100 Subject: [PATCH 013/141] Fix tests for plate_split_to_tube_racks --- .../plate_split_to_tube_racks_spec.rb | 380 +++++++----------- 1 file changed, 144 insertions(+), 236 deletions(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 4ab8c6154..040feb362 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -201,6 +201,56 @@ ) end + def prepare_created_child_tubes(tube_attributes) + # Prepare child tubes and stub their lookups. + child_tubes = + tube_attributes.map { |attrs| create(:v2_tube, name: attrs[:name], foreign_barcode: attrs[:foreign_barcode]) } + child_tubes.each { |child_tube| stub_v2_labware(child_tube) } + + child_tubes + end + + def expect_specific_tube_creation(child_purpose_uuid, child_tubes) + # Create a mock for the specific tube creation. + specific_tube_creation = double + allow(specific_tube_creation).to receive(:children).and_return(child_tubes) + + # Expect the post request and return the mock. + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [child_purpose_uuid] * child_tubes.size, + parent_uuids: [parent_uuid], + tube_attributes: child_tubes.map { |tube| { name: tube.name, foreign_barcode: tube.foreign_barcode } }, + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) + end + + # tubes_hash should be a hash with tube rack barcodes as keys and arrays of tubes as values. + def expect_custom_metadatum_collection_posts(tubes_hash) + # Prepare the expected call arguments. + expected_call_args = + tubes_hash.flat_map do |tube_rack_barcode, tubes| + tubes.map do |tube| + metadata = { + user_id: user.id, + asset_id: tube.id, + metadata: { + tube_rack_barcode: tube_rack_barcode, + tube_rack_position: tube.name.split(':').last + } + } + end + end + + # Expect the post requests. + expect_api_v2_posts('CustomMetadatumCollection', expected_call_args) + end + before do # need both child tubes to have a purpose config here create( @@ -661,48 +711,16 @@ ) end - # stub the contingency tube creation - let!(:stub_contingency_tube_creation_request_uuid) { SecureRandom.uuid } - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [ - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid - ], - tube_attributes: [ - # sample 1 from well A2 to contingency tube 1 in A1 - { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, - # sample 2 from well B2 to contingency tube 2 in B1 - { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, - # sample 1 from well A3 to contingency tube 3 in C1 - { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 3) - ) - end - - # stub what contingency tubes were just made - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 3, - names: %w[SPR:NT1O:A1 SPR:NT2P:B1 SPR:NT1O:C1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12, 13], - uuid_index_offset: 2 - ) + let(:contingency_tubes) do + prepare_created_child_tubes( + [ + # sample 1 from well A2 to contingency tube 1 in A1 + { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, + # sample 2 from well B2 to contingency tube 2 in B1 + { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, + # sample 1 from well A3 to contingency tube 3 in C1 + { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' } + ] ) end @@ -742,6 +760,17 @@ content end + let(:sequencing_tubes) do + prepare_created_child_tubes( + [ + # sample 1 in well A1 to seq tube 1 in A1 + { name: 'SEQ:NT1O:A1', foreign_barcode: 'FX00000001' }, + # sample 2 in well B1 to seq tube 2 in B1 + { name: 'SEQ:NT2P:B1', foreign_barcode: 'FX00000002' } + ] + ) + end + # stub the sequencing file upload let!(:stub_sequencing_file_upload) do stub_request(:post, api_url_for(parent_uuid, 'qc_files')) @@ -761,58 +790,20 @@ ) end - # stub the sequencing tube creation - let!(:stub_sequencing_tube_creation_request_uuid) { SecureRandom.uuid } - let!(:stub_sequencing_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [child_sequencing_tube_purpose_uuid, child_sequencing_tube_purpose_uuid], - tube_attributes: [ - # sample 1 in well A1 to seq tube 1 in A1 - { name: 'SEQ:NT1O:A1', foreign_barcode: 'FX00000001' }, - # sample 2 in well B1 to seq tube 2 in B1 - { name: 'SEQ:NT2P:B1', foreign_barcode: 'FX00000002' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_sequencing_tube_creation_request_uuid, children_count: 2) - ) - end - - # stub what sequencing tubes were just made - let!(:stub_sequencing_tube_creation_children_request) do - stub_api_get( - stub_sequencing_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 2, - names: %w[SEQ:NT1O:A1 SEQ:NT2P:B1], - barcode_prefix: 'FX', - barcode_numbers: [1, 2] - ) - ) - end - # stub the transfer creation let!(:stub_transfer_creation_request) do + parent_wells = [parent_well_a1, parent_well_b1, parent_well_a2, parent_well_b2, parent_well_a3] + target_tubes = sequencing_tubes + contingency_tubes + transfer_requests = + parent_wells.map.with_index do |parent_well, index| + { 'submission_id' => '2', 'source_asset' => parent_well.uuid, 'target_asset' => target_tubes[index].uuid } + end stub_api_post( 'transfer_request_collections', payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: [ - { 'submission_id' => '2', 'source_asset' => parent_well_a1.uuid, 'target_asset' => 'tube-0' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b1.uuid, 'target_asset' => 'tube-1' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a2.uuid, 'target_asset' => 'tube-2' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b2.uuid, 'target_asset' => 'tube-3' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a3.uuid, 'target_asset' => 'tube-4' } - ] + transfer_requests: transfer_requests } }, body: '{}' @@ -860,17 +851,17 @@ end it 'creates the child tubes' do - expect_api_v2_posts( - 'CustomMetadatumCollection', - [tube_1_create_args, tube_2_create_args, tube_3_create_args, tube_4_create_args, tube_5_create_args] + expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) + expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) + + expect_custom_metadatum_collection_posts( + { 'TR00000001' => sequencing_tubes, 'TR00000002' => contingency_tubes } ) expect(subject.valid?).to be_truthy expect(subject.save).to be_truthy expect(stub_sequencing_file_upload).to have_been_made.once - expect(stub_sequencing_tube_creation_request).to have_been_made.once expect(stub_contingency_file_upload).to have_been_made.once - expect(stub_contingency_tube_creation_request).to have_been_made.once expect(stub_transfer_creation_request).to have_been_made.once end @@ -880,94 +871,20 @@ create(:v2_well, location: 'A1', aliquots: [parent_aliquot_sample1_aliquot1], state: 'failed') end - # as A1 is failed order of samples is changed - let!(:stub_sequencing_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [child_sequencing_tube_purpose_uuid, child_sequencing_tube_purpose_uuid], - tube_attributes: [ - # sample 2 in well B1 to seq tube 1 in A1 - { name: 'SEQ:NT2P:A1', foreign_barcode: 'FX00000001' }, - # sample 1 in well A2 to seq tube 2 in B1 - { name: 'SEQ:NT1O:B1', foreign_barcode: 'FX00000002' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_sequencing_tube_creation_request_uuid, children_count: 2) - ) - end - - # stub what sequencing tubes were just made (order changed) - let!(:stub_sequencing_tube_creation_children_request) do - stub_api_get( - stub_sequencing_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 2, - names: %w[SEQ:NT2P:A1 SEQ:NT1O:B1], - barcode_prefix: 'FX', - barcode_numbers: [1, 2] - ) - ) - end - - # only 2 contingency tubes will be needed - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [child_contingency_tube_purpose_uuid, child_contingency_tube_purpose_uuid], - tube_attributes: [ - # sample 2 from well B2 to contingency tube 1 in A1 - { name: 'SPR:NT2P:A1', foreign_barcode: 'FX00000011' }, - # sample 1 from well A3 to contingency tube 2 in B1 - { name: 'SPR:NT1O:B1', foreign_barcode: 'FX00000012' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 3) - ) - end - - # stub what contingency tubes were just made (just 2) - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 2, - names: %w[SPR:NT2P:A1 SPR:NT1O:B1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12], - uuid_index_offset: 2 - ) - ) - end - # one fewer transfer request let!(:stub_transfer_creation_request) do + parent_wells = [parent_well_b1, parent_well_a2, parent_well_b2, parent_well_a3] + target_tubes = sequencing_tubes + contingency_tubes + transfer_requests = + parent_wells.map.with_index do |parent_well, index| + { 'submission_id' => '2', 'source_asset' => parent_well.uuid, 'target_asset' => target_tubes[index].uuid } + end stub_api_post( 'transfer_request_collections', payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: [ - { 'submission_id' => '2', 'source_asset' => parent_well_b1.uuid, 'target_asset' => 'tube-0' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a2.uuid, 'target_asset' => 'tube-1' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b2.uuid, 'target_asset' => 'tube-2' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a3.uuid, 'target_asset' => 'tube-3' } - ] + transfer_requests: transfer_requests } }, body: '{}' @@ -981,6 +898,28 @@ ) end + let(:sequencing_tubes) do + prepare_created_child_tubes( + [ + # sample 2 in well B1 to seq tube 1 in A1 + { name: 'SEQ:NT2P:A1', foreign_barcode: 'FX00000001' }, + # sample 1 in well A2 to seq tube 2 in B1 + { name: 'SEQ:NT1O:B1', foreign_barcode: 'FX00000002' } + ] + ) + end + + let(:contingency_tubes) do + prepare_created_child_tubes( + [ + # sample 2 from well B2 to contingency tube 1 in A1 + { name: 'SPR:NT2P:A1', foreign_barcode: 'FX00000011' }, + # sample 1 from well A3 to contingency tube 2 in B1 + { name: 'SPR:NT1O:B1', foreign_barcode: 'FX00000012' } + ] + ) + end + before do stub_get_labware_metadata(child_tube_1_v2.barcode.machine, child_tube_1_v1) stub_get_labware_metadata(child_tube_2_v2.barcode.machine, child_tube_2_v1) @@ -994,17 +933,17 @@ end it 'does not create a tube for the failed well' do - expect_api_v2_posts( - 'CustomMetadatumCollection', - [tube_1_create_args, tube_2_create_args, tube_3_create_args, tube_4_create_args] # no tube 5 + expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) + expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) + + expect_custom_metadatum_collection_posts( + { 'TR00000001' => sequencing_tubes, 'TR00000002' => contingency_tubes } ) expect(subject.valid?).to be_truthy expect(subject.save).to be_truthy expect(stub_sequencing_file_upload).to have_been_made.once - expect(stub_sequencing_tube_creation_request).to have_been_made.once expect(stub_contingency_file_upload).to have_been_made.once - expect(stub_contingency_tube_creation_request).to have_been_made.once expect(stub_transfer_creation_request).to have_been_made.once end end @@ -1090,69 +1029,40 @@ ) end - # stub the contingency tube creation - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [ - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid - ], - tube_attributes: [ - # sample 1 from well A1 to contingency tube 1 in A1 - { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, - # sample 2 from well B1 to contingency tube 2 in B1 - { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, - # sample 1 from well A2 to contingency tube 3 in C1 - { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' }, - # sample 2 from well B2 to contingency tube 4 in E1 (D1 set as NO READ) - { name: 'SPR:NT2P:E1', foreign_barcode: 'FX00000014' }, - # sample 1 from well A3 to contingency tube 5 in F1 - { name: 'SPR:NT1O:F1', foreign_barcode: 'FX00000015' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 5) - ) - end - - # stub what contingency tubes were just made - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 5, - names: %w[SPR:NT1O:A1 SPR:NT2P:B1 SPR:NT1O:C1 SPR:NT2P:E1 SPR:NT1O:F1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12, 13, 14, 15] - ) + let(:contingency_tubes) do + prepare_created_child_tubes( + [ + # sample 1 from well A1 to contingency tube 1 in A1 + { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, + # sample 2 from well B1 to contingency tube 2 in B1 + { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, + # sample 1 from well A2 to contingency tube 3 in C1 + { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' }, + # sample 2 from well B2 to contingency tube 4 in E1 (D1 set as NO READ) + { name: 'SPR:NT2P:E1', foreign_barcode: 'FX00000014' }, + # sample 1 from well A3 to contingency tube 5 in F1 + { name: 'SPR:NT1O:F1', foreign_barcode: 'FX00000015' } + ] ) end # stub the transfer creation let!(:stub_transfer_creation_request) do + parent_wells = [parent_well_a1, parent_well_b1, parent_well_a2, parent_well_b2, parent_well_a3] + transfer_requests = + parent_wells.map.with_index do |parent_well, index| + { + 'submission_id' => '2', + 'source_asset' => parent_well.uuid, + 'target_asset' => contingency_tubes[index].uuid + } + end stub_api_post( 'transfer_request_collections', payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: [ - { 'submission_id' => '2', 'source_asset' => parent_well_a1.uuid, 'target_asset' => 'tube-0' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b1.uuid, 'target_asset' => 'tube-1' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a2.uuid, 'target_asset' => 'tube-2' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b2.uuid, 'target_asset' => 'tube-3' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a3.uuid, 'target_asset' => 'tube-4' } - ] + transfer_requests: transfer_requests } }, body: '{}' @@ -1193,15 +1103,13 @@ end it 'creates the child tubes' do - expect_api_v2_posts( - 'CustomMetadatumCollection', - [tube_1_create_args, tube_2_create_args, tube_3_create_args, tube_4_create_args, tube_5_create_args] - ) + # Contingency tubes creation + expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) + expect_custom_metadatum_collection_posts({ 'TR00000002' => contingency_tubes }) expect(subject.valid?).to be_truthy expect(subject.save).to be_truthy expect(stub_contingency_file_upload).to have_been_made.once - expect(stub_contingency_tube_creation_request).to have_been_made.once expect(stub_transfer_creation_request).to have_been_made.once end end From 9ebf0823a185b37be58def6aaaed80fe4b356632 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 13:34:33 +0100 Subject: [PATCH 014/141] Remove unneeded fixtures for child tubes --- .../plate_split_to_tube_racks_spec.rb | 245 +----------------- 1 file changed, 10 insertions(+), 235 deletions(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 040feb362..6fd9a237b 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -116,77 +116,6 @@ { user_uuid: user_uuid, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: parent_uuid } end - # child tubes for lookup after creation - let(:child_tube_1_uuid) { SecureRandom.uuid } - let(:child_tube_1_aliquot) { create(:v2_aliquot, sample: sample1) } - let(:child_tube_1_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_sequencing_tube_purpose_name, - aliquots: [child_tube_1_aliquot], - barcode_prefix: 'FX', - barcode_number: 1, - uuid: child_tube_1_uuid - ) - end - - let(:child_tube_2_uuid) { SecureRandom.uuid } - let(:child_tube_2_aliquot) { create(:v2_aliquot, sample: sample2) } - let(:child_tube_2_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_sequencing_tube_purpose_name, - aliquots: [child_tube_2_aliquot], - barcode_prefix: 'FX', - barcode_number: 2, - uuid: child_tube_2_uuid - ) - end - - let(:child_tube_3_uuid) { SecureRandom.uuid } - let(:child_tube_3_aliquot) { create(:v2_aliquot, sample: sample1) } - let(:child_tube_3_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_3_aliquot], - barcode_prefix: 'FX', - barcode_number: 11, - uuid: child_tube_3_uuid - ) - end - - let(:child_tube_4_uuid) { SecureRandom.uuid } - let(:child_tube_4_aliquot) { create(:v2_aliquot, sample: sample1) } - let(:child_tube_4_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_4_aliquot], - barcode_prefix: 'FX', - barcode_number: 12, - uuid: child_tube_4_uuid - ) - end - - let(:child_tube_5_uuid) { SecureRandom.uuid } - let(:child_tube_5_aliquot) { create(:v2_aliquot, sample: sample2) } - let(:child_tube_5_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_5_aliquot], - barcode_prefix: 'FX', - barcode_number: 13, - uuid: child_tube_5_uuid - ) - end - let(:sequencing_file) do fixture_file_upload( 'spec/fixtures/files/scrna_core/scrna_core_sequencing_tube_rack_scan.csv', @@ -271,12 +200,14 @@ def expect_custom_metadatum_collection_posts(tubes_hash) stub_v2_tube(ancestor_tube_1_v2, stub_search: false) stub_v2_tube(ancestor_tube_2_v2, stub_search: false) - # child tube lookups - stub_v2_tube(child_tube_1_v2, stub_search: false) - stub_v2_tube(child_tube_2_v2, stub_search: false) - stub_v2_tube(child_tube_3_v2, stub_search: false) - stub_v2_tube(child_tube_4_v2, stub_search: false) - stub_v2_tube(child_tube_5_v2, stub_search: false) + # Block finding tubes by given barcodes. + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'on new' do @@ -423,13 +354,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) 'wells.aliquots,wells.aliquots.sample,wells.downstream_tubes,' \ 'wells.downstream_tubes.custom_metadatum_collection' ) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'when files are not present' do @@ -548,13 +472,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) 'wells.aliquots,wells.aliquots.sample,wells.downstream_tubes,' \ 'wells.downstream_tubes.custom_metadatum_collection' ) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'when files are not present' do @@ -733,13 +650,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) 'wells.downstream_tubes.custom_metadatum_collection' ) stub_api_get(parent_uuid, body: parent_v1) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'with both sequencing and contingency files' do @@ -810,29 +720,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - # need api v1 versions of child tubes - let(:child_tube_1_v1) { json :tube, uuid: child_tube_1_uuid, barcode_prefix: 'FX', barcode_number: 1 } - let(:child_tube_2_v1) { json :tube, uuid: child_tube_2_uuid, barcode_prefix: 'FX', barcode_number: 2 } - let(:child_tube_3_v1) { json :tube, uuid: child_tube_3_uuid, barcode_prefix: 'FX', barcode_number: 11 } - let(:child_tube_4_v1) { json :tube, uuid: child_tube_4_uuid, barcode_prefix: 'FX', barcode_number: 12 } - let(:child_tube_5_v1) { json :tube, uuid: child_tube_5_uuid, barcode_prefix: 'FX', barcode_number: 13 } - - # Metadata expected to be sent in POST requests - let!(:metadata_for_tube_1) { { tube_rack_barcode: 'TR00000001', tube_rack_position: 'A1' } } - let(:tube_1_create_args) { { user_id: user.id, asset_id: child_tube_1_v2.id, metadata: metadata_for_tube_1 } } - - let!(:metadata_for_tube_2) { { tube_rack_barcode: 'TR00000001', tube_rack_position: 'B1' } } - let(:tube_2_create_args) { { user_id: user.id, asset_id: child_tube_2_v2.id, metadata: metadata_for_tube_2 } } - - let!(:metadata_for_tube_3) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'A1' } } - let(:tube_3_create_args) { { user_id: user.id, asset_id: child_tube_3_v2.id, metadata: metadata_for_tube_3 } } - - let!(:metadata_for_tube_4) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'B1' } } - let(:tube_4_create_args) { { user_id: user.id, asset_id: child_tube_4_v2.id, metadata: metadata_for_tube_4 } } - - let!(:metadata_for_tube_5) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'C1' } } - let(:tube_5_create_args) { { user_id: user.id, asset_id: child_tube_5_v2.id, metadata: metadata_for_tube_5 } } - let(:contingency_file) do fixture_file_upload( 'spec/fixtures/files/scrna_core/scrna_core_contingency_tube_rack_scan_3_tubes.csv', @@ -840,15 +727,7 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - before do - stub_v2_user(user) - - stub_v2_labware(child_tube_1_v2) - stub_v2_labware(child_tube_2_v2) - stub_v2_labware(child_tube_3_v2) - stub_v2_labware(child_tube_4_v2) - stub_v2_labware(child_tube_5_v2) - end + before { stub_v2_user(user) } it 'creates the child tubes' do expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) @@ -920,18 +799,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - before do - stub_get_labware_metadata(child_tube_1_v2.barcode.machine, child_tube_1_v1) - stub_get_labware_metadata(child_tube_2_v2.barcode.machine, child_tube_2_v1) - stub_get_labware_metadata(child_tube_3_v2.barcode.machine, child_tube_3_v1) - stub_get_labware_metadata(child_tube_4_v2.barcode.machine, child_tube_4_v1) - - stub_asset_search(child_tube_1_v2.barcode.machine, child_tube_1_v1) - stub_asset_search(child_tube_2_v2.barcode.machine, child_tube_2_v1) - stub_asset_search(child_tube_3_v2.barcode.machine, child_tube_3_v1) - stub_asset_search(child_tube_4_v2.barcode.machine, child_tube_4_v1) - end - it 'does not create a tube for the failed well' do expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) @@ -968,67 +835,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) } end - # child tubes for lookup after creation - let(:child_tube_1_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_1_aliquot], - barcode_prefix: 'FX', - barcode_number: 11, - uuid: child_tube_1_uuid - ) - end - - let(:child_tube_2_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_2_aliquot], - barcode_prefix: 'FX', - barcode_number: 12, - uuid: child_tube_2_uuid - ) - end - - let(:child_tube_3_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_3_aliquot], - barcode_prefix: 'FX', - barcode_number: 13, - uuid: child_tube_3_uuid - ) - end - - let(:child_tube_4_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_4_aliquot], - barcode_prefix: 'FX', - barcode_number: 14, - uuid: child_tube_4_uuid - ) - end - - let(:child_tube_5_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_5_aliquot], - barcode_prefix: 'FX', - barcode_number: 15, - uuid: child_tube_5_uuid - ) - end - let(:contingency_tubes) do prepare_created_child_tubes( [ @@ -1069,38 +875,7 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - # need api v1 versions of child tubes - let(:child_tube_1_v1) { json :tube, uuid: child_tube_1_uuid, barcode_prefix: 'FX', barcode_number: 11 } - let(:child_tube_2_v1) { json :tube, uuid: child_tube_2_uuid, barcode_prefix: 'FX', barcode_number: 12 } - let(:child_tube_3_v1) { json :tube, uuid: child_tube_3_uuid, barcode_prefix: 'FX', barcode_number: 13 } - let(:child_tube_4_v1) { json :tube, uuid: child_tube_4_uuid, barcode_prefix: 'FX', barcode_number: 14 } - let(:child_tube_5_v1) { json :tube, uuid: child_tube_5_uuid, barcode_prefix: 'FX', barcode_number: 15 } - - # need to stub the creation of the tube metadata - let!(:metadata_for_tube_1) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'A1' } } - let(:tube_1_create_args) { { user_id: user.id, asset_id: child_tube_1_v2.id, metadata: metadata_for_tube_1 } } - - let!(:metadata_for_tube_2) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'B1' } } - let(:tube_2_create_args) { { user_id: user.id, asset_id: child_tube_2_v2.id, metadata: metadata_for_tube_2 } } - - let!(:metadata_for_tube_3) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'C1' } } - let(:tube_3_create_args) { { user_id: user.id, asset_id: child_tube_3_v2.id, metadata: metadata_for_tube_3 } } - - let!(:metadata_for_tube_4) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'E1' } } - let(:tube_4_create_args) { { user_id: user.id, asset_id: child_tube_4_v2.id, metadata: metadata_for_tube_4 } } - - let!(:metadata_for_tube_5) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'F1' } } - let(:tube_5_create_args) { { user_id: user.id, asset_id: child_tube_5_v2.id, metadata: metadata_for_tube_5 } } - - before do - stub_v2_user(user) - - stub_v2_labware(child_tube_1_v2) - stub_v2_labware(child_tube_2_v2) - stub_v2_labware(child_tube_3_v2) - stub_v2_labware(child_tube_4_v2) - stub_v2_labware(child_tube_5_v2) - end + before { stub_v2_user(user) } it 'creates the child tubes' do # Contingency tubes creation From cd8c643d9a0d64f756d8198a780b1ee9234a0731 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 13:37:04 +0100 Subject: [PATCH 015/141] Remove accidental assignment to unused variable --- spec/models/labware_creators/plate_split_to_tube_racks_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 6fd9a237b..5a0de7246 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -165,7 +165,7 @@ def expect_custom_metadatum_collection_posts(tubes_hash) expected_call_args = tubes_hash.flat_map do |tube_rack_barcode, tubes| tubes.map do |tube| - metadata = { + { user_id: user.id, asset_id: tube.id, metadata: { From 9f10f6a0e28740510cb47bcccb64df5ae5b0d17a Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 14:22:20 +0100 Subject: [PATCH 016/141] Fix tests for pooled tubes by submission --- .../pooled_tubes_by_submission_spec.rb | 103 ++++++++---------- 1 file changed, 43 insertions(+), 60 deletions(-) diff --git a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb index f358503a5..cb8033efe 100644 --- a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb @@ -11,6 +11,8 @@ RSpec.describe LabwareCreators::PooledTubesBySubmission do include FeatureHelpers + has_a_working_api + it_behaves_like 'it only allows creation from charged and passed plates with defined downstream pools' subject { LabwareCreators::PooledTubesBySubmission.new(api, form_attributes) } @@ -31,10 +33,25 @@ before { stub_v2_plate(source_plate, stub_search: false) } context '#save!' do - has_a_working_api - - let(:child_1_name) { 'DN5 A1:C1' } - let(:child_2_name) { 'DN5 D1:A2' } + def expect_specific_tube_creation(child_tubes) + # Create a mock for the specific tube creation. + specific_tube_creation = double + allow(specific_tube_creation).to receive(:children).and_return(child_tubes) + + # Expect the post request and return the mock. + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [purpose_uuid] * child_tubes.size, + parent_uuids: [parent_uuid], + tube_attributes: child_tubes.map { |tube| { name: tube.name } }, + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) + end # Used to fetch the pools. This is the kind of thing we could pass through from a custom form let!(:parent_request) do @@ -42,40 +59,20 @@ stub_api_get(parent_uuid, 'wells', body: wells_json) end - let(:creation_payload) do - { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid, purpose_uuid], - tube_attributes: [{ name: child_1_name }, { name: child_2_name }] - } - end + let(:child_1_name) { 'DN5 A1:C1' } + let(:child_2_name) { 'DN5 D1:A2' } - let(:tube_creation_request_uuid) { SecureRandom.uuid } + let(:tube_attributes) { [{ name: child_1_name }, { name: child_2_name }] } - let!(:tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: creation_payload - }, - body: - json( - :specific_tube_creation, - uuid: tube_creation_request_uuid, - children_count: 2, - names: [child_1_name, child_2_name] - ) - ) - end + let(:child_tubes) do + # Prepare child tubes and stub their lookups. + child_tubes = + tube_attributes.each_with_index.map do |attrs, index| + create(:v2_tube, name: attrs[:name], uuid: "tube-#{index}") + end + child_tubes.each { |child_tube| stub_v2_labware(child_tube) } - # Find out what tubes we've just made! - let!(:tube_creation_children_request) do - stub_api_get( - tube_creation_request_uuid, - 'children', - body: json(:tube_collection, names: [child_1_name, child_2_name]) - ) + child_tubes end let(:transfer_requests) do @@ -106,9 +103,10 @@ end context 'without parent metadata' do + before { expect_specific_tube_creation(child_tubes) } + it 'pools by submission' do expect(subject.save!).to be_truthy - expect(tube_creation_request).to have_been_made.once expect(transfer_creation_request).to have_been_made.once end @@ -133,24 +131,11 @@ for_multiplexing: true end - setup do - stub_get_labware_metadata('DN10', parent, metadata: { stock_barcode: 'DN6' }) - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: creation_payload - }, - body: - json( - :specific_tube_creation, - uuid: tube_creation_request_uuid, - children_count: 2, - names: [child_1_name, child_2_name] - ) - ) - end + setup { stub_get_labware_metadata('DN10', parent, metadata: { stock_barcode: 'DN6' }) } it 'sets the correct tube name' do + expect_specific_tube_creation(child_tubes) + expect(subject.save!).to be_truthy expect(subject.child_stock_tubes.length).to eq(2) expect(subject.child_stock_tubes).to have_key(child_1_name) @@ -172,6 +157,9 @@ { 'source_asset' => 'example-well-uuid-7', 'target_asset' => 'tube-1', 'submission' => 'pool-2-uuid' } ] end + + before { expect_specific_tube_creation(child_tubes) } + it 'pools by submission' do expect(subject.save!).to be_truthy expect(transfer_creation_request).to have_been_made.once @@ -191,14 +179,9 @@ ] end - let(:creation_payload) do - { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid], - tube_attributes: [{ name: child_1_name }] - } - end + let(:tube_attributes) { [{ name: child_1_name }] } + + before { expect_specific_tube_creation(child_tubes) } it 'pools by submission' do expect(subject.save!).to be_truthy From 8ca6cc86c93c599807c30ad669882cdde07827d8 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 14:34:43 +0100 Subject: [PATCH 017/141] Fix tests for custom_pooled_tubes --- .../custom_pooled_tubes_spec.rb | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/spec/models/labware_creators/custom_pooled_tubes_spec.rb b/spec/models/labware_creators/custom_pooled_tubes_spec.rb index c9ed9f2e9..489727e2f 100644 --- a/spec/models/labware_creators/custom_pooled_tubes_spec.rb +++ b/spec/models/labware_creators/custom_pooled_tubes_spec.rb @@ -73,29 +73,28 @@ ) end - let(:tube_creation_request_uuid) { SecureRandom.uuid } - - let(:tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid, purpose_uuid], - tube_attributes: [{ name: 'DN5 A1:B2' }, { name: 'DN5 C1:G2' }] + def expect_specific_tube_creation + child_tubes = [ + create(:v2_tube, name: 'DN5 A1:B2', uuid: 'tube-0'), + create(:v2_tube, name: 'DN5 C1:G2', uuid: 'tube-1') + ] + + # Create a mock for the specific tube creation. + specific_tube_creation = double + allow(specific_tube_creation).to receive(:children).and_return(child_tubes) + + # Expect the post request and return the mock. + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [purpose_uuid, purpose_uuid], + parent_uuids: [parent_uuid], + tube_attributes: child_tubes.map { |tube| { name: tube.name } }, + user_uuid: user_uuid } - }, - body: json(:specific_tube_creation, uuid: tube_creation_request_uuid, children_count: 2) - ) - end - - # Find out what tubes we've just made! - let(:tube_creation_children_request) do - stub_api_get( - tube_creation_request_uuid, - 'children', - body: json(:tube_collection, names: ['DN5 A1:B2', 'DN5 C1:G2']) + ], + [specific_tube_creation] ) end @@ -138,8 +137,6 @@ before do stub_parent_request stub_qc_file_creation - tube_creation_children_request - tube_creation_request transfer_creation_request end @@ -149,9 +146,10 @@ end it 'pools according to the file' do + expect_specific_tube_creation + expect(subject.save).to be_truthy expect(stub_qc_file_creation).to have_been_made.once - expect(tube_creation_request).to have_been_made.once expect(transfer_creation_request).to have_been_made.once end end From 44258c2608e37e5e08deb6f8c660a0775fa039a6 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 15:16:55 +0100 Subject: [PATCH 018/141] build: add action to create a release PR automatically --- .github/workflows/create_release_pr.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/create_release_pr.yml diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml new file mode 100644 index 000000000..cce061ba2 --- /dev/null +++ b/.github/workflows/create_release_pr.yml @@ -0,0 +1,20 @@ +name: Create merge to master pull request for production releases +on: + push: + branches: + - develop +jobs: + productionPromotion: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: master + - name: Reset master branch + run: | + git fetch origin develop:develop + git reset --hard develop + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + branch: master From 35663153abefd5129f4777beac769c18f80af7d0 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 15:25:33 +0100 Subject: [PATCH 019/141] build: add test title and body to PR --- .github/workflows/create_release_pr.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index cce061ba2..8dda5b703 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -14,7 +14,15 @@ jobs: run: | git fetch origin develop:develop git reset --hard develop + - name: Set output variables + id: vars + run: | + pr_body="This PR was auto-generated on $(date +%d-%m-%Y) \ + by [create-pull-request](https://github.com/peter-evans/create-pull-request)." + echo "pr_body=$pr_body" >> $GITHUB_OUTPUT - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: branch: master + title: Merge Develop into Master + body: ${{ steps.vars.outputs.pr_body }} From b7082c6f76c6f87c948a0a7cee520eeecce246ec Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 15:27:36 +0100 Subject: [PATCH 020/141] build: enable manual triggering --- .github/workflows/create_release_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 8dda5b703..b8424c842 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -1,5 +1,6 @@ name: Create merge to master pull request for production releases on: + workflow_dispatch: push: branches: - develop From 82a945c498ffdce1eb4367fe5dc69da5c0e04d64 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 15:50:40 +0100 Subject: [PATCH 021/141] build: use github CLI for PR creation --- .github/workflows/create_release_pr.yml | 33 +++++++++---------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index b8424c842..1f0645a5a 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -1,29 +1,20 @@ -name: Create merge to master pull request for production releases +name: Create/Update merge to master pull request for production releases + on: - workflow_dispatch: push: branches: - develop + - sh51/create-release-apr-action jobs: - productionPromotion: + create_update_pull_request: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - ref: master - - name: Reset master branch + - uses: actions/checkout@v3 + - name: Create pull request run: | - git fetch origin develop:develop - git reset --hard develop - - name: Set output variables - id: vars - run: | - pr_body="This PR was auto-generated on $(date +%d-%m-%Y) \ - by [create-pull-request](https://github.com/peter-evans/create-pull-request)." - echo "pr_body=$pr_body" >> $GITHUB_OUTPUT - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - branch: master - title: Merge Develop into Master - body: ${{ steps.vars.outputs.pr_body }} + gh_pr_up() { gh pr create $* || gh pr edit $* } + gh_pr_up \ + --base master \ + --head develop \ + --title "Merge Develop into Master" \ + --fill # Fill in the body with the commit messages From 2f0b86452739003e14fd6ee2202c52116eae3708 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 15:56:20 +0100 Subject: [PATCH 022/141] trigger From c3fbae414e1c3b1cfb08d2d140a9a4aee2d2db5c Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 15:58:21 +0100 Subject: [PATCH 023/141] build: repair typo in branch name --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 1f0645a5a..c8efe405d 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -4,7 +4,7 @@ on: push: branches: - develop - - sh51/create-release-apr-action + - sh51/create-release-pr-action jobs: create_update_pull_request: runs-on: ubuntu-latest From a1231b8d4f86000fef7dfa2e4dbd835f20913fec Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 16:00:10 +0100 Subject: [PATCH 024/141] build: move potentially-breaking comment --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index c8efe405d..cf7cccc34 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -17,4 +17,4 @@ jobs: --base master \ --head develop \ --title "Merge Develop into Master" \ - --fill # Fill in the body with the commit messages + --fill From 3fc34734420af3bfe90915eb4011f0561cad6c7b Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 16:03:32 +0100 Subject: [PATCH 025/141] build: try arguments on single line --- .github/workflows/create_release_pr.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index cf7cccc34..dea09dfd8 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -13,8 +13,4 @@ jobs: - name: Create pull request run: | gh_pr_up() { gh pr create $* || gh pr edit $* } - gh_pr_up \ - --base master \ - --head develop \ - --title "Merge Develop into Master" \ - --fill + gh_pr_up --base master --head develop --title "Merge Develop into Master" --fill From cfa289a795d0ae5a302e21a2a8827b0c21c6c779 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 16:09:05 +0100 Subject: [PATCH 026/141] build: tweak based on https://github.com/MikaelElkiaer/flux-twr/blob/main/.github/workflows/auto-pr.yaml --- .github/workflows/create_release_pr.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index dea09dfd8..89722fcb9 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -1,16 +1,18 @@ -name: Create/Update merge to master pull request for production releases - +# Create or update merge-to-master pull requests for production releases +name: Release on: push: branches: - develop - sh51/create-release-pr-action jobs: - create_update_pull_request: + pull_request: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Create pull request + - name: Create or update PR + env: + GH_TOKEN: ${{ github.token }} run: | - gh_pr_up() { gh pr create $* || gh pr edit $* } + gh_pr_up() { IFS=$'\n'; gh pr create $* || gh pr edit $*; } gh_pr_up --base master --head develop --title "Merge Develop into Master" --fill From b6ca132b3cc53f6cee46f19607da1921b7e78552 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 17 Sep 2024 16:15:53 +0100 Subject: [PATCH 027/141] build: try replacing fill with variable content --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 89722fcb9..221bf56a4 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -15,4 +15,4 @@ jobs: GH_TOKEN: ${{ github.token }} run: | gh_pr_up() { IFS=$'\n'; gh pr create $* || gh pr edit $*; } - gh_pr_up --base master --head develop --title "Merge Develop into Master" --fill + gh_pr_up --base master --head develop --title "Merge Develop into Master" --body "This PR was auto-generated on $(date +%d-%m-%Y)" From 3d096e488460e4814521d907b16f227b0a6eadef Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 16:42:22 +0100 Subject: [PATCH 028/141] Change parents relationship to Labware instead of Asset --- .../sequencescape/api/v2/specific_tube_creation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb index 035a70c5a..4b3235552 100644 --- a/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb +++ b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb @@ -3,6 +3,6 @@ # Represents a specific tube creation in Limber via the Sequencescape API class Sequencescape::Api::V2::SpecificTubeCreation < Sequencescape::Api::V2::Base has_many :children, class_name: 'Sequencescape::Api::V2::Tube' - has_many :parents, class_name: 'Sequencescape::Api::V2::Asset' + has_many :parents, class_name: 'Sequencescape::Api::V2::Labware' has_one :user, class_name: 'Sequencescape::Api::V2::User' end From 0c6eea266df4824840bfb52522851824ecfef7d7 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 16:12:54 +0100 Subject: [PATCH 029/141] trigger: From bfd5622bc7f0025325f9d818d4423ca845743225 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 16:48:21 +0100 Subject: [PATCH 030/141] build: try include PR numbers in the body --- .github/workflows/create_release_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 221bf56a4..4a3735010 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -15,4 +15,5 @@ jobs: GH_TOKEN: ${{ github.token }} run: | gh_pr_up() { IFS=$'\n'; gh pr create $* || gh pr edit $*; } - gh_pr_up --base master --head develop --title "Merge Develop into Master" --body "This PR was auto-generated on $(date +%d-%m-%Y)" + PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') + gh_pr_up --base master --head develop --title "Merge Develop into Master" --body "Merges in:\n$(echo "$PR_NUMBERS" | sed 's/^/- /')\n\nThis PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S)" From 928160c1d864f7e99a7ba455d87589b9acd963ef Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 16:52:22 +0100 Subject: [PATCH 031/141] build: repair issue with nested quotes? --- .github/workflows/create_release_pr.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 4a3735010..dc018d7ef 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -14,6 +14,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh_pr_up() { IFS=$'\n'; gh pr create $* || gh pr edit $*; } - PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') - gh_pr_up --base master --head develop --title "Merge Develop into Master" --body "Merges in:\n$(echo "$PR_NUMBERS" | sed 's/^/- /')\n\nThis PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S)" + gh_pr_up() { IFS=$'\n'; gh pr create "$@" || gh pr edit "$@"; } + PR_NUMBERS=$(gh api repos/${{ github.repository }}/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') + PR_BODY="Merges in:\n$(echo "$PR_NUMBERS" | sed 's/^/- /')\n\nThis PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S)" + gh_pr_up --base master --head develop --title "Merge Develop into Master" --body "$PR_BODY" From d1679d9bf3678b1115149197c7bca810590f1216 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 16:57:41 +0100 Subject: [PATCH 032/141] build: edit existing PR --- .github/workflows/create_release_pr.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index dc018d7ef..0f05129f0 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -14,7 +14,14 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh_pr_up() { IFS=$'\n'; gh pr create "$@" || gh pr edit "$@"; } PR_NUMBERS=$(gh api repos/${{ github.repository }}/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') - PR_BODY="Merges in:\n$(echo "$PR_NUMBERS" | sed 's/^/- /')\n\nThis PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S)" - gh_pr_up --base master --head develop --title "Merge Develop into Master" --body "$PR_BODY" + PR_BODY="Merges in:\n$(echo "$PR_NUMBERS" | sed 's/^/- /')\n\nThis PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S) and will be overwritten on the next push to develop." + + # Check if a PR already exists + EXISTING_PR=$(gh pr list --base master --head develop --json number --jq '.[0].number') + + if [ -z "$EXISTING_PR" ]; then + gh pr create --base master --head develop --title "Merge Develop into Master" --body "$PR_BODY" + else + gh pr edit "$EXISTING_PR" --body "$PR_BODY" + fi From f90ad9202f605b517f0e6d9518106c8cb4095b92 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 17:04:30 +0100 Subject: [PATCH 033/141] build: try add line-breaks? --- .github/workflows/create_release_pr.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 0f05129f0..1a60c61e8 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -15,7 +15,12 @@ jobs: GH_TOKEN: ${{ github.token }} run: | PR_NUMBERS=$(gh api repos/${{ github.repository }}/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') - PR_BODY="Merges in:\n$(echo "$PR_NUMBERS" | sed 's/^/- /')\n\nThis PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S) and will be overwritten on the next push to develop." + PR_BODY="Merges in: + + $(echo "$PR_NUMBERS" | sed 's/^/- /') + + This PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S) + Changes will be overwritten on next push" # Check if a PR already exists EXISTING_PR=$(gh pr list --base master --head develop --json number --jq '.[0].number') From b1bdcfe222c8190a555b198c6a423b35dbcd9838 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 17:06:54 +0100 Subject: [PATCH 034/141] build: reorder footer text --- .github/workflows/create_release_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 1a60c61e8..03b824c52 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -19,8 +19,8 @@ jobs: $(echo "$PR_NUMBERS" | sed 's/^/- /') - This PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S) - Changes will be overwritten on next push" + This description will be overwritten on the next push + This PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S)" # Check if a PR already exists EXISTING_PR=$(gh pr list --base master --head develop --json number --jq '.[0].number') From 345b235259f8379bc8604fff084383b6499e9999 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 17:11:21 +0100 Subject: [PATCH 035/141] build: add reviewer instructions --- .github/workflows/create_release_pr.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 03b824c52..9a23516dd 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -15,10 +15,17 @@ jobs: GH_TOKEN: ${{ github.token }} run: | PR_NUMBERS=$(gh api repos/${{ github.repository }}/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') - PR_BODY="Merges in: + PR_BODY="#### Changes proposed in this pull request $(echo "$PR_NUMBERS" | sed 's/^/- /') + #### Instructions for Reviewers + +     \- _Check stories are ready for release_ +     \- _Check for any database migrations_ +     \- _Check for debug code_ +     \- _Check version is appropiate_ + This description will be overwritten on the next push This PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S)" From 5f20da9399abdc45e9e8511d027892bb1d0aa69c Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 18 Sep 2024 17:15:23 +0100 Subject: [PATCH 036/141] build: change auto-generated date to iso-standard --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 9a23516dd..a72da4f08 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -27,7 +27,7 @@ jobs:     \- _Check version is appropiate_ This description will be overwritten on the next push - This PR was auto-generated on $(date +%d-%m-%Y) at $(date +%H:%M:%S)" + This PR was auto-generated on $(TZ=Europe/London date --iso-8601=seconds)" # Check if a PR already exists EXISTING_PR=$(gh pr list --base master --head develop --json number --jq '.[0].number') From 24169bec61a595842c56184156734269781d1137 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 09:13:09 +0100 Subject: [PATCH 037/141] build: add comment about event handling --- .github/workflows/create_release_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index a72da4f08..e81394290 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -1,4 +1,5 @@ # Create or update merge-to-master pull requests for production releases +# Note that by design, creating or editing a PR will not trigger a downstream `pull_request` event as this could lead to recursion name: Release on: push: From 51e4b7ceb56f1c90587a33bd20f24c3980dffe83 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 09:37:07 +0100 Subject: [PATCH 038/141] build: add 'Automated' text to generated PR title --- .github/workflows/create_release_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index e81394290..c3210d339 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -15,6 +15,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + PR_TITLE="[Automated] Merge Develop into Master" PR_NUMBERS=$(gh api repos/${{ github.repository }}/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') PR_BODY="#### Changes proposed in this pull request @@ -34,7 +35,7 @@ jobs: EXISTING_PR=$(gh pr list --base master --head develop --json number --jq '.[0].number') if [ -z "$EXISTING_PR" ]; then - gh pr create --base master --head develop --title "Merge Develop into Master" --body "$PR_BODY" + gh pr create --base master --head develop --title "$PR_TITLE" --body "$PR_BODY" else gh pr edit "$EXISTING_PR" --body "$PR_BODY" fi From 97f2f5a4d46fd3143008612d54666959553a1f58 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 12:07:07 +0100 Subject: [PATCH 039/141] build: give automated a small A for consistency with other PRs --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index c3210d339..9277ac968 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -15,7 +15,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - PR_TITLE="[Automated] Merge Develop into Master" + PR_TITLE="[automated] Merge Develop into Master" PR_NUMBERS=$(gh api repos/${{ github.repository }}/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') PR_BODY="#### Changes proposed in this pull request From af7969653f36b80acae10a36dadb0d151772c6cb Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 12:13:48 +0100 Subject: [PATCH 040/141] build: revert co-pilot suggestion of variable to simple reference --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 9277ac968..6518273ac 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -16,7 +16,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | PR_TITLE="[automated] Merge Develop into Master" - PR_NUMBERS=$(gh api repos/${{ github.repository }}/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') + PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') PR_BODY="#### Changes proposed in this pull request $(echo "$PR_NUMBERS" | sed 's/^/- /') From 39fd90191944774848bef8377f6cc7c47c5c3443 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 13:22:22 +0100 Subject: [PATCH 041/141] build: add links to original issues where available --- .github/workflows/create_release_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 6518273ac..7e1cc6082 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -17,9 +17,10 @@ jobs: run: | PR_TITLE="[automated] Merge Develop into Master" PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') + STORIES=$(echo $PR_NUMBERS | xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with {}" else "PR " + "{}" end') PR_BODY="#### Changes proposed in this pull request - $(echo "$PR_NUMBERS" | sed 's/^/- /') + $(echo "$STORIES" | sed 's/^/- /') #### Instructions for Reviewers From f7e52c4544f0b756c0318936d64516627cd11c10 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 13:26:32 +0100 Subject: [PATCH 042/141] build: split PR_NUMBERS on any whitespace, not just newlines --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 7e1cc6082..2d4adf777 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -17,7 +17,7 @@ jobs: run: | PR_TITLE="[automated] Merge Develop into Master" PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') - STORIES=$(echo $PR_NUMBERS | xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with {}" else "PR " + "{}" end') + STORIES=$(echo $PR_NUMBERS | xargs -d ' ' -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with {}" else "PR " + "{}" end') PR_BODY="#### Changes proposed in this pull request $(echo "$STORIES" | sed 's/^/- /') From 69799ac45969596bfe777b674f86af5a58b16944 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 13:32:06 +0100 Subject: [PATCH 043/141] build: remove hash prefix to PR_NUMBERS --- .github/workflows/create_release_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 2d4adf777..9c7865304 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -16,8 +16,8 @@ jobs: GH_TOKEN: ${{ github.token }} run: | PR_TITLE="[automated] Merge Develop into Master" - PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | "#\(.pr_number)"') - STORIES=$(echo $PR_NUMBERS | xargs -d ' ' -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with {}" else "PR " + "{}" end') + PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | .pr_number') + STORIES=$(echo $PR_NUMBERS | xargs -d ' ' -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with #{}" else "PR #{}" end') PR_BODY="#### Changes proposed in this pull request $(echo "$STORIES" | sed 's/^/- /') From 7c52a6cd117bbde3725e18c08d0a2337ebb44505 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 13:43:06 +0100 Subject: [PATCH 044/141] build: use a here-string to pipe PR_NUMBERS without adding newlines --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 9c7865304..a859d1ac6 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -17,7 +17,7 @@ jobs: run: | PR_TITLE="[automated] Merge Develop into Master" PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | .pr_number') - STORIES=$(echo $PR_NUMBERS | xargs -d ' ' -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with #{}" else "PR #{}" end') + STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with #{}" else "PR #{}" end' <<< "$PR_NUMBERS") PR_BODY="#### Changes proposed in this pull request $(echo "$STORIES" | sed 's/^/- /') From 44aeae94e78242d94362a577a9d47cf5b333ef31 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 13:51:56 +0100 Subject: [PATCH 045/141] build: explicitly add list-items and newlines --- .github/workflows/create_release_pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index a859d1ac6..4501dc800 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -17,10 +17,11 @@ jobs: run: | PR_TITLE="[automated] Merge Develop into Master" PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | .pr_number') - STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "Closes #" + .issue_number + " with #{}" else "PR #{}" end' <<< "$PR_NUMBERS") + STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "- Closes #" + .issue_number + " + - #{}" else "- #{}" end' <<< "$PR_NUMBERS") PR_BODY="#### Changes proposed in this pull request - $(echo "$STORIES" | sed 's/^/- /') + $(echo "$STORIES") #### Instructions for Reviewers From 37d0d0f0e6d35d28a3e082d8b9d36f82a08437c9 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 19 Sep 2024 14:03:55 +0100 Subject: [PATCH 046/141] build: swap the PR and the Issues --- .github/workflows/create_release_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 4501dc800..602ea62f9 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -17,8 +17,8 @@ jobs: run: | PR_TITLE="[automated] Merge Develop into Master" PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | .pr_number') - STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "- Closes #" + .issue_number + " - - #{}" else "- #{}" end' <<< "$PR_NUMBERS") + STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "- #{} + - Closes #" + .issue_number else "- #{}" end' <<< "$PR_NUMBERS") PR_BODY="#### Changes proposed in this pull request $(echo "$STORIES") From 9951d1d6b6741fba5a0b9f83a4d26d1cc44e2bcc Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:25:28 +0000 Subject: [PATCH 047/141] Update Ruby to version 3.2.5 --- .ruby-version | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index 818bd47ab..5ae69bd5f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.0.6 +3.2.5 diff --git a/Dockerfile b/Dockerfile index d7a584cc2..9e4720c98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.0.6-slim +FROM ruby:3.2.5-slim ARG bundlerWithout="development test lint" ARG yarnFlags="--production" From 5829cd100fa5c001bb576c24b2da5f50f2f527fa Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 19 Sep 2024 17:53:28 +0100 Subject: [PATCH 048/141] Add Limber model for PooledPlateCreation API v2 endpoint --- .../sequencescape/api/v2/pooled_plate_creation.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb diff --git a/app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb b/app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb new file mode 100644 index 000000000..ef2d1d631 --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Represents a pooled plate creation in Limber via the Sequencescape API +class Sequencescape::Api::V2::PooledPlateCreation < Sequencescape::Api::V2::Base + has_one :child, class_name: 'Sequencescape::Api::V2::Plate' + has_many :parents, class_name: 'Sequencescape::Api::V2::Labware' + has_one :user, class_name: 'Sequencescape::Api::V2::User' +end From f90e4472d1e14e9fdc5cf2de6e9d586a4d6b65fd Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 19 Sep 2024 18:40:03 +0100 Subject: [PATCH 049/141] Migrate usage of PooledPlateCreation from API v1 to v2 --- .../labware_creators/custom_tagged_plate.rb | 9 ++++----- app/models/labware_creators/merged_plate.rb | 8 ++++---- app/models/labware_creators/multi_plate_pool.rb | 11 +++++++---- app/models/labware_creators/multi_stamp.rb | 11 +++++++---- app/models/labware_creators/multi_stamp_tubes.rb | 16 +++++++++------- .../multi_stamp_tubes_using_tube_rack_scan.rb | 16 +++++++++------- 6 files changed, 40 insertions(+), 31 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 31a85dd98..f08960bda 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -47,12 +47,11 @@ def initialize(*args, &block) def create_plate! # rubocop:todo Metrics/AbcSize @child = - api - .pooled_plate_creation + Sequencescape::Api::V2::PooledPlateCreation .create!( - child_purpose: purpose_uuid, - user: user_uuid, - parents: [parent_uuid, tag_plate.asset_uuid].compact_blank + child_purpose_uuid: purpose_uuid, + parent_uuids: [parent_uuid, tag_plate.asset_uuid].compact_blank, + user_uuid: user_uuid ) .child diff --git a/app/models/labware_creators/merged_plate.rb b/app/models/labware_creators/merged_plate.rb index d6bd17bfb..8f1be6c3f 100644 --- a/app/models/labware_creators/merged_plate.rb +++ b/app/models/labware_creators/merged_plate.rb @@ -51,10 +51,10 @@ def barcodes=(barcodes) private def create_plate_from_parent! - api.pooled_plate_creation.create!( - child_purpose: purpose_uuid, - user: user_uuid, - parents: source_plates.map(&:uuid) + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: source_plates.map(&:uuid), + user_uuid: user_uuid ) end diff --git a/app/models/labware_creators/multi_plate_pool.rb b/app/models/labware_creators/multi_plate_pool.rb index 6beeaacc5..b6307285a 100644 --- a/app/models/labware_creators/multi_plate_pool.rb +++ b/app/models/labware_creators/multi_plate_pool.rb @@ -17,10 +17,13 @@ class MultiPlatePool < Base private def create_labware! - plate_creation = - api.pooled_plate_creation.create!(parents: transfers.keys, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: transfers.keys, + user_uuid: user_uuid + ) + .child api.bulk_transfer.create!(user: user_uuid, well_transfers: well_transfers) diff --git a/app/models/labware_creators/multi_stamp.rb b/app/models/labware_creators/multi_stamp.rb index 6cb8a9810..88b93623a 100644 --- a/app/models/labware_creators/multi_stamp.rb +++ b/app/models/labware_creators/multi_stamp.rb @@ -30,10 +30,13 @@ class MultiStamp < Base # rubocop:todo Style/Documentation private def create_labware! - plate_creation = - api.pooled_plate_creation.create!(parents: parent_uuids, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: parent_uuids, + user_uuid: user_uuid + ) + .child transfer_material_from_parent!(@child.uuid) diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index aa3b153d0..91bfcc6be 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -41,13 +41,15 @@ def create_labware! create_and_build_submission return if errors.size.positive? - plate_creation = - api.pooled_plate_creation.create!(parents: parent_uuids, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child - child_v2 = Sequencescape::Api::V2.plate_with_wells(@child.uuid) - - transfer_material_from_parent!(child_v2) + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: parent_uuids, + user_uuid: user_uuid + ) + .child + + transfer_material_from_parent!(@child.uuid) yield(@child) if block_given? true diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index d1aab1bd2..47feae545 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -65,13 +65,15 @@ def save # # @return [Boolean] true if the child plate was created successfully. def create_labware! - plate_creation = - api.pooled_plate_creation.create!(parents: parent_tube_uuids, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child - child_v2 = Sequencescape::Api::V2.plate_with_wells(@child.uuid) - - transfer_material_from_parent!(child_v2) + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: parent_tube_uuids, + user_uuid: user_uuid + ) + .child + + transfer_material_from_parent!(@child.uuid) yield(@child) if block_given? true From d2166fd940e2ed46fc8f26c4cf10e89d2bc28fd2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 09:26:39 +0100 Subject: [PATCH 050/141] build: extend PR_NUMBERS over multiple lines for readbility --- .github/workflows/create_release_pr.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 602ea62f9..57cb0b906 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -16,7 +16,14 @@ jobs: GH_TOKEN: ${{ github.token }} run: | PR_TITLE="[automated] Merge Develop into Master" - PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '.commits[] | select(.commit.message | startswith("Merge pull request")) | .commit.message | capture("#(?\\d+)") | .pr_number') + PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq ' + .commits[] + | select(.commit.message + | startswith("Merge pull request")) + | .commit.message + | capture("#(?\\d+)") + | .pr_number' + ) STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "- #{} - Closes #" + .issue_number else "- #{}" end' <<< "$PR_NUMBERS") PR_BODY="#### Changes proposed in this pull request From e53446999dd60315ee1015e419df7c646605cd34 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 09:34:44 +0100 Subject: [PATCH 051/141] build: try sort PR numbers by title --- .github/workflows/create_release_pr.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 57cb0b906..eeb34881d 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -16,6 +16,8 @@ jobs: GH_TOKEN: ${{ github.token }} run: | PR_TITLE="[automated] Merge Develop into Master" + + # Extract numbers from PRs that have been merged into develop PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq ' .commits[] | select(.commit.message @@ -24,8 +26,18 @@ jobs: | capture("#(?\\d+)") | .pr_number' ) + + # Fetch titles for each PR number + PR_NUMBERS_AND_TITLES=$(for PR_NUMBER in $PR_NUMBERS; do + gh pr view $PR_NUMBER --json number,title --jq '{number: .number, title: .title}' + done | jq -s 'sort_by(.title)') + + # Sort extracted PR numbers by title + SORTED_PR_NUMBERS=$(echo "$PR_DETAILS" | jq -r '.[].number') + STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "- #{} - - Closes #" + .issue_number else "- #{}" end' <<< "$PR_NUMBERS") + - Closes #" + .issue_number else "- #{}" end' <<< "$SORTED_PR_NUMBERS") # Note the line-break on this line is for formatting + PR_BODY="#### Changes proposed in this pull request $(echo "$STORIES") From 7312181c83769380f77628fe8123e49d67bf432c Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 09:39:37 +0100 Subject: [PATCH 052/141] build: repair incorrect variable bug --- .github/workflows/create_release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index eeb34881d..0d2545dbd 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -33,7 +33,7 @@ jobs: done | jq -s 'sort_by(.title)') # Sort extracted PR numbers by title - SORTED_PR_NUMBERS=$(echo "$PR_DETAILS" | jq -r '.[].number') + SORTED_PR_NUMBERS=$(jq -r '.[].number' <<< "$PR_NUMBERS_AND_TITLES") STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?\\d+)") | "- #{} - Closes #" + .issue_number else "- #{}" end' <<< "$SORTED_PR_NUMBERS") # Note the line-break on this line is for formatting From 362958caf8156be01a1991850029b8b1e4fb608b Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 10:21:19 +0100 Subject: [PATCH 053/141] style: rubocop --- .../sequencescape_submission_behaviour.rb | 2 +- .../concerns/work_completion_behaviour.rb | 2 +- app/controllers/labware_controller.rb | 4 +- .../pipeline_work_in_progress_controller.rb | 2 +- app/controllers/qc_files_controller.rb | 2 +- app/controllers/robots_controller.rb | 2 +- app/controllers/search_controller.rb | 2 +- app/helpers/application_helper.rb | 4 +- app/helpers/barcode_labels_helper.rb | 4 +- app/helpers/labware_helper.rb | 4 +- app/helpers/page_helper.rb | 20 ++--- app/helpers/plate_helper.rb | 2 +- .../tagged_plate_behaviour.rb | 2 +- .../concerns/presenters/creation_behaviour.rb | 2 +- .../concerns/presenters/extended_csv.rb | 16 ++-- .../state_does_not_allow_child_creation.rb | 2 +- app/models/labels/tube_label.rb | 4 +- .../labels/tube_label_traction_compatible.rb | 4 +- app/models/labware_creators/base.rb | 6 +- .../labware_creators/custom_tagged_plate.rb | 2 +- app/models/labware_creators/final_tube.rb | 4 +- .../labware_creators/final_tube_from_plate.rb | 2 +- .../labware_creators/multi_plate_pool.rb | 2 +- .../labware_creators/multi_stamp_tubes.rb | 4 +- .../plate_split_to_tube_racks.rb | 8 +- .../labware_creators/pooled_tubes_base.rb | 2 +- .../pooled_tubes_by_sample.rb | 4 +- .../pooled_tubes_by_submission_with_phi_x.rb | 4 +- .../labware_creators/quadrant_split_plate.rb | 2 +- .../labware_creators/quadrant_stamp_base.rb | 4 +- app/models/labware_creators/tagged_plate.rb | 2 +- app/models/labware_metadata.rb | 2 +- app/models/limber/qc_file.rb | 2 +- app/models/ongoing_plate.rb | 2 +- app/models/ongoing_tube.rb | 2 +- app/models/presenters/plate_presenter.rb | 2 +- app/models/print_job.rb | 2 +- .../robots/bed/plate_to_tube_racks_bed.rb | 2 +- app/models/sequencescape_submission.rb | 4 +- app/models/state_changers.rb | 6 +- .../pcr_cycles_csv_file_upload_config_base.rb | 4 +- app/sequencescape/sequencescape/api/v2.rb | 8 +- .../api/v2/shared/has_requests.rb | 2 +- lib/purpose_config.rb | 6 +- lib/robot_configuration.rb | 30 +++---- lib/well_helpers.rb | 10 +-- spec/controllers/exports_controller_spec.rb | 2 +- ...peline_work_in_progress_controller_spec.rb | 2 +- .../work_completions_controller_spec.rb | 2 +- spec/controllers/plates_controller_spec.rb | 6 +- .../controllers/print_jobs_controller_spec.rb | 2 +- spec/controllers/qc_files_controller_spec.rb | 2 +- spec/controllers/searches_controller_spec.rb | 6 +- ...quencescape_submissions_controller_spec.rb | 6 +- .../tube_creation_controller_spec.rb | 8 +- .../tubes/work_completions_controller_spec.rb | 2 +- spec/controllers/tubes_controller_spec.rb | 4 +- spec/factories/labware_factories.rb | 2 +- spec/factories/plate_factories.rb | 16 ++-- spec/factories/purpose_config_factories.rb | 10 +-- .../tag_layout_template_factories.rb | 2 +- spec/factories/transfer_factories.rb | 4 +- spec/factories/tube_factories.rb | 16 ++-- spec/factories/tube_rack_factories.rb | 2 +- spec/factories/well_factories.rb | 12 +-- spec/factory_outputs/plate_factory_spec.rb | 4 +- spec/factory_outputs/well_factory_spec.rb | 6 +- .../features/cancelling_a_whole_plate_spec.rb | 4 +- .../charge_and_pass_libraries_spec.rb | 8 +- spec/features/creating_a_plate_spec.rb | 10 +-- ..._quadrant_stamp_primer_panel_plate_spec.rb | 4 +- spec/features/creating_a_tag_plate_spec.rb | 12 +-- .../features/creating_plate_with_bait_spec.rb | 2 +- spec/features/failing_a_whole_plate_spec.rb | 4 +- spec/features/failing_quadrants_spec.rb | 4 +- spec/features/failing_thresholds_spec.rb | 4 +- spec/features/failing_wells_spec.rb | 4 +- spec/features/plate_transfer_spec.rb | 4 +- .../pool_tubes_at_end_of_pipeline_spec.rb | 4 +- ...ling_multiple_plates_into_one_tube_spec.rb | 4 +- ...oling_multiple_tubes_into_one_tube_spec.rb | 12 +-- spec/features/viewing_a_plate_spec.rb | 8 +- spec/helpers/barcode_labels_helper_spec.rb | 12 +-- spec/helpers/plate_helpers_spec.rb | 2 +- .../labels/plate_label_96_lysate_spec.rb | 4 +- .../labware_creators/baited_plate_spec.rb | 4 +- .../cardinal_pools_plate_spec.rb | 2 +- .../concentration_binned_plate_spec.rb | 6 +- .../concentration_normalised_plate_spec.rb | 4 +- .../custom_pooled_tubes_spec.rb | 4 +- .../custom_tagged_plate_spec.rb | 10 +-- .../labware_creators/donor_pooling_spec.rb | 4 +- .../final_tube_from_plate_spec.rb | 8 +- .../labware_creators/final_tube_spec.rb | 12 +-- .../fixed_normalised_plate_spec.rb | 6 +- .../labware_creators/merged_plate_spec.rb | 28 +++---- .../labware_creators/multi_plate_pool_spec.rb | 2 +- .../labware_creators/multi_stamp_spec.rb | 6 +- .../multi_stamp_tubes_spec.rb | 8 +- ...i_stamp_tubes_using_tube_rack_scan_spec.rb | 18 ++--- .../normalised_binned_plate_spec.rb | 6 +- ...ial_stamped_plate_without_dilution_spec.rb | 4 +- ...cycles_binned_plate_for_duplex_seq_spec.rb | 10 +-- ...cycles_binned_plate_for_t_nano_seq_spec.rb | 12 +-- .../plate_split_to_tube_racks_spec.rb | 80 +++++++++---------- .../plate_with_primer_panel_spec.rb | 4 +- .../plate_with_template_spec.rb | 6 +- .../pooled_tubes_by_submission_spec.rb | 4 +- .../pooled_tubes_from_whole_plates_spec.rb | 8 +- .../pooled_tubes_from_whole_tubes_spec.rb | 8 +- .../pooled_wells_by_sample_in_groups_spec.rb | 2 +- .../quadrant_split_plate_spec.rb | 4 +- .../quadrant_stamp_primer_panel_spec.rb | 8 +- .../labware_creators/shared_examples.rb | 4 +- ...d_plate_adding_randomised_controls_spec.rb | 12 +-- .../stamped_plate_compressed_spec.rb | 4 +- ...d_plate_reordering_columns_to_rows_spec.rb | 10 +-- .../labware_creators/stamped_plate_spec.rb | 34 ++++---- .../labware_creators/tagged_plate_spec.rb | 14 ++-- .../labware_creators/tube_from_tube_spec.rb | 8 +- .../well_filter_allowing_partials_spec.rb | 2 +- .../labware_creators/well_filter_spec.rb | 2 +- spec/models/labware_metadata_spec.rb | 8 +- spec/models/pipeline_list_spec.rb | 24 +++--- spec/models/pipeline_spec.rb | 4 +- .../banking_plate_presenter_spec.rb | 4 +- ...ncentration_binned_plate_presenter_spec.rb | 10 +-- .../donor_pooling_plate_presenter_spec.rb | 2 +- .../presenters/final_tube_presenter_spec.rb | 4 +- .../minimal_pcr_plate_presenter_spec.rb | 6 +- .../minimal_plate_presenter_spec.rb | 6 +- .../minimal_stock_plate_presenter_spec.rb | 6 +- .../normalised_binned_plate_presenter_spec.rb | 10 +-- ...e_using_request_metadata_presenter_spec.rb | 6 +- ...late_using_well_metadata_presenter_spec.rb | 6 +- .../presenters/permissive_presenter_spec.rb | 4 +- .../models/presenters/plate_presenter_spec.rb | 22 ++--- .../presenters/qc_threshold_presenter_spec.rb | 2 +- .../presenters/rvi_cnda_xp_presenter_spec.rb | 4 +- spec/models/presenters/simple_tube_spec.rb | 4 +- .../single_child_permissive_presenter_spec.rb | 4 +- .../presenters/standard_presenter_spec.rb | 8 +- .../presenters/stock_plate_presenter_spec.rb | 2 +- .../submission_plate_presenter_spec.rb | 24 +++--- .../tag_plate_384_presenter_spec.rb | 4 +- spec/models/presenters/tube_presenter_spec.rb | 12 +-- .../presenters/tube_rack_presenter_spec.rb | 10 +-- .../unknown_plate_presenter_spec.rb | 2 +- spec/models/print_job_spec.rb | 18 ++--- .../robots/plate_to_tube_racks_robot_spec.rb | 4 +- .../pooling_and_splitting_robot_spec.rb | 14 ++-- spec/models/robots/pooling_robot_spec.rb | 14 ++-- spec/models/robots/quadrant_robot_spec.rb | 18 ++--- spec/models/robots/robot_spec.rb | 8 +- spec/models/robots/splitting_robot_spec.rb | 8 +- spec/models/robots_spec.rb | 2 +- spec/models/sequencescape_submission_spec.rb | 30 +++---- spec/models/state_changers_spec.rb | 8 +- spec/models/tube_rack_walking_spec.rb | 2 +- .../utility/cell_count_spot_checking_spec.rb | 10 +-- spec/spec_helper.rb | 2 +- spec/support/api_url_helper.rb | 10 +-- spec/support/contract_helper.rb | 10 +-- spec/support/feature_helpers.rb | 10 +-- spec/support/robot_helpers.rb | 4 +- spec/support/shared_tagging_examples.rb | 2 +- spec/support/with_pmb_stubbed.rb | 4 +- .../exports/bioscan_mbrave.tsv.erb_spec.rb | 10 +-- ...bmc_bank_to_cellaca_common.csv.erb_spec.rb | 14 ++-- ...frost_pbs_to_cellaca_count.csv.erb_spec.rb | 10 +-- ..._bank_tubes_content_report.csv.erb_spec.rb | 24 +++--- 171 files changed, 617 insertions(+), 617 deletions(-) diff --git a/app/controllers/concerns/sequencescape_submission_behaviour.rb b/app/controllers/concerns/sequencescape_submission_behaviour.rb index 7c02af9bb..6a9087457 100644 --- a/app/controllers/concerns/sequencescape_submission_behaviour.rb +++ b/app/controllers/concerns/sequencescape_submission_behaviour.rb @@ -21,6 +21,6 @@ def sequencescape_submission_parameters params .require(:sequencescape_submission) .permit(:template_uuid, :labware_barcode, request_options: {}, assets: [], asset_groups: {}, extra_barcodes: []) - .merge(api: api, user: current_user_uuid) + .merge(api:, user: current_user_uuid) end end diff --git a/app/controllers/concerns/work_completion_behaviour.rb b/app/controllers/concerns/work_completion_behaviour.rb index 8f2774b9e..d45a151e6 100644 --- a/app/controllers/concerns/work_completion_behaviour.rb +++ b/app/controllers/concerns/work_completion_behaviour.rb @@ -35,6 +35,6 @@ def sequencescape_submission_parameters params .require(:sequencescape_submission) .permit(:template_uuid, request_options: {}, assets: []) - .merge(api: api, user: current_user_uuid) + .merge(api:, user: current_user_uuid) end end diff --git a/app/controllers/labware_controller.rb b/app/controllers/labware_controller.rb index baede85e0..36126b57e 100644 --- a/app/controllers/labware_controller.rb +++ b/app/controllers/labware_controller.rb @@ -35,7 +35,7 @@ def update # rubocop:todo Metrics/AbcSize notice = +"Labware: #{params[:labware_barcode]} has been changed to a state of #{params[:state].titleize}." notice << ' The customer will still be charged.' if update_params[2] - respond_to { |format| format.html { redirect_to(search_path, notice: notice) } } + respond_to { |format| format.html { redirect_to(search_path, notice:) } } rescue StateChangers::StateChangeError => e respond_to do |format| format.html { redirect_to(search_path, alert: e.message) } @@ -89,6 +89,6 @@ def state_changer_for(purpose_uuid, labware_uuid) end def presenter_for(labware) - Presenters.lookup_for(labware).new(labware: labware) + Presenters.lookup_for(labware).new(labware:) end end diff --git a/app/controllers/pipeline_work_in_progress_controller.rb b/app/controllers/pipeline_work_in_progress_controller.rb index 3bf405aa5..c7624734f 100644 --- a/app/controllers/pipeline_work_in_progress_controller.rb +++ b/app/controllers/pipeline_work_in_progress_controller.rb @@ -84,7 +84,7 @@ def mould_data_for_view(purposes, labware_records) state = decide_state(rec) next if state == 'cancelled' - output[rec.purpose.name] << { record: rec, state: state } + output[rec.purpose.name] << { record: rec, state: } end end end diff --git a/app/controllers/qc_files_controller.rb b/app/controllers/qc_files_controller.rb index 79d65f752..390820d54 100644 --- a/app/controllers/qc_files_controller.rb +++ b/app/controllers/qc_files_controller.rb @@ -17,7 +17,7 @@ def index def show response = api.qc_file.find(params[:id]).retrieve filename = /filename="([^"]*)"/.match(response['Content-Disposition'])[1] || 'unnamed_file' - send_data(response.body, filename: filename, type: 'sequencescape/qc_file') + send_data(response.body, filename:, type: 'sequencescape/qc_file') end def create diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb index 0d2733d01..8559b5d7d 100644 --- a/app/controllers/robots_controller.rb +++ b/app/controllers/robots_controller.rb @@ -92,7 +92,7 @@ def robot_params end def find_robot - @robot = Robots.find(id: params[:id], api: api, user_uuid: current_user_uuid) + @robot = Robots.find(id: params[:id], api:, user_uuid: current_user_uuid) end def stripped_beds diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 730af2e97..f2d5e3345 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -56,7 +56,7 @@ def find_labware(barcode) end def find_qcable(barcode) - api.search.find(Settings.searches['Find qcable by barcode']).first(barcode: barcode) + api.search.find(Settings.searches['Find qcable by barcode']).first(barcode:) rescue Sequencescape::Api::ResourceNotFound => e raise e, "Sorry, could not find qcable with the barcode '#{barcode}'." end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8475a0dd6..9d2c29a09 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -27,8 +27,8 @@ def environment Rails.env end - def each_robot(&block) - Robots.each_robot(&block) + def each_robot(&) + Robots.each_robot(&) end # Return a list of unique pipeline group names diff --git a/app/helpers/barcode_labels_helper.rb b/app/helpers/barcode_labels_helper.rb index 069a4851d..11e0eb850 100644 --- a/app/helpers/barcode_labels_helper.rb +++ b/app/helpers/barcode_labels_helper.rb @@ -19,8 +19,8 @@ def barcode_printing_form( ) # Is redirection_url needed? - locals = { print_job: print_job, printers: printers, labels: labels, redirection_url: redirection_url } - render(partial: 'labware/barcode_printing_form', locals: locals) + locals = { print_job:, printers:, labels:, redirection_url: } + render(partial: 'labware/barcode_printing_form', locals:) end def printers_of_type(printer_types) diff --git a/app/helpers/labware_helper.rb b/app/helpers/labware_helper.rb index faca8f25a..efa383c77 100644 --- a/app/helpers/labware_helper.rb +++ b/app/helpers/labware_helper.rb @@ -2,11 +2,11 @@ module LabwareHelper # rubocop:todo Style/Documentation def state_change_form(presenter) - render partial: 'labware/state_change', locals: { presenter: presenter } + render partial: 'labware/state_change', locals: { presenter: } end def simple_state_change_form(presenter) - render partial: 'labware/simple_state_change', locals: { presenter: presenter } + render partial: 'labware/simple_state_change', locals: { presenter: } end STANDARD_COLOURS = (1..384).map { |i| "colour-#{i}" } diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index 71678f7fa..2303d8717 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -5,15 +5,15 @@ def flash_messages render(partial: 'application/flash_messages') end - def grouping(_data_role, options = {}, &block) - tag.div(**options, &block) + def grouping(_data_role, options = {}, &) + tag.div(**options, &) end private :grouping # Renders the content in the block in the # standard page template, including heading flash and sidebar def page(id, css_class = nil, prevent_row: false, &block) - grouping(:page, id: id, class: "container-fluid #{css_class}") do + grouping(:page, id:, class: "container-fluid #{css_class}") do if prevent_row concat yield else @@ -23,17 +23,17 @@ def page(id, css_class = nil, prevent_row: false, &block) end # Main body of the page, provides information about what you HAVE - def content(&block) - grouping(:content, class: 'content-main', &block) + def content(&) + grouping(:content, class: 'content-main', &) end # Provides information about what you can DO - def sidebar(&block) - grouping(:sidebar, class: 'sidebar content-secondary', &block) + def sidebar(&) + grouping(:sidebar, class: 'sidebar content-secondary', &) end def card(title: nil, css_class: '', without_block: false, id: nil, &block) - tag.div(class: "card #{css_class}", id: id) do + tag.div(class: "card #{css_class}", id:) do concat tag.h3(title, class: 'card-header') if title if without_block yield @@ -43,11 +43,11 @@ def card(title: nil, css_class: '', without_block: false, id: nil, &block) end end - def jumbotron(jumbotron_id = nil, options = {}, &block) + def jumbotron(jumbotron_id = nil, options = {}, &) options[:class] ||= +'' options[:class] << ' jumbotron' options[:id] = jumbotron_id - tag.div(**options, &block) + tag.div(**options, &) end # eg. state_badge('pending') diff --git a/app/helpers/plate_helper.rb b/app/helpers/plate_helper.rb index 6f0f78fd3..f5699e2d4 100644 --- a/app/helpers/plate_helper.rb +++ b/app/helpers/plate_helper.rb @@ -60,7 +60,7 @@ def sorted_pre_cap_pool_json(current_plate) # rubocop:todo Metrics/AbcSize next unless request.pre_capture_pool pool_id = request.pre_capture_pool.id - pool_store[pool_id] ||= { pool_id: pool_id, order_id: request.order_id, wells: [] } + pool_store[pool_id] ||= { pool_id:, order_id: request.order_id, wells: [] } pool_store[pool_id][:wells] << well.location end end diff --git a/app/models/concerns/labware_creators/tagged_plate_behaviour.rb b/app/models/concerns/labware_creators/tagged_plate_behaviour.rb index 0356e6c58..1ef6116c4 100644 --- a/app/models/concerns/labware_creators/tagged_plate_behaviour.rb +++ b/app/models/concerns/labware_creators/tagged_plate_behaviour.rb @@ -21,7 +21,7 @@ def flag_tag_plate_as_exhausted reason: 'Used in Library creation', target_state: 'exhausted', target_uuid: tag_plate.asset_uuid, - user_uuid: user_uuid + user_uuid: ) end diff --git a/app/models/concerns/presenters/creation_behaviour.rb b/app/models/concerns/presenters/creation_behaviour.rb index e457c9d67..73f6b638a 100644 --- a/app/models/concerns/presenters/creation_behaviour.rb +++ b/app/models/concerns/presenters/creation_behaviour.rb @@ -30,7 +30,7 @@ def construct_buttons(scope) creator: LabwareCreators.class_for(purpose_uuid), parent_uuid: uuid, parent: labware, - purpose_uuid: purpose_uuid, + purpose_uuid:, name: purpose_settings.name, type: purpose_settings.asset_type, filters: purpose_settings.filters || {} diff --git a/app/models/concerns/presenters/extended_csv.rb b/app/models/concerns/presenters/extended_csv.rb index d049e02dc..43792c343 100644 --- a/app/models/concerns/presenters/extended_csv.rb +++ b/app/models/concerns/presenters/extended_csv.rb @@ -18,8 +18,8 @@ def each_well_transfer(offset = 0) # rubocop:todo Metrics/AbcSize { index: (index += 1), name: "#{bed_prefix}#{(offset * 4) + bed_index + 1}", - source_well: source_well, - destination_well: destination_well + source_well:, + destination_well: }.merge(transfers_list) ) end @@ -58,12 +58,12 @@ def transfers_for_csv # rubocop:todo Metrics/AbcSize transfers = ct.transfers.reverse_merge(all_wells).sort { |a, b| split_location(a.first) <=> split_location(b.first) } { - source_ean: source_ean, - source_barcode: source_barcode, - source_stock: source_stock, - destination_ean: destination_ean, - destination_barcode: destination_barcode, - transfers: transfers + source_ean:, + source_barcode:, + source_stock:, + destination_ean:, + destination_barcode:, + transfers: } end end diff --git a/app/models/concerns/presenters/statemachine/state_does_not_allow_child_creation.rb b/app/models/concerns/presenters/statemachine/state_does_not_allow_child_creation.rb index 88f264d89..93f447a5e 100644 --- a/app/models/concerns/presenters/statemachine/state_does_not_allow_child_creation.rb +++ b/app/models/concerns/presenters/statemachine/state_does_not_allow_child_creation.rb @@ -5,7 +5,7 @@ module Presenters::Statemachine module StateDoesNotAllowChildCreation extend ActiveSupport::Concern included do - def control_additional_creation(&block) + def control_additional_creation(&) # Does nothing because you can't! end end diff --git a/app/models/labels/tube_label.rb b/app/models/labels/tube_label.rb index 6a992d43b..4f18c3015 100644 --- a/app/models/labels/tube_label.rb +++ b/app/models/labels/tube_label.rb @@ -6,8 +6,8 @@ def attributes # because otherwise we will lose important information about wells # if each well takes 3 (not 2) characters, like E10:H10, for example { - first_line: first_line, - second_line: second_line, + first_line:, + second_line:, third_line: labware.purpose_name, fourth_line: date_today, round_label_top_line: labware.barcode.prefix, diff --git a/app/models/labels/tube_label_traction_compatible.rb b/app/models/labels/tube_label_traction_compatible.rb index 8499aa823..93687391e 100644 --- a/app/models/labels/tube_label_traction_compatible.rb +++ b/app/models/labels/tube_label_traction_compatible.rb @@ -27,8 +27,8 @@ class Labels::TubeLabelTractionCompatible < Labels::TubeLabel def attributes { - first_line: first_line, - second_line: second_line, + first_line:, + second_line:, third_line: labware.purpose_name, fourth_line: date_today, round_label_top_line: labware.barcode.prefix, diff --git a/app/models/labware_creators/base.rb b/app/models/labware_creators/base.rb index 86a6557e4..92c1913cd 100644 --- a/app/models/labware_creators/base.rb +++ b/app/models/labware_creators/base.rb @@ -35,9 +35,9 @@ def self.support_parent?(_parent) # We pull out the api as the first argument as it ensures # we'll always have it available, even during assignment of # other attributes. Otherwise we end up relying on hash order. - def initialize(api, *args) + def initialize(api, *) @api = api - super(*args) + super(*) end def plate_to_walk @@ -118,7 +118,7 @@ def create_plate_from_parent! def transfer!(attributes) Sequencescape::Api::V2::Transfer.create!( - attributes.merge(transfer_template_uuid: transfer_template_uuid, user_uuid: user_uuid) + attributes.merge(transfer_template_uuid:, user_uuid:) ) end diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 8892620e5..3f6401b13 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -40,7 +40,7 @@ def tag_plate=(params) @tag_plate = OpenStruct.new(params) # rubocop:todo Style/OpenStructUse end - def initialize(*args, &block) + def initialize(*args, &) super parent.populate_wells_with_pool end diff --git a/app/models/labware_creators/final_tube.rb b/app/models/labware_creators/final_tube.rb index afa8fa9ff..1177d5d3b 100644 --- a/app/models/labware_creators/final_tube.rb +++ b/app/models/labware_creators/final_tube.rb @@ -19,8 +19,8 @@ class FinalTube < Base validate :all_parents_and_only_parents?, if: :barcodes_provided? validate :custom_input_expected, unless: :no_pooling_required? - def each_sibling(&block) - siblings.each(&block) + def each_sibling(&) + siblings.each(&) end def all_ready? diff --git a/app/models/labware_creators/final_tube_from_plate.rb b/app/models/labware_creators/final_tube_from_plate.rb index 7c0949aaf..1537864e2 100644 --- a/app/models/labware_creators/final_tube_from_plate.rb +++ b/app/models/labware_creators/final_tube_from_plate.rb @@ -51,7 +51,7 @@ def pass_tubes! Sequencescape::Api::V2::StateChange.create!( target_state: 'passed', target_uuid: tube_uuid, - user_uuid: user_uuid + user_uuid: ) end end diff --git a/app/models/labware_creators/multi_plate_pool.rb b/app/models/labware_creators/multi_plate_pool.rb index 6beeaacc5..05ed24229 100644 --- a/app/models/labware_creators/multi_plate_pool.rb +++ b/app/models/labware_creators/multi_plate_pool.rb @@ -22,7 +22,7 @@ def create_labware! @child = plate_creation.child - api.bulk_transfer.create!(user: user_uuid, well_transfers: well_transfers) + api.bulk_transfer.create!(user: user_uuid, well_transfers:) yield(@child) if block_given? true diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index aa3b153d0..7c067a18d 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -161,9 +161,9 @@ def create_submission_from_parent_tubes template_name: configured_params[:template_name], request_options: configured_params[:request_options], asset_groups: [ - { assets: asset_uuids, autodetect_studies: autodetect_studies, autodetect_projects: autodetect_projects } + { assets: asset_uuids, autodetect_studies:, autodetect_projects: } ], - api: api, + api:, user: user_uuid } diff --git a/app/models/labware_creators/plate_split_to_tube_racks.rb b/app/models/labware_creators/plate_split_to_tube_racks.rb index 8ccec4303..c9bd26883 100644 --- a/app/models/labware_creators/plate_split_to_tube_racks.rb +++ b/app/models/labware_creators/plate_split_to_tube_racks.rb @@ -317,7 +317,7 @@ def ancestor_stock_tubes def locate_ancestor_tubes purpose_name = purpose_config[:ancestor_stock_tube_purpose_name] - ancestor_results = parent.ancestors.where(purpose_name: purpose_name) + ancestor_results = parent.ancestors.where(purpose_name:) return {} if ancestor_results.blank? ancestor_results.each_with_object({}) do |ancestor_result, tube_list| @@ -414,7 +414,7 @@ def create_tubes(tube_purpose_uuid, number_of_tubes, tube_attributes) user: user_uuid, parent: parent_uuid, child_purposes: [tube_purpose_uuid] * number_of_tubes, - tube_attributes: tube_attributes + tube_attributes: ) .children .index_by(&:name) @@ -580,7 +580,7 @@ def generate_tube_attributes(tube_type, csv_file, wells) # @param dest_tube_posn [String] The position of the destination tube. # @return [Hash] A hash of details to use for generating a tube name. def name_for_details_hash(prefix, stock_tube_bc, dest_tube_posn) - { prefix: prefix, stock_tube_bc: stock_tube_bc, dest_tube_posn: dest_tube_posn } + { prefix:, stock_tube_bc:, dest_tube_posn: } end # Generates a human-readable name for a tube based on the given details hash. @@ -655,7 +655,7 @@ def add_contingency_tube_metadata # @return [void] def add_tube_metadata(child_tube, tube_posn, tube_details) LabwareMetadata - .new(user_uuid: user_uuid, barcode: child_tube.barcode.machine) + .new(user_uuid:, barcode: child_tube.barcode.machine) .update!(tube_rack_barcode: tube_details['tube_rack_barcode'], tube_rack_position: tube_posn) end diff --git a/app/models/labware_creators/pooled_tubes_base.rb b/app/models/labware_creators/pooled_tubes_base.rb index f55e8bc3a..0ba193629 100644 --- a/app/models/labware_creators/pooled_tubes_base.rb +++ b/app/models/labware_creators/pooled_tubes_base.rb @@ -26,7 +26,7 @@ def create_child_stock_tubes user: user_uuid, parent: parent_uuid, child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + tube_attributes: ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_by_sample.rb b/app/models/labware_creators/pooled_tubes_by_sample.rb index 29121318a..8039a40ba 100644 --- a/app/models/labware_creators/pooled_tubes_by_sample.rb +++ b/app/models/labware_creators/pooled_tubes_by_sample.rb @@ -53,7 +53,7 @@ def create_child_stock_tubes user: user_uuid, parent: parent_uuid, child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + tube_attributes: ) .children .index_by(&:name) @@ -186,7 +186,7 @@ def ancestor_stock_tubes def locate_ancestor_tubes purpose_name = purpose_config[:ancestor_stock_tube_purpose_name] - ancestor_results = parent.ancestors.where(purpose_name: purpose_name) + ancestor_results = parent.ancestors.where(purpose_name:) return {} if ancestor_results.blank? ancestor_results.each_with_object({}) do |ancestor_result, tube_list| diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index f0d6103f0..76745ae75 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -19,9 +19,9 @@ def create_child_stock_tubes .specific_tube_creation .create!( user: user_uuid, - parents: parents, + parents:, child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + tube_attributes: ) .children .index_by(&:name) diff --git a/app/models/labware_creators/quadrant_split_plate.rb b/app/models/labware_creators/quadrant_split_plate.rb index 0ae504e88..d2fae00ff 100644 --- a/app/models/labware_creators/quadrant_split_plate.rb +++ b/app/models/labware_creators/quadrant_split_plate.rb @@ -45,7 +45,7 @@ def add_stock_barcode_metadata(plates) # rubocop:todo Metrics/AbcSize metadata = LabwareMetadata.new(barcode: merger_plate.barcode.machine).metadata plates.each_with_index do |plate, index| stock_barcode = stock_barcode_from_quadrant(index, metadata) || "* #{plate.barcode.human}" - LabwareMetadata.new(user_uuid: user_uuid, barcode: plate.barcode.machine).update!(stock_barcode: stock_barcode) + LabwareMetadata.new(user_uuid:, barcode: plate.barcode.machine).update!(stock_barcode:) end end diff --git a/app/models/labware_creators/quadrant_stamp_base.rb b/app/models/labware_creators/quadrant_stamp_base.rb index 60ced9c7c..1757dadc7 100644 --- a/app/models/labware_creators/quadrant_stamp_base.rb +++ b/app/models/labware_creators/quadrant_stamp_base.rb @@ -36,7 +36,7 @@ class QuadrantStampBase < MultiStamp def create_labware! super do |child| - LabwareMetadata.new(user_uuid: user_uuid, labware: child).update!(stock_barcodes_by_quadrant) + LabwareMetadata.new(user_uuid:, labware: child).update!(stock_barcodes_by_quadrant) yield(child) if block_given? end end @@ -57,7 +57,7 @@ def stock_barcodes_by_quadrant source_plates_by_quadrant.each_with_index do |uuid, index| next if uuid.nil? - source_plate = Sequencescape::Api::V2::Plate.find_by(uuid: uuid) + source_plate = Sequencescape::Api::V2::Plate.find_by(uuid:) stock_barcode = source_plate&.stock_plate&.barcode&.human quadrants[:"stock_barcode_q#{index}"] = stock_barcode unless stock_barcode.nil? end diff --git a/app/models/labware_creators/tagged_plate.rb b/app/models/labware_creators/tagged_plate.rb index 088a8f10c..bd2366bab 100644 --- a/app/models/labware_creators/tagged_plate.rb +++ b/app/models/labware_creators/tagged_plate.rb @@ -30,7 +30,7 @@ def tag_plate=(params) @tag_plate = QcableObject.new(params[:asset_uuid], params[:template_uuid]) end - def initialize(*args, &block) + def initialize(*args, &) super parent.populate_wells_with_pool end diff --git a/app/models/labware_metadata.rb b/app/models/labware_metadata.rb index 90df6af17..e6675b7d4 100644 --- a/app/models/labware_metadata.rb +++ b/app/models/labware_metadata.rb @@ -8,7 +8,7 @@ def initialize(params = {}) @user = Sequencescape::Api::V2::User.find(uuid: @user_uuid).first unless @user_uuid.nil? @barcode = params.fetch(:barcode, nil) if barcode.present? - @labware = Sequencescape::Api::V2::Labware.find(barcode: barcode).first + @labware = Sequencescape::Api::V2::Labware.find(barcode:).first else @labware = params.fetch(:labware, nil) raise ArgumentError, 'Parameters labware or barcode missing' if labware.nil? diff --git a/app/models/limber/qc_file.rb b/app/models/limber/qc_file.rb index 6e3094a8f..90bd1b228 100644 --- a/app/models/limber/qc_file.rb +++ b/app/models/limber/qc_file.rb @@ -4,6 +4,6 @@ class Limber::QcFile < Sequencescape::QcFile # rubocop:todo Style/Documentation # Done this here for the moment, could look at using # ActiveModel::Serializers in future. def as_json(_args) - { filename: filename, size: size, uuid: uuid, created: created_at.to_fs(:long) } + { filename:, size:, uuid:, created: created_at.to_fs(:long) } end end diff --git a/app/models/ongoing_plate.rb b/app/models/ongoing_plate.rb index b47397afe..a470769c1 100644 --- a/app/models/ongoing_plate.rb +++ b/app/models/ongoing_plate.rb @@ -10,7 +10,7 @@ def search_parameters plate_purpose_uuids: purpose_uuids, show_my_plates_only: show_my_plates_only == '1', include_used: include_used == '1', - page: page + page: } end diff --git a/app/models/ongoing_tube.rb b/app/models/ongoing_tube.rb index 578a9934c..c304564c5 100644 --- a/app/models/ongoing_tube.rb +++ b/app/models/ongoing_tube.rb @@ -9,7 +9,7 @@ def search_parameters states: states || %w[pending started passed qc_complete failed cancelled], tube_purpose_uuids: purpose_uuids, include_used: include_used == '1', - page: page + page: } end diff --git a/app/models/presenters/plate_presenter.rb b/app/models/presenters/plate_presenter.rb index 9874478d2..e8baf963e 100644 --- a/app/models/presenters/plate_presenter.rb +++ b/app/models/presenters/plate_presenter.rb @@ -91,7 +91,7 @@ def label end def tubes_and_sources - @tubes_and_sources ||= Presenters::TubesWithSources.build(wells: wells, pools: pools) + @tubes_and_sources ||= Presenters::TubesWithSources.build(wells:, pools:) yield(@tubes_and_sources) if block_given? && @tubes_and_sources.tubes? @tubes_and_sources end diff --git a/app/models/print_job.rb b/app/models/print_job.rb index f1a7eeae3..d383ffc18 100644 --- a/app/models/print_job.rb +++ b/app/models/print_job.rb @@ -26,7 +26,7 @@ def execute def print_to_pmb job = PMB::PrintJob.new( - printer_name: printer_name, + printer_name:, label_template_id: pmb_label_template_id, labels: { body: (labels * number_of_copies) diff --git a/app/models/robots/bed/plate_to_tube_racks_bed.rb b/app/models/robots/bed/plate_to_tube_racks_bed.rb index 6e013c6ad..47fa24aa2 100644 --- a/app/models/robots/bed/plate_to_tube_racks_bed.rb +++ b/app/models/robots/bed/plate_to_tube_racks_bed.rb @@ -18,7 +18,7 @@ def labware_created_with_robot(robot_barcode) # RobotController uses machine barcode for initialising LabwareMetadata labware.tubes.each do |tube| LabwareMetadata - .new(user_uuid: user_uuid, barcode: tube.barcode.machine) + .new(user_uuid:, barcode: tube.barcode.machine) .update!(created_with_robot: robot_barcode) end end diff --git a/app/models/sequencescape_submission.rb b/app/models/sequencescape_submission.rb index fa53d444b..3ffd1e713 100644 --- a/app/models/sequencescape_submission.rb +++ b/app/models/sequencescape_submission.rb @@ -117,7 +117,7 @@ def asset_groups_for_orders_creation def generate_orders asset_groups_for_orders_creation.map do |asset_group| - order_parameters = { request_options: request_options, user: user }.merge(asset_group) + order_parameters = { request_options:, user: }.merge(asset_group) submission_template.orders.create!(order_parameters) end end @@ -125,7 +125,7 @@ def generate_orders # rubocop:disable Metrics/AbcSize def generate_submissions orders = generate_orders - submission = api.submission.create!(orders: orders.map(&:uuid), user: user) + submission = api.submission.create!(orders: orders.map(&:uuid), user:) @submission_uuid = submission.uuid submission.submit! true diff --git a/app/models/state_changers.rb b/app/models/state_changers.rb index b0e33c72e..f2c22741f 100644 --- a/app/models/state_changers.rb +++ b/app/models/state_changers.rb @@ -26,11 +26,11 @@ def initialize(api, labware_uuid, user_uuid) def move_to!(state, reason = nil, customer_accepts_responsibility = false) Sequencescape::Api::V2::StateChange.create!( contents: contents_for(state), - customer_accepts_responsibility: customer_accepts_responsibility, - reason: reason, + customer_accepts_responsibility:, + reason:, target_state: state, target_uuid: labware_uuid, - user_uuid: user_uuid + user_uuid: ) end diff --git a/app/models/utility/pcr_cycles_csv_file_upload_config_base.rb b/app/models/utility/pcr_cycles_csv_file_upload_config_base.rb index cbd55caa5..5427f7397 100644 --- a/app/models/utility/pcr_cycles_csv_file_upload_config_base.rb +++ b/app/models/utility/pcr_cycles_csv_file_upload_config_base.rb @@ -29,8 +29,8 @@ def initialize_pipeline_specific_methods raise '#initialize_pipeline_specific_methods must be implemented on subclasses' end - def create_method(name, &block) - self.class.send(:define_method, name, &block) + def create_method(name, &) + self.class.send(:define_method, name, &) end def submit_for_sequencing_valid_values diff --git a/app/sequencescape/sequencescape/api/v2.rb b/app/sequencescape/sequencescape/api/v2.rb index df5dc2391..7891ecaa9 100644 --- a/app/sequencescape/sequencescape/api/v2.rb +++ b/app/sequencescape/sequencescape/api/v2.rb @@ -31,7 +31,7 @@ module Sequencescape::Api::V2 # def self.minimal_labware_by_barcode(barcode, select: :uuid) Sequencescape::Api::V2::Labware - .where(barcode: barcode) + .where(barcode:) .select(tube_racks: select, plates: select, tubes: select) .first end @@ -53,7 +53,7 @@ def self.additional_plates_for_presenter(query) end def self.plate_with_wells(uuid) - Plate.includes('wells').find(uuid: uuid).first + Plate.includes('wells').find(uuid:).first end def self.tube_rack_for_presenter(query) @@ -67,13 +67,13 @@ def self.tube_rack_for_presenter(query) end def self.plate_for_completion(uuid) - Plate.includes('wells.aliquots.request.submission,wells.aliquots.request.request_type').find(uuid: uuid).first + Plate.includes('wells.aliquots.request.submission,wells.aliquots.request.request_type').find(uuid:).first end def self.tube_for_completion(uuid) Tube .includes('receptacle.aliquots.request.submission,receptacle.aliquots.request.request_type') - .find(uuid: uuid) + .find(uuid:) .first end diff --git a/app/sequencescape/sequencescape/api/v2/shared/has_requests.rb b/app/sequencescape/sequencescape/api/v2/shared/has_requests.rb index 289ed0d27..e4af355c8 100644 --- a/app/sequencescape/sequencescape/api/v2/shared/has_requests.rb +++ b/app/sequencescape/sequencescape/api/v2/shared/has_requests.rb @@ -70,7 +70,7 @@ def requests_in_progress(request_types_to_complete: nil) # Based on in_progress requests def in_progress_submission_uuids(request_types_to_complete: nil) - requests_in_progress(request_types_to_complete: request_types_to_complete).flat_map(&:submission_uuid).uniq + requests_in_progress(request_types_to_complete:).flat_map(&:submission_uuid).uniq end def all_requests diff --git a/lib/purpose_config.rb b/lib/purpose_config.rb index db9ba5f3f..7c94766b4 100644 --- a/lib/purpose_config.rb +++ b/lib/purpose_config.rb @@ -44,7 +44,7 @@ def initialize(name, options, store, submission_templates, label_template_config def config { - name: name, + name:, **default_options, state_changer_class: default_state_changer, submission: submission_options, @@ -82,7 +82,7 @@ class Tube < PurposeConfig # rubocop:todo Style/Documentation def register! puts "Creating #{name}" - options_for_creation = { name: name, target_type: @options.fetch(:target), purpose_type: @options.fetch(:type) } + options_for_creation = { name:, target_type: @options.fetch(:target), purpose_type: @options.fetch(:type) } Sequencescape::Api::V2::TubePurpose.create!(options_for_creation) end end @@ -111,7 +111,7 @@ def register! # cannot be created. options_for_creation = { - name: name, + name:, stock_plate: config.fetch(:stock_plate, false), cherrypickable_target: config.fetch(:cherrypickable_target, false), input_plate: config.fetch(:input_plate, false), diff --git a/lib/robot_configuration.rb b/lib/robot_configuration.rb index c4663231c..daabc102c 100644 --- a/lib/robot_configuration.rb +++ b/lib/robot_configuration.rb @@ -6,14 +6,14 @@ module RobotConfiguration module BedHelpers # rubocop:todo Style/Documentation def bed(number) - barcode = SBCF::SangerBarcode.new(prefix: 'BD', number: number) + barcode = SBCF::SangerBarcode.new(prefix: 'BD', number:) ean13 = barcode.machine_barcode.to_s BedOrCar.new(ean13, "Bed #{number}") end def car(position) number = position.tr(',', '').to_i - barcode = SBCF::SangerBarcode.new(prefix: 'BD', number: number) + barcode = SBCF::SangerBarcode.new(prefix: 'BD', number:) ean13 = barcode.machine_barcode.to_s BedOrCar.new(ean13, "Carousel #{position}") end @@ -21,9 +21,9 @@ def car(position) class Register # rubocop:todo Style/Documentation include BedHelpers - def self.configure(&block) + def self.configure(&) register = new - register.instance_eval(&block) + register.instance_eval(&) register.configuration end @@ -31,18 +31,18 @@ def custom_robot(key, hash) @robots[key] = hash end - def bravo_robot(transition_to: 'passed', verify_robot: false, require_robot: false, &block) + def bravo_robot(transition_to: 'passed', verify_robot: false, require_robot: false, &) simple_robot( 'bravo', - transition_to: transition_to, - verify_robot: verify_robot, - require_robot: require_robot, - &block + transition_to:, + verify_robot:, + require_robot:, + & ) end - def simple_robot(type, transition_to: 'passed', verify_robot: false, require_robot: false, &block) - added_robot = RobotConfiguration::Simple.new(type, transition_to, verify_robot, require_robot, &block) + def simple_robot(type, transition_to: 'passed', verify_robot: false, require_robot: false, &) + added_robot = RobotConfiguration::Simple.new(type, transition_to, verify_robot, require_robot, &) @robots[added_robot.key] = added_robot.configuration added_robot end @@ -118,9 +118,9 @@ def key def configuration { - name: name, - verify_robot: verify_robot, - require_robot: require_robot, + name:, + verify_robot:, + require_robot:, beds: { source_bed_barcode => { purpose: source_purpose, @@ -133,7 +133,7 @@ def configuration states: [target_bed_state], label: target_bed_name, parent: source_bed_barcode, - target_state: target_state + target_state: } } } diff --git a/lib/well_helpers.rb b/lib/well_helpers.rb index 306620a79..e770daaa1 100644 --- a/lib/well_helpers.rb +++ b/lib/well_helpers.rb @@ -43,8 +43,8 @@ def self.rows_range(size = nil, rows: nil) # # @return [Array] well names in column order ie. A1, B1, C1 ... def self.column_order(size = 96, rows: nil, columns: nil) - columns_range(size, columns: columns) - .each_with_object([]) { |c, wells| rows_range(size, rows: rows).each { |r| wells << "#{r}#{c}" } } + columns_range(size, columns:) + .each_with_object([]) { |c, wells| rows_range(size, rows:).each { |r| wells << "#{r}#{c}" } } .freeze end @@ -53,8 +53,8 @@ def self.column_order(size = 96, rows: nil, columns: nil) # @param [96,192] number of wells on the plate. Only valid for 3:2 ratio plate sizes # @return [Array] well names in row order ie. A1, A2, A3 ... def self.row_order(size = 96, rows: nil, columns: nil) - rows_range(size, rows: rows) - .each_with_object([]) { |r, wells| columns_range(size, columns: columns).each { |c| wells << "#{r}#{c}" } } + rows_range(size, rows:) + .each_with_object([]) { |r, wells| columns_range(size, columns:).each { |c| wells << "#{r}#{c}" } } .freeze end @@ -66,7 +66,7 @@ def self.row_order(size = 96, rows: nil, columns: nil) # @return [Hash] eg. { 'A1' => 'A1', 'B1' => 'B1', ...} # def self.stamp_hash(size, rows: nil, columns: nil) - column_order(size, rows: rows, columns: columns).each_with_object({}) { |well, hash| hash[well] = well } + column_order(size, rows:, columns:).each_with_object({}) { |well, hash| hash[well] = well } end # Returns the index of the well by column diff --git a/spec/controllers/exports_controller_spec.rb b/spec/controllers/exports_controller_spec.rb index 08cf8840c..2492d5a68 100644 --- a/spec/controllers/exports_controller_spec.rb +++ b/spec/controllers/exports_controller_spec.rb @@ -271,7 +271,7 @@ it 'sets the correct filename' do page = 0 - get :show, params: { id: csv_id, limber_plate_id: plate_barcode, page: page }, as: :csv + get :show, params: { id: csv_id, limber_plate_id: plate_barcode, page: }, as: :csv expect( @response.headers['Content-Disposition'].include?( "filename=\"cellaca_input_file_#{plate_barcode}_#{page + 1}.csv\"" diff --git a/spec/controllers/pipeline_work_in_progress_controller_spec.rb b/spec/controllers/pipeline_work_in_progress_controller_spec.rb index 601bcef35..8c54f4104 100644 --- a/spec/controllers/pipeline_work_in_progress_controller_spec.rb +++ b/spec/controllers/pipeline_work_in_progress_controller_spec.rb @@ -25,7 +25,7 @@ let(:date) { Date.new(2019, 5, 13) } it 'parses the date from the URL parameters' do - expect(controller.from_date({ date: date })).to eq date + expect(controller.from_date({ date: })).to eq date end it 'defaults to a month ago' do diff --git a/spec/controllers/plates/work_completions_controller_spec.rb b/spec/controllers/plates/work_completions_controller_spec.rb index 5c65e2a4e..3eb1d80b3 100644 --- a/spec/controllers/plates/work_completions_controller_spec.rb +++ b/spec/controllers/plates/work_completions_controller_spec.rb @@ -23,7 +23,7 @@ end it 'creates work_completion' do - post :create, params: { limber_plate_id: plate_uuid }, session: { user_uuid: user_uuid } + post :create, params: { limber_plate_id: plate_uuid }, session: { user_uuid: } expect(response).to redirect_to(limber_plate_path(plate_uuid)) expect(work_completion_creation).to have_been_made.once assert_equal ['Requests have been passed'], flash.notice diff --git a/spec/controllers/plates_controller_spec.rb b/spec/controllers/plates_controller_spec.rb index 5c4cb9303..c109524ee 100644 --- a/spec/controllers/plates_controller_spec.rb +++ b/spec/controllers/plates_controller_spec.rb @@ -16,7 +16,7 @@ def expect_state_change_create(attributes) expect_api_v2_posts( 'StateChange', - [{ target_state: 'failed', target_uuid: plate_uuid, user_uuid: user_uuid }.merge(attributes)] + [{ target_state: 'failed', target_uuid: plate_uuid, user_uuid: }.merge(attributes)] ) end @@ -68,7 +68,7 @@ def expect_state_change_create(attributes) purpose_uuid: 'stock-plate-purpose-uuid' }, session: { - user_uuid: user_uuid + user_uuid: } expect(response).to redirect_to(search_path) @@ -94,7 +94,7 @@ def expect_state_change_create(attributes) } }, session: { - user_uuid: user_uuid + user_uuid: } expect(response).to redirect_to(limber_plate_path(plate_uuid)) diff --git a/spec/controllers/print_jobs_controller_spec.rb b/spec/controllers/print_jobs_controller_spec.rb index f295256f7..14a3c50c2 100644 --- a/spec/controllers/print_jobs_controller_spec.rb +++ b/spec/controllers/print_jobs_controller_spec.rb @@ -29,7 +29,7 @@ allow(PrintJob).to receive(:new).and_return(print_job_mock) allow(print_job_mock).to receive(:execute).and_return(true) - post :create, params: params, format: :json + post :create, params:, format: :json assert assigns(:print_job) assert_equal 'Your label(s) have been sent to tube printer 1', flash.notice diff --git a/spec/controllers/qc_files_controller_spec.rb b/spec/controllers/qc_files_controller_spec.rb index 2256ef0d7..d2a97f533 100644 --- a/spec/controllers/qc_files_controller_spec.rb +++ b/spec/controllers/qc_files_controller_spec.rb @@ -11,7 +11,7 @@ let(:filename) { 'my_holiday.jpg' } before do - stub_api_get(file_uuid, body: json(:qc_file, uuid: file_uuid, filename: filename)) + stub_api_get(file_uuid, body: json(:qc_file, uuid: file_uuid, filename:)) stub_request(:get, api_url_for(file_uuid)) .with(headers: { 'Accept' => 'sequencescape/qc_file' }) .to_return( diff --git a/spec/controllers/searches_controller_spec.rb b/spec/controllers/searches_controller_spec.rb index d02015525..c3ff23908 100644 --- a/spec/controllers/searches_controller_spec.rb +++ b/spec/controllers/searches_controller_spec.rb @@ -29,7 +29,7 @@ before { stub_barcode_search(barcode, labware) } context 'for a plate' do - let(:labware) { create :labware_plate, uuid: uuid } + let(:labware) { create :labware_plate, uuid: } it 'redirects to the found labware' do post :create, params: { plate_barcode: barcode } expect(response).to redirect_to(limber_plate_path(uuid)) @@ -37,7 +37,7 @@ end context 'for a tube' do - let(:labware) { create :labware_tube, uuid: uuid } + let(:labware) { create :labware_tube, uuid: } it 'redirects to the found labware' do post :create, params: { plate_barcode: barcode } expect(response).to redirect_to(limber_tube_path(uuid)) @@ -45,7 +45,7 @@ end context 'for a tube rack' do - let(:labware) { create :labware_tube_rack, uuid: uuid } + let(:labware) { create :labware_tube_rack, uuid: } it 'redirects to the found labware' do post :create, params: { plate_barcode: barcode } expect(response).to redirect_to(limber_tube_rack_path(uuid)) diff --git a/spec/controllers/sequencescape_submissions_controller_spec.rb b/spec/controllers/sequencescape_submissions_controller_spec.rb index ec89884cb..7f87f151a 100644 --- a/spec/controllers/sequencescape_submissions_controller_spec.rb +++ b/spec/controllers/sequencescape_submissions_controller_spec.rb @@ -40,8 +40,8 @@ 'orders', payload: { order: { - assets: assets, - request_options: request_options, + assets:, + request_options:, user: user_uuid } }, @@ -65,7 +65,7 @@ let!(:submission_submit) { stub_api_post('sub-uuid', 'submit') } it 'creates a submission' do - post :create, params: request_parameters, session: { user_uuid: user_uuid } + post :create, params: request_parameters, session: { user_uuid: } expect(order_request).to have_been_made.once expect(submission_request).to have_been_made.once expect(submission_submit).to have_been_made.once diff --git a/spec/controllers/tube_creation_controller_spec.rb b/spec/controllers/tube_creation_controller_spec.rb index 20ee5bd19..7e486018b 100644 --- a/spec/controllers/tube_creation_controller_spec.rb +++ b/spec/controllers/tube_creation_controller_spec.rb @@ -29,7 +29,7 @@ purpose_uuid: child_purpose_uuid }, session: { - user_uuid: user_uuid + user_uuid: } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) @@ -44,7 +44,7 @@ purpose_uuid: child_purpose_uuid }, session: { - user_uuid: user_uuid + user_uuid: } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) @@ -71,7 +71,7 @@ } }, session: { - user_uuid: user_uuid + user_uuid: } expect(response).to redirect_to("#{limber_tube_path(child_uuid)}#relatives_tab") expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) @@ -90,7 +90,7 @@ } }, session: { - user_uuid: user_uuid + user_uuid: } expect(response).to redirect_to("#{limber_tube_path(child_uuid)}#relatives_tab") expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) diff --git a/spec/controllers/tubes/work_completions_controller_spec.rb b/spec/controllers/tubes/work_completions_controller_spec.rb index e38c0c538..4f2c5aad9 100644 --- a/spec/controllers/tubes/work_completions_controller_spec.rb +++ b/spec/controllers/tubes/work_completions_controller_spec.rb @@ -19,7 +19,7 @@ end it 'creates work_completion' do - post :create, params: { limber_tube_id: tube_uuid }, session: { user_uuid: user_uuid } + post :create, params: { limber_tube_id: tube_uuid }, session: { user_uuid: } expect(response).to redirect_to(limber_tube_path(tube_uuid)) expect(tube_get).to have_been_made expect(work_completion_creation).to have_been_made.once diff --git a/spec/controllers/tubes_controller_spec.rb b/spec/controllers/tubes_controller_spec.rb index 7d75da7ef..bda03db83 100644 --- a/spec/controllers/tubes_controller_spec.rb +++ b/spec/controllers/tubes_controller_spec.rb @@ -44,7 +44,7 @@ reason: 'Because testing', target_state: 'cancelled', target_uuid: tube_uuid, - user_uuid: user_uuid + user_uuid: } ] ) @@ -60,7 +60,7 @@ purpose_uuid: 'stock-tube-purpose-uuid' }, session: { - user_uuid: user_uuid + user_uuid: } expect(response).to redirect_to(search_path) diff --git a/spec/factories/labware_factories.rb b/spec/factories/labware_factories.rb index 04b51a260..dc0b22c7e 100644 --- a/spec/factories/labware_factories.rb +++ b/spec/factories/labware_factories.rb @@ -29,7 +29,7 @@ end factory(:labware_with_state_changes) do - state_changes { create_list :v2_state_change, 2, target_state: target_state } + state_changes { create_list :v2_state_change, 2, target_state: } after(:build) { |labware, evaluator| labware._cached_relationship(:state_changes) { evaluator.state_changes } } end diff --git a/spec/factories/plate_factories.rb b/spec/factories/plate_factories.rb index 4a0a421a7..ce72cbfe1 100644 --- a/spec/factories/plate_factories.rb +++ b/spec/factories/plate_factories.rb @@ -49,7 +49,7 @@ pcr_cycles: pool_prc_cycles[index], state: library_state[index], submission_id: index, - include_submissions: include_submissions, + include_submissions:, order_id: index * 2, uuid: "request-#{request_index += 1}" end @@ -71,14 +71,14 @@ Array.new(well_count) do |i| location = WellHelpers.well_at_column_index(i, size) create well_factory, - location: location, + location:, state: well_states[i] || state, outer_request: outer_requests[i], downstream_tubes: transfer_targets[location], uuid: well_uuid_result % location, aliquot_count: outer_requests[i] ? 1 : aliquots_without_requests, - study: study, - project: project + study:, + project: end end @@ -248,14 +248,14 @@ Array.new(well_count) do |i| location = WellHelpers.well_at_column_index(i, size) create well_factory, - location: location, + location:, state: well_states[i] || state, outer_request: nil, downstream_tubes: nil, uuid: well_uuid_result % location, aliquot_count: 0, - study: study, - project: project + study:, + project: end end end @@ -335,7 +335,7 @@ factory :stock_plate do purpose_name { 'Limber Cherrypicked' } purpose_uuid { 'stock-plate-purpose-uuid' } - stock_plate { { barcode: barcode, uuid: uuid } } + stock_plate { { barcode:, uuid: } } factory :stock_plate_with_metadata do with_belongs_to_associations 'custom_metadatum_collection' diff --git a/spec/factories/purpose_config_factories.rb b/spec/factories/purpose_config_factories.rb index 451fa85a7..943eafab3 100644 --- a/spec/factories/purpose_config_factories.rb +++ b/spec/factories/purpose_config_factories.rb @@ -180,7 +180,7 @@ transient { acceptable_purposes { %w[Purpose1 Purpose2] } } state_changer_class { 'StateChangers::AutomaticPlateStateChanger' } - creator_class { { name: 'LabwareCreators::TenStamp', args: { acceptable_purposes: acceptable_purposes } } } + creator_class { { name: 'LabwareCreators::TenStamp', args: { acceptable_purposes: } } } work_completion_request_type { 'limber_bespoke_aggregation' } end @@ -271,7 +271,7 @@ { name: 'LabwareCreators::PooledWellsBySampleInGroups', args: { - number_of_source_wells: number_of_source_wells + number_of_source_wells: } } end @@ -298,9 +298,9 @@ { name: 'LabwareCreators::DonorPoolingPlate', args: { - default_number_of_pools: default_number_of_pools, - max_number_of_source_plates: max_number_of_source_plates, - pooling: pooling + default_number_of_pools:, + max_number_of_source_plates:, + pooling: } } end diff --git a/spec/factories/tag_layout_template_factories.rb b/spec/factories/tag_layout_template_factories.rb index 678ec581e..01754411a 100644 --- a/spec/factories/tag_layout_template_factories.rb +++ b/spec/factories/tag_layout_template_factories.rb @@ -109,7 +109,7 @@ tag_layout_templates do Array.new(size) do |i| - associated(template_factory, uuid: "tag-layout-template-#{i}", name: "Tag2 layout #{i}", direction: direction) + associated(template_factory, uuid: "tag-layout-template-#{i}", name: "Tag2 layout #{i}", direction:) end end diff --git a/spec/factories/transfer_factories.rb b/spec/factories/transfer_factories.rb index af3f09536..8c9510bdc 100644 --- a/spec/factories/transfer_factories.rb +++ b/spec/factories/transfer_factories.rb @@ -148,7 +148,7 @@ associated_on { 'transfers_to_tubes' } plate_uuid { SecureRandom.uuid } plate { associated :plate, uuid: plate_uuid } - sources { source_uuids.map { |uuid| associated :plate, uuid: uuid } } + sources { source_uuids.map { |uuid| associated :plate, uuid: } } # While resources can be paginated, wells wont be. # Furthermore, we trust the api gem to handle that side of things. @@ -157,7 +157,7 @@ transfer_factory { :creation_transfer } end - transfers { sources.map { |source| associated(transfer_factory, source: source, destination: plate) } } + transfers { sources.map { |source| associated(transfer_factory, source:, destination: plate) } } end end end diff --git a/spec/factories/tube_factories.rb b/spec/factories/tube_factories.rb index 02a1c909a..ec5589e4b 100644 --- a/spec/factories/tube_factories.rb +++ b/spec/factories/tube_factories.rb @@ -53,7 +53,7 @@ factory :tube_without_siblings do json_root { 'tube' } - sibling_tubes { [{ name: name, uuid: uuid, ean13_barcode: ean13, state: state }] } + sibling_tubes { [{ name:, uuid:, ean13_barcode: ean13, state: }] } end factory :tube_with_siblings do @@ -73,14 +73,14 @@ end end - sibling_tubes { [{ name: name, uuid: uuid, ean13_barcode: ean13, state: state }] + other_siblings } + sibling_tubes { [{ name:, uuid:, ean13_barcode: ean13, state: }] + other_siblings } end end factory :stock_tube do purpose_name { 'Limber Cherrypicked' } purpose_uuid { 'stock-plate-purpose-uuid' } - stock_plate { { barcode: barcode, uuid: uuid } } + stock_plate { { barcode:, uuid: } } factory :stock_tube_with_metadata do with_belongs_to_associations 'custom_metadatum_collection' @@ -98,7 +98,7 @@ state { 'passed' } purpose_name { 'example-purpose' } purpose_uuid { 'example-purpose-uuid' } - receptacle { create(:v2_receptacle, qc_results: [], aliquots: aliquots) } + receptacle { create(:v2_receptacle, qc_results: [], aliquots:) } created_at { '2017-06-29T09:31:59.000+01:00' } updated_at { '2017-06-29T09:31:59.000+01:00' } @@ -108,12 +108,12 @@ barcode_prefix { 'NT' } library_state { 'pending' } priority { 0 } - outer_request { create request_factory, state: library_state, priority: priority } + outer_request { create request_factory, state: library_state, priority: } request_factory { :library_request } aliquot_count { 2 } aliquot_factory { :v2_tagged_aliquot } aliquots do - create_list aliquot_factory, aliquot_count, library_state: library_state, outer_request: outer_request + create_list aliquot_factory, aliquot_count, library_state:, outer_request: end parents { [] } purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } @@ -181,7 +181,7 @@ study_count { 1 } end children do - Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count: study_count) } + Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } end end @@ -196,7 +196,7 @@ associated( tube_factory, uuid: "tube-#{uuid_index_offset + i}", - barcode_prefix: barcode_prefix, + barcode_prefix:, barcode_number: barcode_numbers[i], name: names[i] ) diff --git a/spec/factories/tube_rack_factories.rb b/spec/factories/tube_rack_factories.rb index 807f3a847..ef18b454b 100644 --- a/spec/factories/tube_rack_factories.rb +++ b/spec/factories/tube_rack_factories.rb @@ -21,7 +21,7 @@ tubes { {} } racked_tubes do - tubes.map { |coordinate, tube| create :racked_tube, coordinate: coordinate, tube: tube, tube_rack: instance } + tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } end end diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 60e5059b8..8066a81ae 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -61,7 +61,7 @@ aliquots do # Conditional to avoid generating requests when not required if aliquot_count > 0 - create_list aliquot_factory, aliquot_count, outer_request: outer_request, study: study, project: project + create_list(aliquot_factory, aliquot_count, outer_request:, study:, project:) else [] end @@ -193,15 +193,15 @@ wells do locations.each_with_index.map do |location, i| if empty_wells.include?(location) - associated(:empty_well, location: location, uuid: "example-well-uuid-#{i}") + associated(:empty_well, location:, uuid: "example-well-uuid-#{i}") else state = custom_state[location] || default_state associated( :well, - location: location, + location:, uuid: "example-well-uuid-#{i}", - state: state, - aliquot_factory: aliquot_factory + state:, + aliquot_factory: ) end end @@ -216,7 +216,7 @@ tag2 { {} } suboptimal { false } - sample { associated(:sample, name: sample_name, sample_id: sample_id, uuid: sample_uuid) } + sample { associated(:sample, name: sample_name, sample_id:, uuid: sample_uuid) } transient do sample_name { 'sample' } diff --git a/spec/factory_outputs/plate_factory_spec.rb b/spec/factory_outputs/plate_factory_spec.rb index d165b1baf..99e6f1a64 100644 --- a/spec/factory_outputs/plate_factory_spec.rb +++ b/spec/factory_outputs/plate_factory_spec.rb @@ -180,7 +180,7 @@ RSpec.describe 'v2_plate' do context 'with specified study and project at plate level' do - subject { create(:v2_plate, aliquots_without_requests: 1, study: study, project: project) } + subject { create(:v2_plate, aliquots_without_requests: 1, study:, project:) } # study let(:study_uuid) { SecureRandom.uuid } @@ -222,7 +222,7 @@ RSpec.describe 'v2_plate_for_submission' do context 'with specified study and project at plate level' do - subject { create(:v2_plate_for_submission, aliquots_without_requests: 1, study: study, project: project) } + subject { create(:v2_plate_for_submission, aliquots_without_requests: 1, study:, project:) } # study let(:study_uuid) { SecureRandom.uuid } diff --git a/spec/factory_outputs/well_factory_spec.rb b/spec/factory_outputs/well_factory_spec.rb index 8f395bf18..0578805b7 100644 --- a/spec/factory_outputs/well_factory_spec.rb +++ b/spec/factory_outputs/well_factory_spec.rb @@ -134,7 +134,7 @@ subject { create(:v2_well, location: 'A1', aliquots: [source_aliquot]) } # source aliquots - let(:source_aliquot) { create(:v2_aliquot, sample: sample) } + let(:source_aliquot) { create(:v2_aliquot, sample:) } describe 'first aliquot' do let(:first_well_aliquot) { subject.aliquots.first } @@ -195,7 +195,7 @@ let(:first_aliquot) { subject.aliquots.first } # source aliquots - let(:source_aliquot) { create(:v2_aliquot, sample: sample, study: study, project: project) } + let(:source_aliquot) { create(:v2_aliquot, sample:, study:, project:) } # study let(:study_uuid) { SecureRandom.uuid } @@ -239,7 +239,7 @@ end context 'with specified study and project at well level' do - subject { create(:v2_well, study: study, project: project) } + subject { create(:v2_well, study:, project:) } let(:first_aliquot) { subject.aliquots.first } # study diff --git a/spec/features/cancelling_a_whole_plate_spec.rb b/spec/features/cancelling_a_whole_plate_spec.rb index b5907df0a..4837eb771 100644 --- a/spec/features/cancelling_a_whole_plate_spec.rb +++ b/spec/features/cancelling_a_whole_plate_spec.rb @@ -20,7 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: end let(:old_api_example_plate) do json :plate, barcode_number: example_plate.labware_barcode.number, uuid: plate_uuid, state: 'passed' @@ -132,7 +132,7 @@ def expect_state_change_create reason: 'Not required', target_state: 'cancelled', target_uuid: plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/features/charge_and_pass_libraries_spec.rb b/spec/features/charge_and_pass_libraries_spec.rb index 26518e966..997902ce5 100644 --- a/spec/features/charge_and_pass_libraries_spec.rb +++ b/spec/features/charge_and_pass_libraries_spec.rb @@ -11,7 +11,7 @@ let(:labware_barcode) { SBCF::SangerBarcode.new(prefix: 'DN', number: 1).machine_barcode.to_s } let(:labware_uuid) { SecureRandom.uuid } let(:work_completion_request) do - { 'work_completion' => { target: labware_uuid, submissions: submissions, user: user_uuid } } + { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } end let(:work_completion) { json :work_completion } let(:template_uuid) { SecureRandom.uuid } @@ -55,8 +55,8 @@ before do create :passable_tube, submission: { - request_options: request_options, - template_uuid: template_uuid + request_options:, + template_uuid: }, uuid: 'example-purpose-uuid' end @@ -74,7 +74,7 @@ payload: { order: { assets: [labware_uuid], - request_options: request_options, + request_options:, user: user_uuid } }, diff --git a/spec/features/creating_a_plate_spec.rb b/spec/features/creating_a_plate_spec.rb index 45676b4f7..6e9bf6084 100644 --- a/spec/features/creating_a_plate_spec.rb +++ b/spec/features/creating_a_plate_spec.rb @@ -29,14 +29,14 @@ end let(:example_plate) do - create :v2_stock_plate, barcode_number: 6, uuid: plate_uuid, wells: wells, purpose_name: 'Limber Cherrypicked' + create :v2_stock_plate, barcode_number: 6, uuid: plate_uuid, wells:, purpose_name: 'Limber Cherrypicked' end let(:another_plate) do create :v2_stock_plate, barcode_number: 106, uuid: another_plate_uuid, - wells: wells, + wells:, purpose_name: 'Limber Cherrypicked' end @@ -44,7 +44,7 @@ create :v2_stock_plate, barcode_number: 107, uuid: another_plate_uuid, - wells: wells, + wells:, purpose_name: alternative_purpose_name end @@ -73,7 +73,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -97,7 +97,7 @@ # Set-up the plate config create :purpose_config, uuid: example_plate.purpose.uuid create(:purpose_config, name: child_purpose_name, uuid: 'child-purpose-0') - create(:pipeline, relationships: { 'Limber Cherrypicked' => child_purpose_name }, filters: filters) + create(:pipeline, relationships: { 'Limber Cherrypicked' => child_purpose_name }, filters:) # We look up the user stub_swipecard_search(user_swipecard, user) diff --git a/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb b/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb index 51ee784bd..928979609 100644 --- a/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb +++ b/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb @@ -51,7 +51,7 @@ parents: [parent_uuid, parent2_uuid] } }, - body: json(:plate_creation, child_uuid: child_uuid) + body: json(:plate_creation, child_uuid:) ) end @@ -86,7 +86,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/features/creating_a_tag_plate_spec.rb b/spec/features/creating_a_tag_plate_spec.rb index b319045bc..2ca63e57e 100644 --- a/spec/features/creating_a_tag_plate_spec.rb +++ b/spec/features/creating_a_tag_plate_spec.rb @@ -49,10 +49,10 @@ background do # Set-up the plate config create :purpose_config, uuid: 'stock-plate-purpose-uuid', name: 'Limber Cherrypicked' - create :tagged_purpose_config, + create(:tagged_purpose_config, tag_layout_templates: acceptable_templates, uuid: child_purpose_uuid, - enforce_same_template_within_pool: enforce_same_template_within_pool + enforce_same_template_within_pool:) create :pipeline, relationships: { 'Limber Cherrypicked' => 'Tag Purpose' } # We look up the user @@ -85,10 +85,10 @@ 'Transfer', [ { - user_uuid: user_uuid, + user_uuid:, source_uuid: plate_uuid, destination_uuid: tag_plate_uuid, - transfer_template_uuid: transfer_template_uuid, + transfer_template_uuid:, transfers: expected_transfers } ] @@ -232,7 +232,7 @@ let(:direction) { 'column' } let(:templates) do - create_list(template_factory, 2, direction: direction) do |template, i| + create_list(template_factory, 2, direction:) do |template, i| template.uuid = "tag-layout-template-#{i}" template.name = "Tag2 layout #{i}" end @@ -247,7 +247,7 @@ let(:direction) { 'row' } let(:templates) do - create_list(template_factory, 2, direction: direction) do |template, i| + create_list(template_factory, 2, direction:) do |template, i| template.uuid = "tag-layout-template-#{i}" template.name = "Tag2 layout #{i}" end diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index d7625dd66..e080127fa 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -75,7 +75,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/features/failing_a_whole_plate_spec.rb b/spec/features/failing_a_whole_plate_spec.rb index 22f2c8cf1..36c86eac4 100644 --- a/spec/features/failing_a_whole_plate_spec.rb +++ b/spec/features/failing_a_whole_plate_spec.rb @@ -20,7 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: end let(:old_api_example_plate) do json :plate, barcode_number: example_plate.labware_barcode.number, uuid: plate_uuid, state: 'passed' @@ -132,7 +132,7 @@ def expect_state_change_create reason: 'Power failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/features/failing_quadrants_spec.rb b/spec/features/failing_quadrants_spec.rb index 35765001a..d063e42e2 100644 --- a/spec/features/failing_quadrants_spec.rb +++ b/spec/features/failing_quadrants_spec.rb @@ -24,7 +24,7 @@ uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', - wells: wells, + wells:, size: 384 end @@ -35,7 +35,7 @@ reason: 'Individual Well Failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: user_uuid + user_uuid: } end diff --git a/spec/features/failing_thresholds_spec.rb b/spec/features/failing_thresholds_spec.rb index bfc838692..75d62c2a9 100644 --- a/spec/features/failing_thresholds_spec.rb +++ b/spec/features/failing_thresholds_spec.rb @@ -22,7 +22,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: end # Setup stubs @@ -58,7 +58,7 @@ reason: 'Individual Well Failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/features/failing_wells_spec.rb b/spec/features/failing_wells_spec.rb index f7072b5c4..a14c1d59e 100644 --- a/spec/features/failing_wells_spec.rb +++ b/spec/features/failing_wells_spec.rb @@ -20,7 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: end # Setup stubs @@ -57,7 +57,7 @@ reason: 'Individual Well Failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/features/plate_transfer_spec.rb b/spec/features/plate_transfer_spec.rb index 5aac74c18..83da34d9f 100644 --- a/spec/features/plate_transfer_spec.rb +++ b/spec/features/plate_transfer_spec.rb @@ -35,7 +35,7 @@ purpose_uuid: 'lb_end_prep_uuid', state: 'started', barcode_number: 1, - custom_metadatum_collection: custom_metadatum_collection + custom_metadatum_collection: end let(:settings) { YAML.load_file(Rails.root.join('spec/data/settings.yml')).with_indifferent_access } @@ -56,7 +56,7 @@ reason: 'Robot bravo LB Post Shear => LB End Prep started', target_state: 'started', target_uuid: plate_uuid, - user_uuid: user_uuid + user_uuid: } end diff --git a/spec/features/pool_tubes_at_end_of_pipeline_spec.rb b/spec/features/pool_tubes_at_end_of_pipeline_spec.rb index 01f71b4f6..df8339a24 100644 --- a/spec/features/pool_tubes_at_end_of_pipeline_spec.rb +++ b/spec/features/pool_tubes_at_end_of_pipeline_spec.rb @@ -46,8 +46,8 @@ expect_api_v2_posts( 'Transfer', [ - { user_uuid: user_uuid, source_uuid: tube_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' }, - { user_uuid: user_uuid, source_uuid: sibling_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' } + { user_uuid:, source_uuid: tube_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' }, + { user_uuid:, source_uuid: sibling_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' } ], create_list(:v2_transfer_between_tubes, 2, destination_uuid: multiplexed_library_tube_uuid) ) diff --git a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb index 73937a3d7..04cb0e4cb 100644 --- a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb @@ -136,8 +136,8 @@ 'Transfer', [plate_uuid, plate_uuid_2].map do |source_uuid| { - user_uuid: user_uuid, - source_uuid: source_uuid, + user_uuid:, + source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } diff --git a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb index a877b28cb..ce4e25992 100644 --- a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb @@ -40,7 +40,7 @@ uuid: tube_uuid, purpose_name: parent_purpose_name, aliquots: aliquot_set_1, - stock_plate: stock_plate, + stock_plate:, parents: [parent_1] end let(:example_tube) { json(*example_tube_args) } @@ -59,7 +59,7 @@ uuid: tube_uuid_2, purpose_name: parent_purpose_name, aliquots: aliquot_set_2, - stock_plate: stock_plate, + stock_plate:, parents: [parent_2] end let(:example_tube_2_listed) { associated(*example_tube2_args) } @@ -70,8 +70,8 @@ let(:barcodes) { [tube_barcode_1, tube_barcode_2] } let(:child_uuid) { 'tube-0' } - let(:child_tube) { json :tube, purpose_uuid: purpose_uuid, purpose_name: 'Pool tube', uuid: child_uuid } - let(:child_tube_v2) { create :v2_tube, purpose_uuid: purpose_uuid, purpose_name: 'Pool tube', uuid: child_uuid } + let(:child_tube) { json :tube, purpose_uuid:, purpose_name: 'Pool tube', uuid: child_uuid } + let(:child_tube_v2) { create :v2_tube, purpose_uuid:, purpose_name: 'Pool tube', uuid: child_uuid } let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -86,7 +86,7 @@ child_purpose: purpose_uuid } }, - body: json(:tube_creation, child_uuid: child_uuid) + body: json(:tube_creation, child_uuid:) ) end @@ -173,7 +173,7 @@ uuid: purpose_uuid, name: 'Pool tube', submission: { - template_uuid: template_uuid, + template_uuid:, options: { read_length: 150 } diff --git a/spec/features/viewing_a_plate_spec.rb b/spec/features/viewing_a_plate_spec.rb index 253f643a1..222acfb29 100644 --- a/spec/features/viewing_a_plate_spec.rb +++ b/spec/features/viewing_a_plate_spec.rb @@ -15,11 +15,11 @@ create :v2_stock_plate, uuid: plate_uuid, barcode_number: 1, - state: state, + state:, wells: wells_collection, - purpose_uuid: purpose_uuid + purpose_uuid: end - let(:wells_collection) { %w[A1 B1].map { |loc| create(:v2_well, state: state, position: { 'name' => loc }) } } + let(:wells_collection) { %w[A1 B1].map { |loc| create(:v2_well, state:, position: { 'name' => loc }) } } let(:printer_list) { create_list(:v2_tube_barcode_printer, 2) + create_list(:v2_plate_barcode_printer, 2) } let(:default_tube_printer) { printer_list.first.name } let(:purpose_config) { create :purpose_config, uuid: purpose_uuid } @@ -80,7 +80,7 @@ feature 'with a suboptimal well' do let(:wells_collection) do - %w[A1 B1].map { |loc| create(:v2_well, state: state, location: loc, aliquot_factory: :v2_suboptimal_aliquot) } + %w[A1 B1].map { |loc| create(:v2_well, state:, location: loc, aliquot_factory: :v2_suboptimal_aliquot) } end scenario 'there is a warning' do fill_in_swipecard_and_barcode user_swipecard, plate_barcode diff --git a/spec/helpers/barcode_labels_helper_spec.rb b/spec/helpers/barcode_labels_helper_spec.rb index 8f86888b4..4fabe3f3d 100644 --- a/spec/helpers/barcode_labels_helper_spec.rb +++ b/spec/helpers/barcode_labels_helper_spec.rb @@ -23,18 +23,18 @@ it 'renders a partial' do barcode_printing_form( - labels: labels, - redirection_url: redirection_url, - default_printer_name: default_printer_name + labels:, + redirection_url:, + default_printer_name: ) expect(rendered).to be_truthy end it 'has the right locals set' do barcode_printing_form( - labels: labels, - redirection_url: redirection_url, - default_printer_name: default_printer_name + labels:, + redirection_url:, + default_printer_name: ) printer_types = labels.map(&:printer_type) diff --git a/spec/helpers/plate_helpers_spec.rb b/spec/helpers/plate_helpers_spec.rb index 138403b18..df6be63cc 100644 --- a/spec/helpers/plate_helpers_spec.rb +++ b/spec/helpers/plate_helpers_spec.rb @@ -67,7 +67,7 @@ end let(:plate_for_precap) do - build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: outer_requests + build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: end let(:expected_result) do diff --git a/spec/models/labels/plate_label_96_lysate_spec.rb b/spec/models/labels/plate_label_96_lysate_spec.rb index 59dcead95..9434c821a 100644 --- a/spec/models/labels/plate_label_96_lysate_spec.rb +++ b/spec/models/labels/plate_label_96_lysate_spec.rb @@ -9,8 +9,8 @@ # current partner ids have the format ABCD_123 i.e. 4 characters, an underscore, and 3 numbers let(:partner_id) { 'ABCD_123' } let(:sample_metadata) { create :v2_sample_metadata, sample_description: partner_id } - let(:sample) { create(:v2_sample, sample_metadata: sample_metadata) } - let(:aliquot) { create :v2_aliquot, sample: sample } + let(:sample) { create(:v2_sample, sample_metadata:) } + let(:aliquot) { create :v2_aliquot, sample: } let(:well_c6) { create(:v2_well, position: { 'name' => 'C6' }, aliquots: [aliquot]) } let(:labware) { create :v2_plate, wells: [well_c6] } diff --git a/spec/models/labware_creators/baited_plate_spec.rb b/spec/models/labware_creators/baited_plate_spec.rb index 798f39901..a0cc82a88 100644 --- a/spec/models/labware_creators/baited_plate_spec.rb +++ b/spec/models/labware_creators/baited_plate_spec.rb @@ -21,7 +21,7 @@ let(:transfer_template_uuid) { 'custom-pooling' } let(:transfer_template) { json :transfer_template, uuid: transfer_template_uuid } - let(:form_attributes) { { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid: } } let(:transfer_requests) do WellHelpers.column_order(96)[0, 6].map do |well_name| @@ -87,7 +87,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/cardinal_pools_plate_spec.rb b/spec/models/labware_creators/cardinal_pools_plate_spec.rb index 20704658f..54943dbf2 100644 --- a/spec/models/labware_creators/cardinal_pools_plate_spec.rb +++ b/spec/models/labware_creators/cardinal_pools_plate_spec.rb @@ -16,7 +16,7 @@ let(:child_uuid) { 'example-dest-uuid' } let(:child_plate) { create(:v2_plate, uuid: child_uuid, well_count: plate_size) } - let(:form_attributes) { { purpose_uuid: dest_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: dest_purpose_uuid, parent_uuid:, user_uuid: } } let(:dummy_v1_plate) { create(:plate, uuid: parent_uuid) } diff --git a/spec/models/labware_creators/concentration_binned_plate_spec.rb b/spec/models/labware_creators/concentration_binned_plate_spec.rb index 34072a6ae..faba3bdef 100644 --- a/spec/models/labware_creators/concentration_binned_plate_spec.rb +++ b/spec/models/labware_creators/concentration_binned_plate_spec.rb @@ -85,10 +85,10 @@ let(:user_uuid) { 'user-uuid' } before do - create :concentration_binning_purpose_config, + create(:concentration_binning_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, - library_type_name: library_type_name + library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, @@ -98,7 +98,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::ConcentrationBinnedPlate.new(api, form_attributes) } diff --git a/spec/models/labware_creators/concentration_normalised_plate_spec.rb b/spec/models/labware_creators/concentration_normalised_plate_spec.rb index 009b8e168..dfb7dcd44 100644 --- a/spec/models/labware_creators/concentration_normalised_plate_spec.rb +++ b/spec/models/labware_creators/concentration_normalised_plate_spec.rb @@ -57,7 +57,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::ConcentrationNormalisedPlate.new(api, form_attributes) } @@ -106,7 +106,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/custom_pooled_tubes_spec.rb b/spec/models/labware_creators/custom_pooled_tubes_spec.rb index c9ed9f2e9..5545c6188 100644 --- a/spec/models/labware_creators/custom_pooled_tubes_spec.rb +++ b/spec/models/labware_creators/custom_pooled_tubes_spec.rb @@ -25,7 +25,7 @@ let(:parent_uuid) { SecureRandom.uuid } let(:parent) { json :plate, uuid: parent_uuid, stock_plate_barcode: 5, qc_files_actions: %w[read create] } let(:v2_plate) { create(:v2_plate, uuid: parent_uuid) } - let(:form_attributes) { { purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { purpose_uuid:, parent_uuid: } } let(:wells_json) { json :well_collection, size: 16, default_state: 'passed' } @@ -53,7 +53,7 @@ content end - let(:form_attributes) { { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid, file: file } } + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, file: } } let(:stub_qc_file_creation) do stub_request(:post, api_url_for(parent_uuid, 'qc_files')) diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 4c605f864..4db2cfda0 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -103,7 +103,7 @@ 'pooled_plate_creations', payload: { pooled_plate_creation: { - parents: parents, + parents:, child_purpose: child_purpose_uuid, user: user_uuid } @@ -119,10 +119,10 @@ def expect_transfer_creation 'Transfer', [ { - user_uuid: user_uuid, + user_uuid:, source_uuid: plate_uuid, destination_uuid: child_plate_uuid, - transfer_template_uuid: transfer_template_uuid, + transfer_template_uuid:, transfers: expected_transfers } ] @@ -137,7 +137,7 @@ def expect_state_change_creation reason: 'Used in Library creation', target_uuid: tag_plate_uuid, target_state: 'exhausted', - user_uuid: user_uuid + user_uuid: } ] ) @@ -150,7 +150,7 @@ def expect_state_change_creation { purpose_uuid: child_purpose_uuid, parent_uuid: plate_uuid, - user_uuid: user_uuid, + user_uuid:, tag_plate: { asset_uuid: tag_plate_uuid, template_uuid: tag_template_uuid, diff --git a/spec/models/labware_creators/donor_pooling_spec.rb b/spec/models/labware_creators/donor_pooling_spec.rb index 015c83c88..f1cea5e51 100644 --- a/spec/models/labware_creators/donor_pooling_spec.rb +++ b/spec/models/labware_creators/donor_pooling_spec.rb @@ -56,7 +56,7 @@ # This is the form that includes plate barcodes, submitted by user. let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid: parent_1_plate_uuid, barcodes: barcodes, user_uuid: user_uuid } + { purpose_uuid: child_purpose_uuid, parent_uuid: parent_1_plate_uuid, barcodes:, user_uuid: } end let(:barcodes) { source_plates.map(&:human_barcode) } @@ -70,7 +70,7 @@ create( :donor_pooling_plate_purpose_config, uuid: child_purpose_uuid, - default_number_of_pools: default_number_of_pools + default_number_of_pools: ) # Allow the API call to return two plates by default. diff --git a/spec/models/labware_creators/final_tube_from_plate_spec.rb b/spec/models/labware_creators/final_tube_from_plate_spec.rb index 371189bcb..bea569281 100644 --- a/spec/models/labware_creators/final_tube_from_plate_spec.rb +++ b/spec/models/labware_creators/final_tube_from_plate_spec.rb @@ -16,7 +16,7 @@ let(:parent_uuid) { SecureRandom.uuid } let(:parent) { json :plate, uuid: parent_uuid, pool_sizes: [3, 3] } - let(:form_attributes) { { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid: } } context '#save!' do has_a_working_api @@ -37,7 +37,7 @@ 'Transfer', [ { - user_uuid: user_uuid, + user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' } @@ -52,8 +52,8 @@ expect_api_v2_posts( 'StateChange', [ - { target_state: 'passed', target_uuid: destination_tubes[0].uuid, user_uuid: user_uuid }, - { target_state: 'passed', target_uuid: destination_tubes[1].uuid, user_uuid: user_uuid } + { target_state: 'passed', target_uuid: destination_tubes[0].uuid, user_uuid: }, + { target_state: 'passed', target_uuid: destination_tubes[1].uuid, user_uuid: } ] ) diff --git a/spec/models/labware_creators/final_tube_spec.rb b/spec/models/labware_creators/final_tube_spec.rb index b2264a865..4368ce2e2 100644 --- a/spec/models/labware_creators/final_tube_spec.rb +++ b/spec/models/labware_creators/final_tube_spec.rb @@ -23,7 +23,7 @@ let(:transfer_template_uuid) { 'tube-to-tube-by-sub' } # Defined in spec_helper.rb let(:transfer) { create :v2_transfer } - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } context 'with a sibling-less parent tube' do let(:tube_json) { json(:tube_without_siblings, uuid: parent_uuid) } @@ -32,7 +32,7 @@ it 'should be vaild' do expect_api_v2_posts( 'Transfer', - [{ user_uuid: user_uuid, source_uuid: parent_uuid, transfer_template_uuid: transfer_template_uuid }], + [{ user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: }], [transfer] ) @@ -65,12 +65,12 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, + parent_uuid:, parents: { '3980000001795' => '1', '1234567890123' => '1' }, - user_uuid: user_uuid + user_uuid: } end @@ -81,8 +81,8 @@ expect_api_v2_posts( 'Transfer', [ - { user_uuid: user_uuid, source_uuid: parent_uuid, transfer_template_uuid: transfer_template_uuid }, - { user_uuid: user_uuid, source_uuid: sibling_uuid, transfer_template_uuid: transfer_template_uuid } + { user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: }, + { user_uuid:, source_uuid: sibling_uuid, transfer_template_uuid: } ], [transfer, transfer_b] ) diff --git a/spec/models/labware_creators/fixed_normalised_plate_spec.rb b/spec/models/labware_creators/fixed_normalised_plate_spec.rb index aad996d2e..521c84180 100644 --- a/spec/models/labware_creators/fixed_normalised_plate_spec.rb +++ b/spec/models/labware_creators/fixed_normalised_plate_spec.rb @@ -85,10 +85,10 @@ let(:user_uuid) { 'user-uuid' } before do - create :fixed_normalisation_purpose_config, + create(:fixed_normalisation_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, - library_type_name: library_type_name + library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( @@ -99,7 +99,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::FixedNormalisedPlate.new(api, form_attributes) } diff --git a/spec/models/labware_creators/merged_plate_spec.rb b/spec/models/labware_creators/merged_plate_spec.rb index 987c79ff7..f80d4481c 100644 --- a/spec/models/labware_creators/merged_plate_spec.rb +++ b/spec/models/labware_creators/merged_plate_spec.rb @@ -75,7 +75,7 @@ stub_v2_plate(source_plate_2, stub_search: false) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: source_plate_1.uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: source_plate_1.uuid, user_uuid: } } shared_examples 'a merged plate creator' do describe '#save!' do @@ -110,7 +110,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -130,8 +130,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, barcodes: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] } end @@ -193,8 +193,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, barcodes: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] } end @@ -235,8 +235,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, barcodes: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] } end @@ -264,8 +264,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, barcodes: [source_plate_1.barcode.machine, ''] } end @@ -294,8 +294,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, barcodes: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] } end @@ -334,8 +334,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, barcodes: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] } end diff --git a/spec/models/labware_creators/multi_plate_pool_spec.rb b/spec/models/labware_creators/multi_plate_pool_spec.rb index adcca6f6e..f08bc3943 100644 --- a/spec/models/labware_creators/multi_plate_pool_spec.rb +++ b/spec/models/labware_creators/multi_plate_pool_spec.rb @@ -53,7 +53,7 @@ end context 'on create' do - subject { LabwareCreators::MultiPlatePool.new(api, form_attributes.merge(user_uuid: user_uuid)) } + subject { LabwareCreators::MultiPlatePool.new(api, form_attributes.merge(user_uuid:)) } let(:plate_b_uuid) { 'example-plate-b-uuid' } let(:plate_b_barcode) { SBCF::SangerBarcode.new(prefix: 'DN', number: 2).machine_barcode.to_s } diff --git a/spec/models/labware_creators/multi_stamp_spec.rb b/spec/models/labware_creators/multi_stamp_spec.rb index b7126d1c5..a875726c8 100644 --- a/spec/models/labware_creators/multi_stamp_spec.rb +++ b/spec/models/labware_creators/multi_stamp_spec.rb @@ -77,7 +77,7 @@ end context 'on create' do - subject { LabwareCreators::MultiStamp.new(api, form_attributes.merge(user_uuid: user_uuid)) } + subject { LabwareCreators::MultiStamp.new(api, form_attributes.merge(user_uuid:)) } let(:form_attributes) do { @@ -484,7 +484,7 @@ parents: [parent1_uuid, parent2_uuid] } }, - body: json(:plate_creation, child_uuid: child_uuid) + body: json(:plate_creation, child_uuid:) ) end @@ -547,7 +547,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/multi_stamp_tubes_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_spec.rb index 9cb244efa..a32ee3206 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_spec.rb @@ -73,7 +73,7 @@ end context 'on create' do - subject { LabwareCreators::MultiStampTubes.new(api, form_attributes.merge(user_uuid: user_uuid)) } + subject { LabwareCreators::MultiStampTubes.new(api, form_attributes.merge(user_uuid:)) } let(:form_attributes) do { @@ -96,7 +96,7 @@ parents: [parent1_tube_uuid, parent2_tube_uuid] } }, - body: json(:plate_creation, child_uuid: child_uuid) + body: json(:plate_creation, child_uuid:) ) end @@ -113,7 +113,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -201,7 +201,7 @@ 'custom_metadatum_collection-uuid', payload: { custom_metadatum_collection: { - metadata: metadata + metadata: } }, body: json(:v1_custom_metadatum_collection) diff --git a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb index e0d46906c..00e0975b1 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb @@ -191,7 +191,7 @@ context '#save when everything is valid' do let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } + { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } end let!(:ms_plate_creation_request) do @@ -204,7 +204,7 @@ parents: [parent_tube_1_uuid, parent_tube_2_uuid] } }, - body: json(:plate_creation, child_plate_uuid: child_plate_uuid) + body: json(:plate_creation, child_plate_uuid:) ) end @@ -221,7 +221,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -253,7 +253,7 @@ end let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } + { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } @@ -278,7 +278,7 @@ end let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } + { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } @@ -302,7 +302,7 @@ context 'when a tube is not of expected purpose type' do let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } + { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } end let(:parent_tube_2_purpose_uuid) { 'parent-tube-purpose-type-unknown-uuid' } @@ -323,7 +323,7 @@ context 'when a tube does not have an active request of the expected type' do let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } + { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } end let(:request_type_2) { create :request_type, key: 'unrelated_request_type_key' } @@ -361,7 +361,7 @@ end let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } + { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } @@ -390,7 +390,7 @@ end let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } + { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } diff --git a/spec/models/labware_creators/normalised_binned_plate_spec.rb b/spec/models/labware_creators/normalised_binned_plate_spec.rb index d8936c495..158dcee46 100644 --- a/spec/models/labware_creators/normalised_binned_plate_spec.rb +++ b/spec/models/labware_creators/normalised_binned_plate_spec.rb @@ -85,10 +85,10 @@ let(:user_uuid) { 'user-uuid' } before do - create :normalised_binning_purpose_config, + create(:normalised_binning_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, - library_type_name: library_type_name + library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, @@ -98,7 +98,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::NormalisedBinnedPlate.new(api, form_attributes) } diff --git a/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb b/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb index 099318f8e..351f20159 100644 --- a/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb +++ b/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb @@ -81,8 +81,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, filters: { request_type_key: well_d1.requests_as_source[1].request_type.key, # Standard library_type: well_d1.requests_as_source[1].library_type # library-type-2 diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb index 641b0964f..b702bcba3 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb @@ -256,7 +256,7 @@ context 'on new' do has_a_working_api - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: } } it 'can be created' do expect(subject).to be_a LabwareCreators::PcrCyclesBinnedPlateForDuplexSeq @@ -273,7 +273,7 @@ end let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid, file: file } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } end let(:stub_upload_file_creation) do @@ -299,10 +299,10 @@ before do stub_parent_request - create :duplex_seq_customer_csv_file_upload_purpose_config, + create(:duplex_seq_customer_csv_file_upload_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, - library_type_name: library_type_name + library_type_name:) stub_v2_plate( parent_plate, @@ -440,7 +440,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb index b84cd48ce..15cfa9180 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb @@ -292,7 +292,7 @@ context 'on new' do has_a_working_api - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: } } it 'can be created' do expect(subject).to be_a LabwareCreators::PcrCyclesBinnedPlateForTNanoSeq @@ -309,7 +309,7 @@ end let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid, file: file } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } end let(:stub_upload_file_creation) do @@ -478,7 +478,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -840,7 +840,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -1196,7 +1196,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -1559,7 +1559,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 98622ea45..6dfe9e4d5 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -39,11 +39,11 @@ # submission requests let(:request_type) { create :request_type, key: 'rt_1' } - let(:request_a) { create :library_request, request_type: request_type, uuid: 'request-a1', submission_id: '2' } - let(:request_b) { create :library_request, request_type: request_type, uuid: 'request-a2', submission_id: '2' } - let(:request_c) { create :library_request, request_type: request_type, uuid: 'request-a3', submission_id: '2' } - let(:request_d) { create :library_request, request_type: request_type, uuid: 'request-b1', submission_id: '2' } - let(:request_e) { create :library_request, request_type: request_type, uuid: 'request-b2', submission_id: '2' } + let(:request_a) { create :library_request, request_type:, uuid: 'request-a1', submission_id: '2' } + let(:request_b) { create :library_request, request_type:, uuid: 'request-a2', submission_id: '2' } + let(:request_c) { create :library_request, request_type:, uuid: 'request-a3', submission_id: '2' } + let(:request_d) { create :library_request, request_type:, uuid: 'request-b1', submission_id: '2' } + let(:request_e) { create :library_request, request_type:, uuid: 'request-b2', submission_id: '2' } # parent aliquots let(:parent_aliquot_sample1_aliquot1) { create(:v2_aliquot, sample: sample1, outer_request: request_a) } @@ -113,7 +113,7 @@ # form attributes - required parameters for the labware creator let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: parent_uuid } + { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } end # child tubes for lookup after creation @@ -268,10 +268,10 @@ context 'when require_sequencing_tubes_only? is true' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file + parent_uuid:, + sequencing_file: } end @@ -311,11 +311,11 @@ context 'when require_sequencing_tubes_only? is false' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file, - contingency_file: contingency_file + parent_uuid:, + sequencing_file:, + contingency_file: } end @@ -395,11 +395,11 @@ context 'when a file is not correctly parsed' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file, - contingency_file: contingency_file + parent_uuid:, + sequencing_file:, + contingency_file: } end @@ -424,11 +424,11 @@ context 'when the files are the same' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid: parent_uuid, + parent_uuid:, sequencing_file: contingency_file, - contingency_file: contingency_file + contingency_file: } end @@ -456,11 +456,11 @@ context 'when the tube rack barcodes are the same' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file, - contingency_file: contingency_file + parent_uuid:, + sequencing_file:, + contingency_file: } end @@ -520,11 +520,11 @@ context 'when a file is not correctly parsed' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file, - contingency_file: contingency_file + parent_uuid:, + sequencing_file:, + contingency_file: } end @@ -556,11 +556,11 @@ context 'when there are duplicate tube barcodes between files' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file, - contingency_file: contingency_file + parent_uuid:, + sequencing_file:, + contingency_file: } end let(:seq_tube_details) do @@ -605,7 +605,7 @@ let(:tube_rack_barcode) { 'TR00000001' } let(:tube_details) { { 'tube_barcode' => foreign_barcode, 'tube_rack_barcode' => tube_rack_barcode } } let(:msg_prefix) { 'Sequencing' } - let(:existing_tube) { create(:v2_tube, state: 'passed', barcode_number: 1, foreign_barcode: foreign_barcode) } + let(:existing_tube) { create(:v2_tube, state: 'passed', barcode_number: 1, foreign_barcode:) } before { allow(tube_rack_file).to receive(:position_details).and_return({ tube_posn => tube_details }) } @@ -658,11 +658,11 @@ context 'with both sequencing and contingency files' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file, - contingency_file: contingency_file + parent_uuid:, + sequencing_file:, + contingency_file: } end @@ -1015,10 +1015,10 @@ context 'with just a sequencing file' do let(:form_attributes) do { - user_uuid: user_uuid, + user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, - parent_uuid: parent_uuid, - sequencing_file: sequencing_file + parent_uuid:, + sequencing_file: } end diff --git a/spec/models/labware_creators/plate_with_primer_panel_spec.rb b/spec/models/labware_creators/plate_with_primer_panel_spec.rb index 4f9c6d4c7..9f447d4ff 100644 --- a/spec/models/labware_creators/plate_with_primer_panel_spec.rb +++ b/spec/models/labware_creators/plate_with_primer_panel_spec.rb @@ -31,7 +31,7 @@ end let(:child) { create :v2_plate_with_primer_panels, barcode_number: '3', size: plate_size, uuid: 'child-uuid' } - let(:form_attributes) { { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid: } } before { create :purpose_config, pcr_stage: 'pcr 1', uuid: purpose_uuid } @@ -93,7 +93,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/plate_with_template_spec.rb b/spec/models/labware_creators/plate_with_template_spec.rb index 3a19bd859..4cf1c9595 100644 --- a/spec/models/labware_creators/plate_with_template_spec.rb +++ b/spec/models/labware_creators/plate_with_template_spec.rb @@ -30,7 +30,7 @@ stub_api_get(parent_uuid, 'wells', body: wells) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::PlateWithTemplate.new(api, form_attributes) } @@ -62,10 +62,10 @@ 'Transfer', [ { - user_uuid: user_uuid, + user_uuid:, source_uuid: parent_uuid, destination_uuid: 'child-uuid', - transfer_template_uuid: transfer_template_uuid + transfer_template_uuid: } ] ) diff --git a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb index f358503a5..afb59b546 100644 --- a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb @@ -24,7 +24,7 @@ let(:parent) { json :plate, uuid: parent_uuid, pool_sizes: [3, 6], stock_plate_barcode: 5, for_multiplexing: true } let(:source_plate) { create :v2_plate, uuid: parent_uuid } - let(:form_attributes) { { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid: } } let(:wells_json) { json :well_collection, size: 9, default_state: 'passed' } @@ -98,7 +98,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb index e5ce80273..ac223c108 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb @@ -43,14 +43,14 @@ it_behaves_like 'it has a custom page', 'pooled_tubes_from_whole_plates' has_a_working_api - let(:form_attributes) { { purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { purpose_uuid:, parent_uuid: } } end describe '#save!' do has_a_working_api let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid, barcodes: barcodes } + { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } end let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -91,8 +91,8 @@ 'Transfer', [parent_uuid, parent2_uuid, parent3_uuid, parent4_uuid].map do |source_uuid| { - user_uuid: user_uuid, - source_uuid: source_uuid, + user_uuid:, + source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb index 2530a67af..67117c8f1 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb @@ -34,7 +34,7 @@ before do create :purpose_config, submission: { - template_uuid: template_uuid, + template_uuid:, request_options: { read_length: 150 } @@ -46,14 +46,14 @@ it_behaves_like 'it has a custom page', 'pooled_tubes_from_whole_tubes' has_a_working_api - let(:form_attributes) { { purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:form_attributes) { { purpose_uuid:, parent_uuid: } } end describe '#save!' do has_a_working_api let(:form_attributes) do - { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid, barcodes: barcodes } + { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } end let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -69,7 +69,7 @@ child_purpose: purpose_uuid } }, - body: json(:tube_creation, child_uuid: child_uuid) + body: json(:tube_creation, child_uuid:) ) end diff --git a/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb b/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb index 1e01eb37b..4cddb613b 100644 --- a/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb +++ b/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb @@ -23,7 +23,7 @@ end # Attributes for initialising the labware creator - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_plate_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_plate_uuid, user_uuid: } } # Child plate assumed to be created let(:child_plate) { create(:v2_plate, uuid: child_plate_uuid) } diff --git a/spec/models/labware_creators/quadrant_split_plate_spec.rb b/spec/models/labware_creators/quadrant_split_plate_spec.rb index 353e79369..3db6aa215 100644 --- a/spec/models/labware_creators/quadrant_split_plate_spec.rb +++ b/spec/models/labware_creators/quadrant_split_plate_spec.rb @@ -136,7 +136,7 @@ stub_v2_plate(plate, stub_search: false) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::QuadrantSplitPlate.new(api, form_attributes) } @@ -173,7 +173,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index 3e56ef4dc..34a41d541 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -75,7 +75,7 @@ end context 'on create' do - subject { LabwareCreators::QuadrantStampPrimerPanel.new(api, form_attributes.merge(user_uuid: user_uuid)) } + subject { LabwareCreators::QuadrantStampPrimerPanel.new(api, form_attributes.merge(user_uuid:)) } let(:form_attributes) do { @@ -256,7 +256,7 @@ parents: [parent1_uuid, parent2_uuid] } }, - body: json(:plate_creation, child_uuid: child_uuid) + body: json(:plate_creation, child_uuid:) ) end @@ -291,7 +291,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -318,7 +318,7 @@ 'custom_metadatum_collection-uuid', payload: { custom_metadatum_collection: { - metadata: metadata + metadata: } }, body: json(:v1_custom_metadatum_collection) diff --git a/spec/models/labware_creators/shared_examples.rb b/spec/models/labware_creators/shared_examples.rb index 393b5c2ca..26d4e814b 100644 --- a/spec/models/labware_creators/shared_examples.rb +++ b/spec/models/labware_creators/shared_examples.rb @@ -154,7 +154,7 @@ end context 'with a previously passed library and a new repool' do - let(:parent) { build :plate, pools: pools } + let(:parent) { build :plate, pools: } let(:tagged) { true } before { expect(parent).to receive(:tagged?).and_return(tagged) } let(:pools) do @@ -257,7 +257,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' diff --git a/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb b/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb index 5356b3b8f..58e9ba63f 100644 --- a/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb +++ b/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb @@ -100,7 +100,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name: control_study_name + control_study_name: ) stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) stub_v2_plate(parent_plate_v2, stub_search: false, custom_includes: parent_plate_includes) @@ -108,7 +108,7 @@ stub_v2_project(control_project) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::StampedPlateAddingRandomisedControls.new(api, form_attributes) } @@ -140,7 +140,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -235,7 +235,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name: control_study_name, + control_study_name:, controls: [ { control_type: 'pcr positive', name_prefix: 'CONTROL_POS_', fixed_location: 'G12' }, { control_type: 'pcr negative', name_prefix: 'CONTROL_NEG_' } @@ -271,7 +271,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name: control_study_name, + control_study_name:, control_location_rules: [{ type: 'not', value: %w[H1 G1] }] ) end @@ -299,7 +299,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name: control_study_name, + control_study_name:, control_location_rules: [{ type: 'well_exclusions', value: %w[H10 H11 H12] }] ) end diff --git a/spec/models/labware_creators/stamped_plate_compressed_spec.rb b/spec/models/labware_creators/stamped_plate_compressed_spec.rb index 77acbb3bf..4e1f98304 100644 --- a/spec/models/labware_creators/stamped_plate_compressed_spec.rb +++ b/spec/models/labware_creators/stamped_plate_compressed_spec.rb @@ -66,8 +66,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, filters: { request_type_key: parent_well_b1.requests_as_source[0].request_type.key, # Standard library_type: parent_well_b1.requests_as_source[0].library_type # library-type-1 diff --git a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb index 1282c83a2..4e60fcc14 100644 --- a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb +++ b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb @@ -17,14 +17,14 @@ let(:parent_wells) do locations = WellHelpers.column_order(96, rows: 8, columns: 12) - locations.take(8).map { |location| create(:v2_well, location: location, aliquot_count: 2, state: 'passed') } + locations.take(8).map { |location| create(:v2_well, location:, aliquot_count: 2, state: 'passed') } end let(:parent) { create(:v2_plate, size: 96, uuid: parent_uuid, wells: parent_wells) } let(:child_wells) do locations = WellHelpers.row_order(8, rows: 1, columns: 8) - locations.take(8).map { |location| create(:v2_well, location: location, aliquot_count: 0) } + locations.take(8).map { |location| create(:v2_well, location:, aliquot_count: 0) } end let(:child_uuid) { 'child-uuid' } @@ -33,7 +33,7 @@ create(:v2_plate, size: 8, number_of_rows: 1, number_of_columns: 8, wells: child_wells, uuid: child_uuid) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { described_class.new(api, form_attributes) } @@ -91,7 +91,7 @@ let(:expect_transfer_requests) do expect(api).to receive_message_chain(:transfer_request_collection, :create!).with( user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: ) subject.save! end @@ -127,7 +127,7 @@ context 'when there are more source wells than the child plate size' do let(:parent_wells) do locations = WellHelpers.column_order(96, rows: 8, columns: 12) - locations.take(9).map { |location| create(:v2_well, location: location, aliquot_count: 2, state: 'passed') } + locations.take(9).map { |location| create(:v2_well, location:, aliquot_count: 2, state: 'passed') } end it 'reports the error' do diff --git a/spec/models/labware_creators/stamped_plate_spec.rb b/spec/models/labware_creators/stamped_plate_spec.rb index 77b87a322..29e0fd586 100644 --- a/spec/models/labware_creators/stamped_plate_spec.rb +++ b/spec/models/labware_creators/stamped_plate_spec.rb @@ -33,7 +33,7 @@ stub_v2_plate(plate, stub_search: false) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } subject { LabwareCreators::StampedPlate.new(api, form_attributes) } @@ -65,7 +65,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: transfer_requests + transfer_requests: } }, body: '{}' @@ -119,7 +119,7 @@ end context 'more complicated scenarios' do - let(:plate) { create :v2_plate, uuid: parent_uuid, barcode_number: '2', wells: wells } + let(:plate) { create :v2_plate, uuid: parent_uuid, barcode_number: '2', wells: } context 'with multiple requests of different types' do let(:request_type_a) { create :request_type, key: 'rt_a' } @@ -158,8 +158,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, filters: { request_type_key: [request_type_b.key] } @@ -170,7 +170,7 @@ end context 'when a request_type is not supplied' do - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } it 'raises an exception' do expect { subject.save! }.to raise_error(LabwareCreators::ResourceInvalid) @@ -190,8 +190,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, filters: { library_type: [lib_type_a] } @@ -205,8 +205,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, filters: { request_type_key: [request_type_b.key], library_type: [lib_type_a] @@ -221,8 +221,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid: parent_uuid, - user_uuid: user_uuid, + parent_uuid:, + user_uuid:, filters: { library_type: ['LibTypeB'] } @@ -241,10 +241,10 @@ # We don't specify an outer request, and Sequencescape should just move the aliquots across # as normal. let(:request_type) { create :request_type, key: 'rt_a' } - let(:request_a) { create :library_request, request_type: request_type, uuid: 'request-a', submission_id: '2' } - let(:request_b) { create :library_request, request_type: request_type, uuid: 'request-b', submission_id: '2' } - let(:request_c) { create :library_request, request_type: request_type, uuid: 'request-c', submission_id: '2' } - let(:request_d) { create :library_request, request_type: request_type, uuid: 'request-d', submission_id: '2' } + let(:request_a) { create :library_request, request_type:, uuid: 'request-a', submission_id: '2' } + let(:request_b) { create :library_request, request_type:, uuid: 'request-b', submission_id: '2' } + let(:request_c) { create :library_request, request_type:, uuid: 'request-c', submission_id: '2' } + let(:request_d) { create :library_request, request_type:, uuid: 'request-d', submission_id: '2' } let(:aliquots_a) do [ create(:v2_aliquot, library_state: 'started', outer_request: request_a), @@ -266,7 +266,7 @@ end context 'when a request_type is supplied' do - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } let(:transfer_requests) do [ diff --git a/spec/models/labware_creators/tagged_plate_spec.rb b/spec/models/labware_creators/tagged_plate_spec.rb index 2926c706d..b45b52bd4 100644 --- a/spec/models/labware_creators/tagged_plate_spec.rb +++ b/spec/models/labware_creators/tagged_plate_spec.rb @@ -30,10 +30,10 @@ let(:disable_cross_plate_pool_detection) { false } before do - create :purpose_config, + create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - disable_cross_plate_pool_detection: disable_cross_plate_pool_detection + disable_cross_plate_pool_detection:) plate_request wells_request end @@ -191,8 +191,8 @@ { purpose_uuid: child_purpose_uuid, parent_uuid: plate_uuid, - user_uuid: user_uuid, - tag_plate_barcode: tag_plate_barcode, + user_uuid:, + tag_plate_barcode:, tag_plate: { asset_uuid: tag_plate_uuid, template_uuid: tag_template_uuid @@ -212,10 +212,10 @@ 'Transfer', [ { - user_uuid: user_uuid, + user_uuid:, source_uuid: plate_uuid, destination_uuid: tag_plate_uuid, - transfer_template_uuid: transfer_template_uuid, + transfer_template_uuid:, transfers: expected_transfers } ] @@ -228,7 +228,7 @@ reason: 'Used in Library creation', target_state: 'exhausted', target_uuid: tag_plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/models/labware_creators/tube_from_tube_spec.rb b/spec/models/labware_creators/tube_from_tube_spec.rb index 144cdd1ff..23279244a 100644 --- a/spec/models/labware_creators/tube_from_tube_spec.rb +++ b/spec/models/labware_creators/tube_from_tube_spec.rb @@ -40,7 +40,7 @@ let(:user_uuid) { 'user-uuid' } let(:transfer_template_uuid) { 'transfer-between-specific-tubes' } # Defined in spec_helper.rb - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } let(:creation_request) do stub_api_post( @@ -52,7 +52,7 @@ user: 'user-uuid' } }, - body: json(:tube_creation, child_uuid: child_uuid) + body: json(:tube_creation, child_uuid:) ) end @@ -62,10 +62,10 @@ 'Transfer', [ { - user_uuid: user_uuid, + user_uuid:, source_uuid: parent_uuid, destination_uuid: child_uuid, - transfer_template_uuid: transfer_template_uuid + transfer_template_uuid: } ] ) diff --git a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb index 66e0996c0..6e8a7dcd5 100644 --- a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb +++ b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb @@ -33,7 +33,7 @@ let(:basic_purpose) { 'test-purpose' } let(:labware_creator) do - LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid: parent_uuid) + LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) end let(:request_type_key_a) { 'rt_a' } diff --git a/spec/models/labware_creators/well_filter_spec.rb b/spec/models/labware_creators/well_filter_spec.rb index f34d70143..28c79369c 100644 --- a/spec/models/labware_creators/well_filter_spec.rb +++ b/spec/models/labware_creators/well_filter_spec.rb @@ -33,7 +33,7 @@ let(:basic_purpose) { 'test-purpose' } let(:labware_creator) do - LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid: parent_uuid) + LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) end let(:request_type_key_a) { 'rt_a' } diff --git a/spec/models/labware_metadata_spec.rb b/spec/models/labware_metadata_spec.rb index a1efc0d81..49ac36edf 100644 --- a/spec/models/labware_metadata_spec.rb +++ b/spec/models/labware_metadata_spec.rb @@ -44,7 +44,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata: metadata) + .with(metadata:) .and_return(true) LabwareMetadata.new(labware: plate_with_metadata, user_uuid: user.uuid).update!(updated_metadata) @@ -64,7 +64,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata: metadata) + .with(metadata:) .and_return(true) LabwareMetadata @@ -96,7 +96,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata: metadata) + .with(metadata:) .and_return(true) LabwareMetadata.new(labware: tube_with_metadata, user_uuid: user.uuid).update!(updated_metadata) @@ -116,7 +116,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata: metadata) + .with(metadata:) .and_return(true) LabwareMetadata.new(barcode: tube_with_metadata.barcode.machine, user_uuid: user.uuid).update!(updated_metadata) diff --git a/spec/models/pipeline_list_spec.rb b/spec/models/pipeline_list_spec.rb index 8f9220782..a91599bec 100644 --- a/spec/models/pipeline_list_spec.rb +++ b/spec/models/pipeline_list_spec.rb @@ -10,7 +10,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -19,7 +19,7 @@ name: 'Pipeline A' }, 'Pipeline B' => { - filters: filters, + filters:, library_pass: 'Purpose 4', relationships: { 'Purpose 3' => 'Purpose 4' @@ -27,7 +27,7 @@ name: 'Pipeline B' }, 'Pipeline C' => { - filters: filters, + filters:, library_pass: 'Purpose 5', relationships: { 'Purpose 4' => 'Purpose 5' @@ -49,7 +49,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 2' => 'Purpose 3', @@ -58,7 +58,7 @@ name: 'Pipeline A' }, 'Pipeline B' => { - filters: filters, + filters:, library_pass: 'Purpose 4', relationships: { 'Purpose 3' => 'Purpose 4' @@ -80,7 +80,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 2' => 'Purpose 3', @@ -103,7 +103,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -112,7 +112,7 @@ name: 'Pipeline A' }, 'Pipeline B' => { - filters: filters, + filters:, library_pass: 'Purpose 4', relationships: { 'Purpose 2' => 'Purpose 4' @@ -137,7 +137,7 @@ { 'Pipeline A' => { pipeline_group: 'Pipeline X', - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -147,7 +147,7 @@ }, 'Pipeline B' => { pipeline_group: 'Pipeline X', - filters: filters, + filters:, library_pass: 'Purpose 4', relationships: { 'Purpose 2' => 'Purpose 4' @@ -168,7 +168,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -246,7 +246,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', diff --git a/spec/models/pipeline_spec.rb b/spec/models/pipeline_spec.rb index 5f92b4291..065ec32ac 100644 --- a/spec/models/pipeline_spec.rb +++ b/spec/models/pipeline_spec.rb @@ -10,7 +10,7 @@ let(:pipeline_config) do { pipeline_group: 'Group A', - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -31,7 +31,7 @@ context 'when there is no pipeline group' do let(:pipeline_config) do { - filters: filters, + filters:, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', diff --git a/spec/models/presenters/banking_plate_presenter_spec.rb b/spec/models/presenters/banking_plate_presenter_spec.rb index 090011616..00d85f63d 100644 --- a/spec/models/presenters/banking_plate_presenter_spec.rb +++ b/spec/models/presenters/banking_plate_presenter_spec.rb @@ -10,8 +10,8 @@ let(:purpose_name) { 'banking-plate-purpose' } let(:purpose) { create :v2_purpose, name: purpose_name } - let(:labware) { create :v2_plate, purpose: purpose } - let(:presenter) { described_class.new(labware: labware) } + let(:labware) { create :v2_plate, purpose: } + let(:presenter) { described_class.new(labware:) } describe '#csv_file_links' do let(:download_in_passed_state_name) { 'Download PBMC Bank Tubes Content Report' } diff --git a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb index 53d1adf42..ff74c8b99 100644 --- a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb @@ -40,8 +40,8 @@ let(:labware) do build :v2_plate, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_a3], @@ -56,7 +56,7 @@ before { stub_v2_plate(labware, stub_search: false, custom_includes: 'wells.aliquots,wells.qc_results') } - subject(:presenter) { Presenters::ConcentrationBinnedPlatePresenter.new(labware: labware) } + subject(:presenter) { Presenters::ConcentrationBinnedPlatePresenter.new(labware:) } context 'when binning configuration is missing' do it 'throws an exception' do @@ -69,8 +69,8 @@ create( :concentration_binning_purpose_config, uuid: labware.purpose.uuid, - warnings: warnings, - label_class: label_class + warnings:, + label_class: ) end diff --git a/spec/models/presenters/donor_pooling_plate_presenter_spec.rb b/spec/models/presenters/donor_pooling_plate_presenter_spec.rb index 077bbdaff..3a79a5cd4 100644 --- a/spec/models/presenters/donor_pooling_plate_presenter_spec.rb +++ b/spec/models/presenters/donor_pooling_plate_presenter_spec.rb @@ -74,7 +74,7 @@ let(:option_key) { 'scrna_core_pbmc_donor_pooling_required_number_of_cells' } let(:default_cell_count) { 5000 } - subject { Presenters::DonorPoolingPlatePresenter.new(labware: labware) } + subject { Presenters::DonorPoolingPlatePresenter.new(labware:) } before do Settings.purposes = { diff --git a/spec/models/presenters/final_tube_presenter_spec.rb b/spec/models/presenters/final_tube_presenter_spec.rb index 68297a9ba..5fba07000 100644 --- a/spec/models/presenters/final_tube_presenter_spec.rb +++ b/spec/models/presenters/final_tube_presenter_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Presenters::FinalTubePresenter do let(:labware) do - build :v2_tube, purpose_name: purpose_name, state: state, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' + build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' end before { create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') } @@ -25,7 +25,7 @@ end let(:sidebar_partial) { 'default' } - subject { Presenters::FinalTubePresenter.new(labware: labware) } + subject { Presenters::FinalTubePresenter.new(labware:) } it_behaves_like 'a labware presenter' end diff --git a/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb b/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb index 08a177ae0..b6a89621f 100644 --- a/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb +++ b/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Presenters::MinimalPcrPlatePresenter do let(:labware) do create :v2_plate_with_primer_panels, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [2, 2], created_at: '2016-10-19 12:00:00 +0100' @@ -31,7 +31,7 @@ end let(:sidebar_partial) { 'default' } - subject(:presenter) { Presenters::MinimalPcrPlatePresenter.new(labware: labware) } + subject(:presenter) { Presenters::MinimalPcrPlatePresenter.new(labware:) } before do create(:purpose_config, uuid: labware.purpose.uuid) diff --git a/spec/models/presenters/minimal_plate_presenter_spec.rb b/spec/models/presenters/minimal_plate_presenter_spec.rb index eba217064..1b0d94222 100644 --- a/spec/models/presenters/minimal_plate_presenter_spec.rb +++ b/spec/models/presenters/minimal_plate_presenter_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Presenters::MinimalPlatePresenter do let(:labware) do create :v2_plate, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [2, 2], created_at: '2016-10-19 12:00:00 +0100' @@ -35,7 +35,7 @@ create :stock_plate_config, uuid: 'stock-plate-purpose-uuid' end - subject(:presenter) { Presenters::MinimalPlatePresenter.new(labware: labware) } + subject(:presenter) { Presenters::MinimalPlatePresenter.new(labware:) } it 'returns label attributes' do expected_label = { diff --git a/spec/models/presenters/minimal_stock_plate_presenter_spec.rb b/spec/models/presenters/minimal_stock_plate_presenter_spec.rb index ce55c0b28..9d3813249 100644 --- a/spec/models/presenters/minimal_stock_plate_presenter_spec.rb +++ b/spec/models/presenters/minimal_stock_plate_presenter_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Presenters::MinimalStockPlatePresenter do let(:labware) do create :v2_stock_plate, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [2, 2], created_at: '2016-10-19 12:00:00 +0100' @@ -33,7 +33,7 @@ before { create :stock_plate_config, uuid: labware.purpose.uuid, name: purpose_name } - subject(:presenter) { Presenters::MinimalStockPlatePresenter.new(labware: labware) } + subject(:presenter) { Presenters::MinimalStockPlatePresenter.new(labware:) } it 'returns label attributes' do expected_label = { diff --git a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb index 3388763cb..fb4860cac 100644 --- a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb @@ -41,8 +41,8 @@ let(:labware) do build :v2_plate, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_c2], @@ -57,7 +57,7 @@ before { stub_v2_plate(labware, stub_search: false, custom_includes: 'wells.aliquots,wells.qc_results') } - subject(:presenter) { Presenters::NormalisedBinnedPlatePresenter.new(labware: labware) } + subject(:presenter) { Presenters::NormalisedBinnedPlatePresenter.new(labware:) } context 'when configuration is missing' do it 'throws an exception' do @@ -70,8 +70,8 @@ create( :normalised_binning_purpose_config, uuid: labware.purpose.uuid, - warnings: warnings, - label_class: label_class + warnings:, + label_class: ) end diff --git a/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb b/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb index fb20d6127..14cbb85d0 100644 --- a/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb +++ b/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb @@ -88,8 +88,8 @@ let(:labware) do build :v2_plate, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_a3], @@ -110,7 +110,7 @@ ) end - subject(:presenter) { Presenters::PcrCyclesBinnedPlateUsingRequestMetadataPresenter.new(labware: labware) } + subject(:presenter) { Presenters::PcrCyclesBinnedPlateUsingRequestMetadataPresenter.new(labware:) } context 'when binning' do it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb b/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb index 1c8d9ac3f..b12970d55 100644 --- a/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb +++ b/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb @@ -68,8 +68,8 @@ let(:labware) do build :v2_plate, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_a3], @@ -84,7 +84,7 @@ before { stub_v2_plate(labware, stub_search: false, custom_includes: 'wells.aliquots,wells.qc_results') } - subject(:presenter) { Presenters::PcrCyclesBinnedPlateUsingWellMetadataPresenter.new(labware: labware) } + subject(:presenter) { Presenters::PcrCyclesBinnedPlateUsingWellMetadataPresenter.new(labware:) } context 'when binning' do it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/permissive_presenter_spec.rb b/spec/models/presenters/permissive_presenter_spec.rb index 9eb4cb12a..b54a4a4b8 100644 --- a/spec/models/presenters/permissive_presenter_spec.rb +++ b/spec/models/presenters/permissive_presenter_spec.rb @@ -2,9 +2,9 @@ RSpec.describe Presenters::PermissivePresenter do let(:purpose_name) { 'Example purpose' } - let(:labware) { create :v2_plate, state: state, purpose_name: purpose_name, pool_sizes: [1] } + let(:labware) { create :v2_plate, state:, purpose_name:, pool_sizes: [1] } - subject { Presenters::PermissivePresenter.new(labware: labware) } + subject { Presenters::PermissivePresenter.new(labware:) } before(:each) do create :purpose_config, uuid: 'child-purpose', name: 'Child purpose' diff --git a/spec/models/presenters/plate_presenter_spec.rb b/spec/models/presenters/plate_presenter_spec.rb index 3a4e90622..60b6f29c5 100644 --- a/spec/models/presenters/plate_presenter_spec.rb +++ b/spec/models/presenters/plate_presenter_spec.rb @@ -23,8 +23,8 @@ let(:labware) do build :v2_plate, - purpose_name: purpose_name, - state: state, + purpose_name:, + state:, barcode_number: 1, pool_sizes: [48, 48], created_at: '2016-10-19 12:00:00 +0100' @@ -34,11 +34,11 @@ let(:label_class) { 'Labels::PlateLabel' } before do - create(:purpose_config, uuid: labware.purpose.uuid, warnings: warnings, label_class: label_class) + create(:purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') end - subject(:presenter) { Presenters::PlatePresenter.new(labware: labware) } + subject(:presenter) { Presenters::PlatePresenter.new(labware:) } describe '#custom_metadata_fields' do context 'with custom_metadata_fields' do @@ -236,7 +236,7 @@ # split up onto different plates. They have different PCR cycle requirements, but # the warning is not required and is unwanted. This check disables the warning # if the plate contains split processes - let(:labware) { create :v2_plate, barcode_number: '2', wells: wells } + let(:labware) { create :v2_plate, barcode_number: '2', wells: } let(:request_a) { create :library_request, pcr_cycles: 1 } let(:request_b) { create :library_request, pcr_cycles: 2 } let(:request_c) { create :library_request, pcr_cycles: 1 } @@ -341,8 +341,8 @@ create( :purpose_config, uuid: labware.purpose.uuid, - warnings: warnings, - label_class: label_class, + warnings:, + label_class:, file_links: [] ) end @@ -357,8 +357,8 @@ create( :purpose_config, uuid: labware.purpose.uuid, - warnings: warnings, - label_class: label_class, + warnings:, + label_class:, file_links: [ { name: 'First type CSV', id: 'first_csv_id' }, { name: 'Second type CSV', id: 'second_csv_id' }, @@ -377,8 +377,8 @@ create( :purpose_config, uuid: labware.purpose.uuid, - warnings: warnings, - label_class: label_class, + warnings:, + label_class:, file_links: [ { name: 'Button 1', id: 'template', params: { page: 0 } }, { name: 'Button 2', id: 'template', params: { page: 1 } } diff --git a/spec/models/presenters/qc_threshold_presenter_spec.rb b/spec/models/presenters/qc_threshold_presenter_spec.rb index 13fc5d794..518ca51c7 100644 --- a/spec/models/presenters/qc_threshold_presenter_spec.rb +++ b/spec/models/presenters/qc_threshold_presenter_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Presenters::QcThresholdPresenter do subject(:presenter) { described_class.new(plate, configuration) } - let(:plate) { instance_double(Sequencescape::Api::V2::Plate, wells: wells) } + let(:plate) { instance_double(Sequencescape::Api::V2::Plate, wells:) } let(:wells) { qc_results.map { |results| instance_double(Sequencescape::Api::V2::Well, all_latest_qc: results) } } let(:qc_results) do [ diff --git a/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb b/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb index 96d9aa76f..21b9ebffd 100644 --- a/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb +++ b/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb @@ -2,9 +2,9 @@ RSpec.describe Presenters::RviCdnaXpPresenter do let(:purpose_name) { 'Example purpose' } - let(:labware) { create :v2_plate, state: state, purpose_name: purpose_name, pool_sizes: [1] } + let(:labware) { create :v2_plate, state:, purpose_name:, pool_sizes: [1] } - subject { Presenters::RviCdnaXpPresenter.new(labware: labware) } + subject { Presenters::RviCdnaXpPresenter.new(labware:) } before(:each) do create :purpose_config, uuid: 'child-purpose', name: 'Child purpose' diff --git a/spec/models/presenters/simple_tube_spec.rb b/spec/models/presenters/simple_tube_spec.rb index cd4e60834..f560d7d42 100644 --- a/spec/models/presenters/simple_tube_spec.rb +++ b/spec/models/presenters/simple_tube_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true RSpec.describe Presenters::SimpleTubePresenter do - let(:labware) { build :v2_tube, state: state } + let(:labware) { build :v2_tube, state: } - subject { Presenters::SimpleTubePresenter.new(labware: labware) } + subject { Presenters::SimpleTubePresenter.new(labware:) } before do create(:purpose_config, name: 'Example Plate Purpose', uuid: 'example-purpose-uuid-1') diff --git a/spec/models/presenters/single_child_permissive_presenter_spec.rb b/spec/models/presenters/single_child_permissive_presenter_spec.rb index 3fc336f4f..8e5ce339e 100644 --- a/spec/models/presenters/single_child_permissive_presenter_spec.rb +++ b/spec/models/presenters/single_child_permissive_presenter_spec.rb @@ -2,11 +2,11 @@ RSpec.describe Presenters::SingleChildPermissivePresenter do let(:purpose_name) { 'Example purpose' } - let(:labware) { create :v2_plate, state: state, purpose_name: purpose_name, pool_sizes: [1] } + let(:labware) { create :v2_plate, state:, purpose_name:, pool_sizes: [1] } let(:child_purpose) { 'Child purpose' } let(:child_plate) { create :v2_plate, purpose_name: child_purpose } - subject { Presenters::SingleChildPermissivePresenter.new(labware: labware) } + subject { Presenters::SingleChildPermissivePresenter.new(labware:) } before(:each) do create :purpose_config, uuid: 'child-purpose', name: child_purpose diff --git a/spec/models/presenters/standard_presenter_spec.rb b/spec/models/presenters/standard_presenter_spec.rb index 09a36dff6..14290d37c 100644 --- a/spec/models/presenters/standard_presenter_spec.rb +++ b/spec/models/presenters/standard_presenter_spec.rb @@ -7,11 +7,11 @@ let(:labware) do create :v2_plate, barcode_number: 1, - state: state, - purpose_name: purpose_name, + state:, + purpose_name:, purpose_uuid: 'test-purpose', uuid: 'plate-uuid', - wells: wells + wells: end let(:wells) do [ @@ -39,7 +39,7 @@ end let(:suggest_passes) { nil } - subject { Presenters::StandardPresenter.new(labware: labware) } + subject { Presenters::StandardPresenter.new(labware:) } it 'returns the priority' do expect(subject.priority).to eq(2) diff --git a/spec/models/presenters/stock_plate_presenter_spec.rb b/spec/models/presenters/stock_plate_presenter_spec.rb index 57641d1b3..9a2e921d0 100644 --- a/spec/models/presenters/stock_plate_presenter_spec.rb +++ b/spec/models/presenters/stock_plate_presenter_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Presenters::StockPlatePresenter do let(:labware) { create :v2_stock_plate } - subject { Presenters::StockPlatePresenter.new(labware: labware) } + subject { Presenters::StockPlatePresenter.new(labware:) } let(:barcode_string) { labware.human_barcode } diff --git a/spec/models/presenters/submission_plate_presenter_spec.rb b/spec/models/presenters/submission_plate_presenter_spec.rb index c24588e46..5e358992b 100644 --- a/spec/models/presenters/submission_plate_presenter_spec.rb +++ b/spec/models/presenters/submission_plate_presenter_spec.rb @@ -4,7 +4,7 @@ require_relative 'shared_labware_presenter_examples' RSpec.describe Presenters::SubmissionPlatePresenter do - subject(:presenter) { described_class.new(labware: labware) } + subject(:presenter) { described_class.new(labware:) } let(:submission_options) do { @@ -27,7 +27,7 @@ let(:example2_template_uuid) { SecureRandom.uuid } before do - create(:purpose_config, uuid: labware.purpose.uuid, submission_options: submission_options) + create(:purpose_config, uuid: labware.purpose.uuid, submission_options:) Settings.submission_templates = { 'example' => example_template_uuid, 'example2' => example2_template_uuid } end @@ -68,7 +68,7 @@ let(:labware) do create :v2_plate_for_submission, - purpose_name: purpose_name, + purpose_name:, barcode_number: 2, direct_submissions: [], study: submission_study, @@ -115,7 +115,7 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_plate_for_submission, purpose_name: purpose_name, barcode_number: 2, direct_submissions: submissions + create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions end let(:submissions) { create_list :v2_submission, 1, state: 'pending' } @@ -157,7 +157,7 @@ end let(:labware) do - create :v2_plate_for_submission, purpose_name: purpose_name, barcode_number: 2, direct_submissions: submissions + create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions end let(:now) { Time.zone.parse('2020-11-24 16:13:43 +0000') } let(:submissions) { create_list :v2_submission, 1, state: 'ready', updated_at: now - 5.seconds } @@ -188,7 +188,7 @@ it_behaves_like 'a labware presenter' it_behaves_like 'a stock presenter' - let(:labware) { create :v2_stock_plate, purpose_name: purpose_name, barcode_number: 2, pool_sizes: [2] } + let(:labware) { create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2] } let(:barcode_string) { 'DN2T' } let(:purpose_name) { 'Test Plate' } let(:title) { purpose_name } @@ -214,13 +214,13 @@ let(:labware) do create :v2_stock_plate, - purpose_name: purpose_name, + purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, - state: state + state: end - let(:submissions) { create_list :v2_submission, 1, state: state } + let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } let(:purpose_name) { 'Test Plate' } let(:title) { purpose_name } @@ -256,13 +256,13 @@ let(:labware) do create :v2_stock_plate, - purpose_name: purpose_name, + purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, - state: state + state: end - let(:submissions) { create_list :v2_submission, 1, state: state } + let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } let(:purpose_name) { 'Test Plate' } let(:title) { purpose_name } diff --git a/spec/models/presenters/tag_plate_384_presenter_spec.rb b/spec/models/presenters/tag_plate_384_presenter_spec.rb index 6b6c3d823..b688757d9 100644 --- a/spec/models/presenters/tag_plate_384_presenter_spec.rb +++ b/spec/models/presenters/tag_plate_384_presenter_spec.rb @@ -10,8 +10,8 @@ let(:date_format) { /\A\s?\d{1,2}-[A-Z]{3}-\d{4}\z/ } # e.g., ' 4 JUL 2023' or '24 JUL 2023' let(:purpose_name) { 'Tag Plate - 384' } let(:purpose) { create :v2_purpose, name: purpose_name } - let(:labware) { create :v2_plate, purpose: purpose, size: 384, stock_plate: nil } - let(:presenter) { described_class.new(labware: labware) } + let(:labware) { create :v2_plate, purpose:, size: 384, stock_plate: nil } + let(:presenter) { described_class.new(labware:) } it 'can be looked up for labware' do expect(Presenters.lookup_for(labware)).to be(described_class) diff --git a/spec/models/presenters/tube_presenter_spec.rb b/spec/models/presenters/tube_presenter_spec.rb index a7e8260ff..859c34646 100644 --- a/spec/models/presenters/tube_presenter_spec.rb +++ b/spec/models/presenters/tube_presenter_spec.rb @@ -7,10 +7,10 @@ RSpec.describe Presenters::TubePresenter do let(:labware) do build :v2_tube, - receptacle: receptacle, - purpose: purpose, - purpose_name: purpose_name, - state: state, + receptacle:, + purpose:, + purpose_name:, + state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' end @@ -27,7 +27,7 @@ create(:qc_result, key: 'molarity', value: '5.5', units: 'nM') ] end - let(:receptacle) { create :v2_receptacle, qc_results: qc_results } + let(:receptacle) { create :v2_receptacle, qc_results: } let(:summary_tab) do [ ['Barcode', 'NT6T 3980000006844'], @@ -39,7 +39,7 @@ end let(:sidebar_partial) { 'default' } - subject { Presenters::TubePresenter.new(labware: labware) } + subject { Presenters::TubePresenter.new(labware:) } it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/tube_rack_presenter_spec.rb b/spec/models/presenters/tube_rack_presenter_spec.rb index 676527bba..bebb8e088 100644 --- a/spec/models/presenters/tube_rack_presenter_spec.rb +++ b/spec/models/presenters/tube_rack_presenter_spec.rb @@ -21,7 +21,7 @@ let(:sidebar_partial) { 'default' } let(:file_links) { [] } - let(:labware) { build :tube_rack, purpose_name: purpose_name, tubes: tubes, barcode_number: 2 } + let(:labware) { build :tube_rack, purpose_name:, tubes:, barcode_number: 2 } let(:states) { %w[pending pending pending] } @@ -40,14 +40,14 @@ create( :tube_rack_config, uuid: labware.purpose.uuid, - warnings: warnings, - label_class: label_class, - file_links: file_links + warnings:, + label_class:, + file_links: ) create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') end - subject(:presenter) { described_class.new(labware: labware) } + subject(:presenter) { described_class.new(labware:) } it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/unknown_plate_presenter_spec.rb b/spec/models/presenters/unknown_plate_presenter_spec.rb index 53f7dbd74..4460fe4d0 100644 --- a/spec/models/presenters/unknown_plate_presenter_spec.rb +++ b/spec/models/presenters/unknown_plate_presenter_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Presenters::UnknownPlatePresenter do let(:labware) { create :v2_plate, purpose_name: 'Other plate' } - subject { described_class.new(labware: labware) } + subject { described_class.new(labware:) } it 'prevents state change' do expect { |b| subject.default_state_change(&b) }.not_to yield_control diff --git a/spec/models/print_job_spec.rb b/spec/models/print_job_spec.rb index 7a0ffbf07..1f87d2a1e 100644 --- a/spec/models/print_job_spec.rb +++ b/spec/models/print_job_spec.rb @@ -29,7 +29,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service: label_templates_by_service, + label_templates_by_service:, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -55,7 +55,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service: label_templates_by_service, + label_templates_by_service:, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -75,7 +75,7 @@ PrintJob.new( printer_name: printer_sprint.name, printer: printer_sprint, - label_templates_by_service: label_templates_by_service, + label_templates_by_service:, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -95,7 +95,7 @@ PrintJob.new( printer_name: printer_unknown.name, printer: printer_unknown, - label_templates_by_service: label_templates_by_service, + label_templates_by_service:, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -115,7 +115,7 @@ let(:pmb_print_job) do PMB::PrintJob.new( printer_name: printer_pmb.name, - label_template_id: label_template_id, + label_template_id:, labels: [{ label: { barcode: '12345', test_attr: 'test' } }] ) end @@ -125,7 +125,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service: label_templates_by_service, + label_templates_by_service:, labels: [{ label: { barcode: '12345', test_attr: 'test' } }], number_of_copies: 1 ) @@ -142,7 +142,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service: label_templates_by_service, + label_templates_by_service:, labels: [ { label: { barcode: '12345', test_attr: 'test' } }, { label: { barcode: '67890', test_attr: 'test2' } } @@ -189,9 +189,9 @@ PrintJob.new( printer_name: printer_sprint.name, printer: printer_sprint, - label_templates_by_service: label_templates_by_service, + label_templates_by_service:, labels: [{ label: { barcode: '12345', test_attr: 'test' } }], - labels_sprint: labels_sprint, + labels_sprint:, number_of_copies: 1 ) diff --git a/spec/models/robots/plate_to_tube_racks_robot_spec.rb b/spec/models/robots/plate_to_tube_racks_robot_spec.rb index 0955e4dd9..72855711d 100644 --- a/spec/models/robots/plate_to_tube_racks_robot_spec.rb +++ b/spec/models/robots/plate_to_tube_racks_robot_spec.rb @@ -200,7 +200,7 @@ } end - let(:robot) { described_class.new(robot_config.merge(api: api, user_uuid: user_uuid)) } + let(:robot) { described_class.new(robot_config.merge(api:, user_uuid:)) } let(:scanned_layout) do { @@ -372,7 +372,7 @@ reason: "Robot #{robot_name} started", target_state: 'passed', target_uuid: tube_uuid, - user_uuid: user_uuid + user_uuid: } end ) diff --git a/spec/models/robots/pooling_and_splitting_robot_spec.rb b/spec/models/robots/pooling_and_splitting_robot_spec.rb index 355883d39..0a3b6139a 100644 --- a/spec/models/robots/pooling_and_splitting_robot_spec.rb +++ b/spec/models/robots/pooling_and_splitting_robot_spec.rb @@ -59,7 +59,7 @@ let(:target_1_purpose_uuid) { SecureRandom.uuid } let(:target_plate_1_parents) { [source_plate_1] } let(:target_1_wells) do - %w[A1 B1 C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } + %w[A1 B1 C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } end let(:target_plate_1) { create :v2_plate, target_plate_1_attributes } @@ -69,11 +69,11 @@ let(:target_2_purpose_uuid) { SecureRandom.uuid } let(:target_plate_2_parents) { [source_plate_1] } let(:target_2_wells) do - %w[A1 B1 C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } + %w[A1 B1 C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } end let(:target_plate_2) { create :v2_plate, target_plate_2_attributes } - let(:robot) { Robots::PoolingAndSplittingRobot.new(robot_spec.merge(api: api, user_uuid: user_uuid)) } + let(:robot) { Robots::PoolingAndSplittingRobot.new(robot_spec.merge(api:, user_uuid:)) } let(:robot_spec) do { @@ -268,8 +268,8 @@ let(:transfer_source_plates) { [source_plate_1, source_plate_2] } let(:target_1_wells) do - %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + - %w[A1 B1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } + %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + + %w[A1 B1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate_2, [:purpose, { wells: :upstream_plates }]) } @@ -372,7 +372,7 @@ reason: 'Robot Pooling And Splitting Robot started', target_state: 'passed', target_uuid: target_plate_1_uuid, - user_uuid: user_uuid + user_uuid: }, { contents: nil, @@ -380,7 +380,7 @@ reason: 'Robot Pooling And Splitting Robot started', target_state: 'passed', target_uuid: target_plate_2_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/models/robots/pooling_robot_spec.rb b/spec/models/robots/pooling_robot_spec.rb index ae8fa0854..a2bf527ae 100644 --- a/spec/models/robots/pooling_robot_spec.rb +++ b/spec/models/robots/pooling_robot_spec.rb @@ -24,7 +24,7 @@ purpose_uuid: target_purpose_uuid, barcode_number: 2, parents: target_plate_parents, - wells: wells, + wells:, state: target_plate_state } end @@ -45,10 +45,10 @@ let(:target_plate) { create :v2_plate, target_plate_attributes } let(:target_plate_parents) { [source_plate] } - let(:custom_metadatum_collection) { create :custom_metadatum_collection, metadata: metadata } + let(:custom_metadatum_collection) { create :custom_metadatum_collection, metadata: } let(:metadata) { { 'other_key' => 'value' } } - let(:robot) { Robots::PoolingRobot.new(robot_spec.merge(api: api, user_uuid: user_uuid)) } + let(:robot) { Robots::PoolingRobot.new(robot_spec.merge(api:, user_uuid:)) } let(:robot_spec) do { @@ -105,7 +105,7 @@ let(:transfer_source_plates) { [source_plate] } let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } + %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } end before do @@ -175,8 +175,8 @@ let(:transfer_source_plates) { [source_plate, source_plate2] } let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + - %w[A1 B1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } + %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + + %w[A1 B1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate2, [:purpose, { wells: :upstream_plates }]) } @@ -222,7 +222,7 @@ reason: 'Robot Pooling Robot started', target_state: 'passed', target_uuid: target_plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/models/robots/quadrant_robot_spec.rb b/spec/models/robots/quadrant_robot_spec.rb index 8badd8386..58ac0d7d7 100644 --- a/spec/models/robots/quadrant_robot_spec.rb +++ b/spec/models/robots/quadrant_robot_spec.rb @@ -24,7 +24,7 @@ purpose_uuid: target_purpose_uuid, barcode_number: 2, parents: target_plate_parents, - wells: wells + wells: } end @@ -43,10 +43,10 @@ let(:target_plate) { create :v2_plate, target_plate_attributes } let(:target_plate_parents) { [source_plate] } - let(:custom_metadatum_collection) { create :custom_metadatum_collection, metadata: metadata } + let(:custom_metadatum_collection) { create :custom_metadatum_collection, metadata: } let(:metadata) { { 'other_key' => 'value' } } - let(:robot) { Robots::QuadrantRobot.new(robot_spec.merge(api: api, user_uuid: user_uuid)) } + let(:robot) { Robots::QuadrantRobot.new(robot_spec.merge(api:, user_uuid:)) } let(:robot_spec) do { @@ -103,7 +103,7 @@ let(:transfer_source_plates) { [source_plate] } let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } + %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } end before do @@ -173,8 +173,8 @@ let(:transfer_source_plates) { [source_plate, source_plate2] } let(:wells) do - %w[B1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + - %w[A1 C1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } + %w[B1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + + %w[A1 C1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate2, [:purpose, { wells: :upstream_plates }]) } @@ -225,8 +225,8 @@ let(:transfer_source_plates) { [source_plate, source_plate2] } let(:wells) do - %w[B1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + - %w[C1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } + %w[B1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + + %w[C1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate2, [:purpose, { wells: :upstream_plates }]) } @@ -272,7 +272,7 @@ reason: 'Robot Pooling Robot started', target_state: 'passed', target_uuid: target_plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/models/robots/robot_spec.rb b/spec/models/robots/robot_spec.rb index 5d3fe1c43..83fef6358 100644 --- a/spec/models/robots/robot_spec.rb +++ b/spec/models/robots/robot_spec.rb @@ -36,10 +36,10 @@ end let(:target_plate_parents) { [source_plate] } let(:target_tube_parents) { [source_plate] } - let(:custom_metadatum_collection) { create :custom_metadatum_collection, metadata: metadata } + let(:custom_metadatum_collection) { create :custom_metadatum_collection, metadata: } let(:metadata) { { 'other_key' => 'value' } } - let(:robot) { Robots::Robot.new(robot_spec.merge(api: api, user_uuid: user_uuid)) } + let(:robot) { Robots::Robot.new(robot_spec.merge(api:, user_uuid:)) } shared_examples 'a robot' do context 'with an unknown plate' do @@ -620,7 +620,7 @@ barcode_number: '123', purpose_name: 'Limber Cherrypicked', state: 'passed', - custom_metadatum_collection: custom_metadatum_collection + custom_metadatum_collection: end it "is invalid if the barcode isn't recorded" do @@ -737,7 +737,7 @@ reason: 'Robot bravo LB End Prep started', target_state: 'passed', target_uuid: plate.uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/models/robots/splitting_robot_spec.rb b/spec/models/robots/splitting_robot_spec.rb index 7f8e5995f..47de38814 100644 --- a/spec/models/robots/splitting_robot_spec.rb +++ b/spec/models/robots/splitting_robot_spec.rb @@ -10,14 +10,14 @@ let(:user_uuid) { SecureRandom.uuid } let(:plate_uuid) { SecureRandom.uuid } - let(:wells) { %w[C1 D1].map { |location| create :v2_well, location: location, downstream_plates: transfer_target_1 } } + let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, downstream_plates: transfer_target_1 } } let(:transfer_target_1) { [target_plate_1] } let(:source_barcode) { source_plate.human_barcode } let(:source_purpose_name) { 'Limber Cherrypicked' } let(:source_plate_state) { 'passed' } let(:source_plate) do - create :v2_plate, barcode_number: 1, purpose_name: source_purpose_name, state: source_plate_state, wells: wells + create :v2_plate, barcode_number: 1, purpose_name: source_purpose_name, state: source_plate_state, wells: end let(:target_barcode_1) { target_plate_1.human_barcode } let(:target_barcode_2) { target_plate_2.human_barcode } @@ -27,7 +27,7 @@ let(:metadata_uuid) { SecureRandom.uuid } let(:custom_metadatum_collection) { create :custom_metdatum_collection, uuid: metadata_uuid } - let(:robot) { Robots::SplittingRobot.new(robot_spec.merge(api: api, user_uuid: user_uuid)) } + let(:robot) { Robots::SplittingRobot.new(robot_spec.merge(api:, user_uuid:)) } describe '#verify' do subject { robot.verify(bed_labwares: scanned_layout) } @@ -166,7 +166,7 @@ reason: 'Robot bravo LB End Prep started', target_state: 'passed', target_uuid: plate.uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/models/robots_spec.rb b/spec/models/robots_spec.rb index a04bfc6ec..8fbb0ec0d 100644 --- a/spec/models/robots_spec.rb +++ b/spec/models/robots_spec.rb @@ -14,7 +14,7 @@ describe '::find' do let(:user_uuid) { SecureRandom.uuid } - subject { Robots.find(id: robot_id, api: api, user_uuid: user_uuid) } + subject { Robots.find(id: robot_id, api:, user_uuid:) } context 'with a standard robot' do let(:robot_id) { 'robot_id' } diff --git a/spec/models/sequencescape_submission_spec.rb b/spec/models/sequencescape_submission_spec.rb index 33282d487..5341d8cf1 100644 --- a/spec/models/sequencescape_submission_spec.rb +++ b/spec/models/sequencescape_submission_spec.rb @@ -12,7 +12,7 @@ let(:request_options) { { read_length: 150 } } let(:user_uuid) { 'user-uuid' } let(:attributes) do - { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + { api:, assets:, template_uuid:, request_options:, user: user_uuid } end describe '#template_uuid' do @@ -25,7 +25,7 @@ context 'when set via template_name' do let(:template_name) { 'Submission template' } let(:attributes) do - { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + { api:, assets:, template_uuid:, request_options:, user: user_uuid } end before { Settings.submission_templates = { template_name => template_uuid } } @@ -38,7 +38,7 @@ describe '#extra_barcodes_trimmed' do let(:attributes) do - { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + { api:, assets:, template_uuid:, request_options:, user: user_uuid } end it 'removes any extra whitespaces' do @@ -49,7 +49,7 @@ describe '#extra_plates' do let(:attributes) do - { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + { api:, assets:, template_uuid:, request_options:, user: user_uuid } end let(:plate) { create :v2_plate } @@ -66,7 +66,7 @@ describe '#extra_assets' do let(:attributes) do - { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + { api:, assets:, template_uuid:, request_options:, user: user_uuid } end let(:plate) { create(:passed_plate) } @@ -92,7 +92,7 @@ describe '#asset_groups_for_orders_creation' do let(:attributes) do - { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + { api:, assets:, template_uuid:, request_options:, user: user_uuid } end it 'returns normal asset groups when no extra barcodes provided' do @@ -125,8 +125,8 @@ 'orders', payload: { order: { - assets: assets, - request_options: request_options, + assets:, + request_options:, user: user_uuid } }, @@ -169,10 +169,10 @@ let(:assets2) { ['asset-2-uuid'] } let(:attributes) do { - api: api, + api:, asset_groups: { '1' => { - assets: assets, + assets:, study: study1_uuid, project: project1_uuid }, @@ -182,8 +182,8 @@ project: project2_uuid } }, - template_uuid: template_uuid, - request_options: request_options, + template_uuid:, + request_options:, user: user_uuid } end @@ -197,8 +197,8 @@ order: { study: study1_uuid, project: project1_uuid, - assets: assets, - request_options: request_options, + assets:, + request_options:, user: user_uuid } }, @@ -212,7 +212,7 @@ study: study2_uuid, project: project2_uuid, assets: assets2, - request_options: request_options, + request_options:, user: user_uuid } }, diff --git a/spec/models/state_changers_spec.rb b/spec/models/state_changers_spec.rb index 702c30543..4038215a6 100644 --- a/spec/models/state_changers_spec.rb +++ b/spec/models/state_changers_spec.rb @@ -21,11 +21,11 @@ [ { contents: wells_to_pass, - customer_accepts_responsibility: customer_accepts_responsibility, - reason: reason, - target_state: target_state, + customer_accepts_responsibility:, + reason:, + target_state:, target_uuid: plate_uuid, - user_uuid: user_uuid + user_uuid: } ] ) diff --git a/spec/models/tube_rack_walking_spec.rb b/spec/models/tube_rack_walking_spec.rb index ba539837c..7951b061b 100644 --- a/spec/models/tube_rack_walking_spec.rb +++ b/spec/models/tube_rack_walking_spec.rb @@ -6,7 +6,7 @@ subject { TubeRackWalking::Walker.new(rack) } context 'A v2 rack' do - let(:rack) { build :tube_rack, tubes: tubes } + let(:rack) { build :tube_rack, tubes: } let(:tubes) { { 'A1' => create(:v2_tube), 'B1' => create(:v2_tube), 'H10' => create(:v2_tube) } } diff --git a/spec/models/utility/cell_count_spot_checking_spec.rb b/spec/models/utility/cell_count_spot_checking_spec.rb index 57b445b29..019b1a145 100644 --- a/spec/models/utility/cell_count_spot_checking_spec.rb +++ b/spec/models/utility/cell_count_spot_checking_spec.rb @@ -22,13 +22,13 @@ suffix = ((index - 1) / 3) + 1 uuid = "sample-uuid-#{suffix}" # Match the samples of tubes supplier_name = ancestor_tubes[uuid].barcode.human - sample_metadata = create(:v2_sample_metadata, supplier_name: supplier_name) - sample = create(:v2_sample, uuid: uuid, sample_metadata: sample_metadata) - aliquots = [create(:v2_aliquot, sample: sample)] + sample_metadata = create(:v2_sample_metadata, supplier_name:) + sample = create(:v2_sample, uuid:, sample_metadata:) + aliquots = [create(:v2_aliquot, sample:)] location = WellHelpers.well_at_column_index(index - 1) - array << create(:v2_well, aliquots: aliquots, location: location) + array << create(:v2_well, aliquots:, location:) end - create(:v2_plate, wells: wells) + create(:v2_plate, wells:) end let(:plate_wells_grouped_by_barcode) do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c32370bac..e2aebd78b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -63,7 +63,7 @@ options.add_argument('--headless') options.add_argument('--disable_gpu') options.add_argument('--window-size=1600,3200') - Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) + Capybara::Selenium::Driver.new(app, browser: :chrome, options:) end Capybara.javascript_driver = ENV.fetch('JS_DRIVER', 'headless_chrome').to_sym diff --git a/spec/support/api_url_helper.rb b/spec/support/api_url_helper.rb index 4894b46af..bb0281796 100644 --- a/spec/support/api_url_helper.rb +++ b/spec/support/api_url_helper.rb @@ -30,7 +30,7 @@ def api_url_for(*components) def stub_api_get(*components, status: 200, body: '{}') stub_request(:get, api_url_for(*components)) .with(headers: { 'Accept' => 'application/json' }) - .to_return(status: status, body: body, headers: { 'content-type' => 'application/json' }) + .to_return(status:, body:, headers: { 'content-type' => 'application/json' }) end # Generate an API stub for a post request. @@ -50,7 +50,7 @@ def stub_api_get(*components, status: 200, body: '{}') # @param [Int] status: the response status, defaults to 201 # @return mocked_request def stub_api_post(*components, status: 201, body: '{}', payload: {}) - stub_api_modify(*components, status: status, body: body, payload: payload) + stub_api_modify(*components, status:, body:, payload:) end def stub_api_modify(*components, body:, payload:, action: :post, status: 201) @@ -64,12 +64,12 @@ def stub_api_modify(*components, body:, payload:, action: :post, status: 201) body: payload ) ) do |request, response| - request.to_return(status: status, body: response, headers: { 'content-type' => 'application/json' }) + request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) end end def stub_api_put(*components, body:, payload:) - stub_api_modify(*components, action: :put, status: 200, body: body, payload: payload) + stub_api_modify(*components, action: :put, status: 200, body:, payload:) end end @@ -143,7 +143,7 @@ def stub_v2_plate(plate, stub_search: true, custom_query: nil, custom_includes: end def stub_v2_polymetadata(polymetadata, metadatable_id) - arguments = [{ key: polymetadata.key, metadatable_id: metadatable_id }] + arguments = [{ key: polymetadata.key, metadatable_id: }] allow(Sequencescape::Api::V2::PolyMetadatum).to receive(:find).with(*arguments).and_return([polymetadata]) end diff --git a/spec/support/contract_helper.rb b/spec/support/contract_helper.rb index 426877b33..e11e00d99 100644 --- a/spec/support/contract_helper.rb +++ b/spec/support/contract_helper.rb @@ -67,11 +67,11 @@ def setup_request_and_response_mock private - def contract(contract_name, &block) + def contract(contract_name, &) path = @root.dup until path.empty? filename = File.join(path, 'contracts', "#{contract_name}.txt") - return File.open(filename, 'r', &block) if File.file?(filename) + return File.open(filename, 'r', &) if File.file?(filename) path.pop end @@ -94,15 +94,15 @@ def self.included(base) end module ClassMethods - def expect_request_from(request_filename, &block) + def expect_request_from(request_filename, &) stubbed_request = StubRequestBuilder.new(File.join(File.dirname(__FILE__), %w[.. contracts])) stubbed_request.request(request_filename) - stubbed_request.instance_eval(&block) + stubbed_request.instance_eval(&) stubbed_request.inject_into(self) end def has_a_working_api(times: :any) - expect_request_from('retrieve-api-root') { response('api-root', times: times) } + expect_request_from('retrieve-api-root') { response('api-root', times:) } let(:api) do Sequencescape::Api.new( url: 'http://example.com:3000/', diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index 54e533488..e67dd8774 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -55,10 +55,10 @@ def stub_create_labware_metadata(barcode, labware_v1, labware_uuid, user_uuid, m custom_metadatum_collection: { user: user_uuid, asset: labware_uuid, - metadata: metadata + metadata: } }, - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata: metadata) + body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata:) ) end @@ -70,10 +70,10 @@ def stub_update_labware_metadata(barcode, labware_v1, user, metadata) 'custom_metadatum_collection-uuid', payload: { custom_metadatum_collection: { - metadata: metadata + metadata: } }, - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata: metadata) + body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata:) ) end @@ -111,7 +111,7 @@ def fill_in_with_terminate(terminate, field, options) end def ean13(number, prefix = 'DN') - SBCF::SangerBarcode.new(prefix: prefix, number: number).machine_barcode.to_s + SBCF::SangerBarcode.new(prefix:, number:).machine_barcode.to_s end # Because wells can get quite small on 384 well plates, we use a tooltip diff --git a/spec/support/robot_helpers.rb b/spec/support/robot_helpers.rb index 7441d1f6f..8f1f30abe 100644 --- a/spec/support/robot_helpers.rb +++ b/spec/support/robot_helpers.rb @@ -7,7 +7,7 @@ def bed_labware_lookup(labware, includes = %i[purpose parents]) def bed_labware_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) allow(Sequencescape::Api::V2::Labware).to receive(:find_all) - .with({ barcode: Array(barcode) }, includes: includes) + .with({ barcode: Array(barcode) }, includes:) .and_return(result) end @@ -17,7 +17,7 @@ def bed_plate_lookup(plate, includes = %i[purpose parents]) def bed_plate_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: Array(barcode) }, includes: includes) + .with({ barcode: Array(barcode) }, includes:) .and_return(result) end end diff --git a/spec/support/shared_tagging_examples.rb b/spec/support/shared_tagging_examples.rb index 44037b2b0..e85c3c632 100644 --- a/spec/support/shared_tagging_examples.rb +++ b/spec/support/shared_tagging_examples.rb @@ -29,7 +29,7 @@ tag_layout: { plate: tag_plate_uuid, user: user_uuid, - enforce_uniqueness: enforce_uniqueness + enforce_uniqueness: } }, body: '{}' diff --git a/spec/support/with_pmb_stubbed.rb b/spec/support/with_pmb_stubbed.rb index 7028c97b5..eeed11766 100644 --- a/spec/support/with_pmb_stubbed.rb +++ b/spec/support/with_pmb_stubbed.rb @@ -34,7 +34,7 @@ def print_job_post(printer_name, template_id) data: { type: 'print_jobs', attributes: { - printer_name: printer_name, + printer_name:, label_template_id: template_id, labels: { body: [{ label: { barcode: '12345', test_attr: 'test' } }] @@ -49,7 +49,7 @@ def print_job_post_multiple_labels(printer_name, template_id) data: { type: 'print_jobs', attributes: { - printer_name: printer_name, + printer_name:, label_template_id: template_id, labels: { body: [ diff --git a/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb b/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb index b2c335a35..04c87281b 100644 --- a/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb +++ b/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb @@ -24,7 +24,7 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'C10', library_state: 'pending', - outer_request: outer_request, + outer_request:, sample: sample1, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_11_v2')) @@ -33,7 +33,7 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'A01', library_state: 'pending', - outer_request: outer_request, + outer_request:, sample: sample2, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_7_v2')) @@ -42,7 +42,7 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'A01', library_state: 'pending', - outer_request: outer_request, + outer_request:, sample: sample0, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_1_v2')) @@ -51,13 +51,13 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'H12', library_state: 'pending', - outer_request: outer_request, + outer_request:, sample: sample3, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_24_v2')) ) ] - create(:v2_tube, aliquots: aliquots) + create(:v2_tube, aliquots:) end before { assign(:tube, labware) } diff --git a/spec/views/exports/hamilton_lrc_pbmc_bank_to_cellaca_common.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_bank_to_cellaca_common.csv.erb_spec.rb index f263c8acd..0a651d56c 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_bank_to_cellaca_common.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_bank_to_cellaca_common.csv.erb_spec.rb @@ -20,13 +20,13 @@ suffix = ((index - 1) / 3) + 1 uuid = "sample-uuid-#{suffix}" # Match the samples of tubes supplier_name = ancestor_tubes[uuid].barcode.human - sample_metadata = create(:v2_sample_metadata, supplier_name: supplier_name) - sample = create(:v2_sample, uuid: uuid, sample_metadata: sample_metadata) - aliquots = [create(:v2_aliquot, sample: sample)] + sample_metadata = create(:v2_sample_metadata, supplier_name:) + sample = create(:v2_sample, uuid:, sample_metadata:) + aliquots = [create(:v2_aliquot, sample:)] location = WellHelpers.well_at_column_index(index - 1) - array << create(:v2_well, aliquots: aliquots, location: location) + array << create(:v2_well, aliquots:, location:) end - create(:v2_plate, wells: wells) + create(:v2_plate, wells:) end let(:workflow) { 'scRNA Core LRC PBMC Bank Cell Count' } @@ -39,7 +39,7 @@ context 'with first replicates' do let(:template) { 'exports/hamilton_lrc_pbmc_bank_to_cellaca_first_count' } it 'renders the expected content' do - render(template: template) + render(template:) content = CSV.parse(rendered) selected_wells = Utility::CellCountSpotChecking.new(plate).first_replicates expect(content).to eq(expected_content(selected_wells)) @@ -49,7 +49,7 @@ context 'with second replicates' do let(:template) { 'exports/hamilton_lrc_pbmc_bank_to_cellaca_second_count' } it 'renders the expected content' do - render(template: template) + render(template:) content = CSV.parse(rendered) selected_wells = Utility::CellCountSpotChecking.new(plate).second_replicates expect(content).to eq(expected_content(selected_wells)) diff --git a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb index 417c31e95..720c76f9c 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb @@ -6,11 +6,11 @@ let(:wells) do (1..12).map do |index| # one-based index supplier_name = "vac-tube-barcode-#{index}" - sample_metadata = create(:v2_sample_metadata, supplier_name: supplier_name) - sample = create(:v2_sample, sample_metadata: sample_metadata) - aliquots = [create(:v2_aliquot, sample: sample)] + sample_metadata = create(:v2_sample_metadata, supplier_name:) + sample = create(:v2_sample, sample_metadata:) + aliquots = [create(:v2_aliquot, sample:)] location = WellHelpers.well_at_column_index(index - 1) - create(:v2_well, aliquots: aliquots, location: location) + create(:v2_well, aliquots:, location:) end end @@ -23,7 +23,7 @@ wells[2].state = 'failed' wells[3].state = 'failed' - create(:v2_plate, wells: wells) + create(:v2_plate, wells:) end let(:workflow) { 'scRNA Core LRC PBMC Defrost PBS Cell Count' } diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 60240d5a4..739b39cd4 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -34,12 +34,12 @@ let(:ancestor_tubes) { { sample1_uuid => ancestor_vac_tube_1, sample2_uuid => ancestor_vac_tube_2 } } # source aliquots - let(:src_aliquot1_s1) { create(:v2_aliquot, sample: sample1, study: study) } - let(:src_aliquot2_s1) { create(:v2_aliquot, sample: sample1, study: study) } - let(:src_aliquot3_s1) { create(:v2_aliquot, sample: sample1, study: study) } - let(:src_aliquot1_s2) { create(:v2_aliquot, sample: sample2, study: study) } - let(:src_aliquot2_s2) { create(:v2_aliquot, sample: sample2, study: study) } - let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2, study: study) } + let(:src_aliquot1_s1) { create(:v2_aliquot, sample: sample1, study:) } + let(:src_aliquot2_s1) { create(:v2_aliquot, sample: sample1, study:) } + let(:src_aliquot3_s1) { create(:v2_aliquot, sample: sample1, study:) } + let(:src_aliquot1_s2) { create(:v2_aliquot, sample: sample2, study:) } + let(:src_aliquot2_s2) { create(:v2_aliquot, sample: sample2, study:) } + let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2, study:) } # qc results let(:live_cell_count_qc) { create(:qc_result, key: 'live_cell_count', value: '20000', units: 'cells/ml') } @@ -49,12 +49,12 @@ # source wells let(:source_well_attributes) do [ - { location: 'A1', aliquots: [src_aliquot1_s1], downstream_tubes: [dest_tube1], qc_results: qc_results }, - { location: 'A2', aliquots: [src_aliquot2_s1], downstream_tubes: [dest_tube2], qc_results: qc_results }, - { location: 'A3', aliquots: [src_aliquot3_s1], downstream_tubes: [dest_tube3], qc_results: qc_results }, - { location: 'B1', aliquots: [src_aliquot1_s2], downstream_tubes: [dest_tube4], qc_results: qc_results }, - { location: 'B2', aliquots: [src_aliquot2_s2], downstream_tubes: [dest_tube5], qc_results: qc_results }, - { location: 'B3', aliquots: [src_aliquot3_s2], downstream_tubes: [dest_tube6], qc_results: qc_results } + { location: 'A1', aliquots: [src_aliquot1_s1], downstream_tubes: [dest_tube1], qc_results: }, + { location: 'A2', aliquots: [src_aliquot2_s1], downstream_tubes: [dest_tube2], qc_results: }, + { location: 'A3', aliquots: [src_aliquot3_s1], downstream_tubes: [dest_tube3], qc_results: }, + { location: 'B1', aliquots: [src_aliquot1_s2], downstream_tubes: [dest_tube4], qc_results: }, + { location: 'B2', aliquots: [src_aliquot2_s2], downstream_tubes: [dest_tube5], qc_results: }, + { location: 'B3', aliquots: [src_aliquot3_s2], downstream_tubes: [dest_tube6], qc_results: } ] end From 3b1de311cc5a1374a22604c92bd9056dc00d2dc2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 10:49:36 +0100 Subject: [PATCH 054/141] build: update prettier --- .prettierrc.json | 4 +++- Gemfile | 5 +++++ Gemfile.lock | 23 +++++++++++++++++++++++ package.json | 4 ++-- yarn.lock | 42 ++++++++++++++++++++++++++++-------------- 5 files changed, 61 insertions(+), 17 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index cbe842acd..c5a1534ca 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,5 +1,7 @@ { "printWidth": 120, "semi": false, - "singleQuote": true + "rubySingleQuote": true, + "singleQuote": true, + "plugins": ["@prettier/plugin-ruby"] } diff --git a/Gemfile b/Gemfile index b818c04b8..d2272e5fc 100644 --- a/Gemfile +++ b/Gemfile @@ -67,4 +67,9 @@ group :lint do gem 'rubocop', require: false gem 'rubocop-performance', require: false gem 'rubocop-rails', require: false + + gem 'prettier_print', require: false + gem 'syntax_tree', require: false + gem 'syntax_tree-haml', require: false + gem 'syntax_tree-rbs', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 5cb0415d2..e44be4020 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -186,6 +186,10 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) + haml (6.3.0) + temple (>= 0.8.2) + thor + tilt hashdiff (1.1.0) hashie (5.0.0) i18n (1.14.5) @@ -247,6 +251,7 @@ GEM parser (3.3.4.0) ast (~> 2.4.1) racc + prettier_print (1.2.1) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -309,6 +314,8 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) + rbs (3.5.3) + logger rdoc (6.7.0) psych (>= 4.0.0) regexp_parser (2.9.2) @@ -386,7 +393,19 @@ GEM state_machines (0.6.0) stringio (3.1.1) strscan (3.1.0) + syntax_tree (6.2.0) + prettier_print (>= 1.2.0) + syntax_tree-haml (4.0.3) + haml (>= 5.2) + prettier_print (>= 1.2.1) + syntax_tree (>= 6.0.0) + syntax_tree-rbs (1.0.0) + prettier_print + rbs + syntax_tree (>= 2.0.1) + temple (0.10.3) thor (1.3.1) + tilt (2.4.0) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -432,6 +451,7 @@ DEPENDENCIES launchy oj pmb-client (= 0.1.0)! + prettier_print pry pry-byebug puma @@ -452,6 +472,9 @@ DEPENDENCIES simplecov-lcov sprint_client state_machines + syntax_tree + syntax_tree-haml + syntax_tree-rbs vite_rails vite_ruby web-console diff --git a/package.json b/package.json index c198b00a9..ae7a85a4d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "web-worker": "^1.3.0" }, "devDependencies": { - "@prettier/plugin-ruby": "^2.1.0", + "@prettier/plugin-ruby": "^4.0.0", "@vitejs/plugin-vue2": "^2.3.1", "@vitest/coverage-v8": "^2.0.5", "@vue/test-utils": "^1.3.6", @@ -30,7 +30,7 @@ "postcss-import": "16.1.0", "postcss-nested": "^6.0.1", "postcss-preset-env": "^9.6.0", - "prettier": "^2.8.8", + "prettier": "^3.0.0", "sass": "^1.77.8", "typescript": "^4.6.3", "vite": "^5.0.0", diff --git a/yarn.lock b/yarn.lock index c36b5c6b0..021e48627 100644 --- a/yarn.lock +++ b/yarn.lock @@ -615,12 +615,10 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A== -"@prettier/plugin-ruby@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-2.1.0.tgz#2df48c1c004fc9dec18a72f441d43d54137b25a6" - integrity sha512-lAoYFoDnwlxM3jl+dS7yrmxD49d3nbKFTBuhHx3VTPoAwmOOKOIO4nRJTTBWF+rS7KUAVn2XPLwRR0Obh/KW6A== - dependencies: - prettier ">=2.3.0" +"@prettier/plugin-ruby@^4.0.0": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-4.0.4.tgz#73d85fc2a1731a3f62b57ac3116cf1c234027cb6" + integrity sha512-lCpvfS/dQU5WrwN3AQ5vR8qrvj2h5gE41X08NNzAAXvHdM4zwwGRcP2sHSxfu6n6No+ljWCVx95NvJPFTTjCTg== "@rollup/rollup-android-arm-eabi@4.18.1": version "4.18.1" @@ -2821,16 +2819,16 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier@>=2.3.0: - version "3.2.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.4.tgz#4723cadeac2ce7c9227de758e5ff9b14e075f283" - integrity sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ== - -"prettier@^1.18.2 || ^2.0.0", prettier@^2.8.8: +"prettier@^1.18.2 || ^2.0.0": version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.0.0: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== + pretty@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pretty/-/pretty-2.0.0.tgz#adbc7960b7bbfe289a557dc5f737619a220d06a5" @@ -3074,7 +3072,16 @@ std-env@^3.7.0: resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.7.0.tgz#c9f7386ced6ecf13360b6c6c55b8aaa4ef7481d2" integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -3092,7 +3099,14 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== From e17ed9ea7aadb1899e7695aee02371c7177d232a Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 10:57:28 +0100 Subject: [PATCH 055/141] style: prettier --- app/controllers/health_controller.rb | 3 +- app/controllers/labware_controller.rb | 5 +- app/controllers/robots_controller.rb | 6 +- app/controllers/search_controller.rb | 3 +- .../tubes/validate_paired_tubes_controller.rb | 3 +- .../entrypoints/pages/bed_verification.js | 10 +- .../entrypoints/pages/multi_plate_pooling.js | 2 +- .../entrypoints/pages/multi_tube_pooling.js | 8 +- .../entrypoints/pages/tagged-plate.js | 6 +- .../components/CustomTaggedPlate.vue | 2 +- .../custom-tagged-plate/tagClashFunctions.js | 6 +- .../tagClashFunctions.spec.js | 10 +- .../custom-tagged-plate/tagLayoutFunctions.js | 2 +- .../LabwareCustomMetadataAddForm.spec.js | 4 +- .../javascript/lib/global_message_system.js | 2 +- .../components/MultiStampLibrarySplitter.js | 2 +- .../components/PrimerPanelFilter.vue | 2 +- .../multi_stamp_instance.shared_spec.js | 2 +- .../javascript/pipeline-graph/index.js | 2 +- .../plain-javascript/tag-animations.js | 2 +- .../threshold-well-failing.js | 2 +- .../components/QcInformation.vue | 2 +- app/frontend/javascript/session_scripts.js | 2 +- .../components/AssetLookupByUuid.spec.js | 4 +- .../shared/components/LabwareScan.spec.js | 16 +- .../components/mixins/devourSelect.spec.js | 2 +- .../shared/components/plateScanValidators.js | 4 +- .../javascript/shared/devourApiValidators.js | 2 +- .../javascript/shared/transfersLayouts.js | 4 +- .../javascript/shared/tubeTransferVolumes.js | 4 +- .../test_support/factories/json_factory.js | 6 +- .../factories/json_factory.spec.js | 2 +- .../test_support/factories/plate_factory.js | 2 +- .../javascript/test_support/mock_api.spec.js | 2 +- app/frontend/stylesheets/limber/spinner.scss | 86 ++++++++-- .../concerns/presenters/creation_behaviour.rb | 10 +- .../concerns/presenters/extended_csv.rb | 9 +- app/models/labware_creators/base.rb | 4 +- .../labware_creators/final_tube_from_plate.rb | 6 +- .../labware_creators/multi_stamp_tubes.rb | 4 +- .../multi_stamp_tubes_using_tube_rack_scan.rb | 17 +- .../csv_file_for_duplex_seq.rb | 10 +- .../plate_split_to_tube_racks.rb | 7 +- .../labware_creators/pooled_tubes_base.rb | 11 +- .../pooled_tubes_by_sample.rb | 11 +- .../pooled_tubes_by_submission_with_phi_x.rb | 7 +- .../labware_creators/quadrant_stamp_base.rb | 5 +- app/models/robots/bed/invalid.rb | 3 +- .../robots/bed/plate_to_tube_racks_bed.rb | 4 +- app/sequencescape/sequencescape/api/v2.rb | 10 +- .../sequencescape/api/v2/base.rb | 8 +- .../sequencescape/api/v2/receptacle.rb | 3 +- .../sequencescape/api/v2/well.rb | 3 +- bin/bundle | 152 +++++++++--------- bin/rails | 6 +- bin/rake | 4 +- bin/setup | 2 +- bin/vite | 19 +-- bin/yarn | 16 +- lib/purpose_config.rb | 15 +- lib/robot_configuration.rb | 8 +- lib/tasks/config.rake | 20 +-- limber.sublime-project | 12 +- public/404.html | 2 +- public/422.html | 2 +- public/500.html | 2 +- public/502.html | 2 +- public/504.html | 2 +- spec/controllers/exports_controller_spec.rb | 27 ++-- spec/controllers/plates_controller_spec.rb | 14 +- spec/controllers/qc_files_controller_spec.rb | 42 +++-- .../tube_creation_controller_spec.rb | 18 +-- .../tubes/tubes_exports_controller_spec.rb | 8 +- spec/factories/plate_factories.rb | 29 ++-- spec/factories/poly_metadata_factories.rb | 3 +- spec/factories/purpose_config_factories.rb | 15 +- spec/factories/strategies/api_strategy.rb | 3 +- spec/factories/tube_factories.rb | 8 +- spec/factories/tube_rack_factories.rb | 4 +- spec/factories/well_factories.rb | 8 +- .../charge_and_pass_libraries_spec.rb | 13 +- spec/features/creating_a_plate_spec.rb | 12 +- spec/features/creating_a_tag_plate_spec.rb | 10 +- spec/features/failing_quadrants_spec.rb | 7 +- ...ling_multiple_plates_into_one_tube_spec.rb | 7 +- ...oling_multiple_tubes_into_one_tube_spec.rb | 54 +++---- spec/features/viewing_a_plate_spec.rb | 7 +- spec/helpers/barcode_labels_helper_spec.rb | 12 +- spec/helpers/plate_helpers_spec.rb | 4 +- .../concentration_binned_plate_spec.rb | 10 +- .../concentration_normalised_plate_spec.rb | 6 +- .../custom_pooled_tubes_spec.rb | 28 ++-- .../custom_tagged_plate_spec.rb | 12 +- .../labware_creators/donor_pooling_spec.rb | 34 ++-- .../final_tube_from_plate_spec.rb | 8 +- .../fixed_normalised_plate_spec.rb | 5 +- .../labware_creators/merged_plate_spec.rb | 51 +++--- .../multi_stamp_tubes_spec.rb | 6 +- ...i_stamp_tubes_using_tube_rack_scan_spec.rb | 49 +++--- .../normalised_binned_plate_spec.rb | 5 +- ...cycles_binned_plate_for_duplex_seq_spec.rb | 42 +++-- ...cycles_binned_plate_for_t_nano_seq_spec.rb | 32 ++-- .../plate_split_to_tube_racks_spec.rb | 108 ++++++------- .../plate_with_template_spec.rb | 9 +- .../pooled_tubes_from_whole_plates_spec.rb | 11 +- .../pooled_tubes_from_whole_tubes_spec.rb | 19 +-- .../quadrant_split_plate_spec.rb | 7 +- .../quadrant_stamp_primer_panel_spec.rb | 7 +- .../labware_creators/shared_examples.rb | 6 +- ...d_plate_reordering_columns_to_rows_spec.rb | 8 +- .../labware_creators/stamped_plate_spec.rb | 18 +-- .../labware_creators/tagged_plate_spec.rb | 14 +- .../labware_creators/tube_from_tube_spec.rb | 9 +- .../well_filter_allowing_partials_spec.rb | 4 +- .../labware_creators/well_filter_spec.rb | 4 +- spec/models/labware_metadata_spec.rb | 22 +-- ...ncentration_binned_plate_presenter_spec.rb | 9 +- .../presenters/final_tube_presenter_spec.rb | 4 +- .../normalised_binned_plate_presenter_spec.rb | 9 +- .../models/presenters/plate_presenter_spec.rb | 10 +- .../presenters/standard_presenter_spec.rb | 8 +- .../submission_plate_presenter_spec.rb | 22 +-- .../presenters/tube_rack_presenter_spec.rb | 8 +- spec/models/robots/pooling_robot_spec.rb | 4 +- spec/models/robots/quadrant_robot_spec.rb | 4 +- spec/models/sequencescape_submission_spec.rb | 42 ++--- spec/sequencescape/api/v2/plate_spec.rb | 48 +++--- spec/sequencescape/api/v2/shared_examples.rb | 12 +- spec/support/api_url_helper.rb | 40 ++--- spec/support/contract_helper.rb | 3 +- spec/support/factory_bot_extensions.rb | 5 +- spec/support/feature_helpers.rb | 6 +- spec/support/robot_helpers.rb | 13 +- ..._to_lrc_bank_seq_and_spare.csv.erb_spec.rb | 48 +++--- ...frost_pbs_to_cellaca_count.csv.erb_spec.rb | 4 +- ..._bank_tubes_content_report.csv.erb_spec.rb | 48 +++--- 136 files changed, 809 insertions(+), 995 deletions(-) diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 02b1ee3cf..1298857fc 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -2,5 +2,6 @@ # Controller to display a page stating that Limber is up, as a health check endpoint class HealthController < ApplicationController - def show; end + def show + end end diff --git a/app/controllers/labware_controller.rb b/app/controllers/labware_controller.rb index 36126b57e..eec1a449d 100644 --- a/app/controllers/labware_controller.rb +++ b/app/controllers/labware_controller.rb @@ -22,8 +22,9 @@ def show # rubocop:todo Metrics/AbcSize format.html { render @presenter.page } format.csv do render @presenter.csv - response.headers['Content-Disposition'] = - "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename + response.headers[ + 'Content-Disposition' + ] = "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename end format.json end diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb index 8559b5d7d..1b119511d 100644 --- a/app/controllers/robots_controller.rb +++ b/app/controllers/robots_controller.rb @@ -73,9 +73,9 @@ def update_bed_labware_metadata(bed, robot_barcode) # @raise [Sequencescape::Api::ResourceNotFound] if the labware cannot be found # def labware_created_with_robot(labware_barcode, robot_barcode) - LabwareMetadata - .new(user_uuid: current_user_uuid, barcode: labware_barcode) - .update!(created_with_robot: robot_barcode) + LabwareMetadata.new(user_uuid: current_user_uuid, barcode: labware_barcode).update!( + created_with_robot: robot_barcode + ) end def verify diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index f2d5e3345..e3ecce169 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -7,7 +7,8 @@ class InputError < StandardError before_action :check_for_login!, only: [:my_plates] # rubocop:todo Rails/LexicallyScopedActionFilter - def new; end + def new + end def ongoing_plates # rubocop:todo Metrics/AbcSize plate_search = api.search.find(Settings.searches.fetch('Find plates')) diff --git a/app/controllers/tubes/validate_paired_tubes_controller.rb b/app/controllers/tubes/validate_paired_tubes_controller.rb index ca929c7cd..db1c8980f 100644 --- a/app/controllers/tubes/validate_paired_tubes_controller.rb +++ b/app/controllers/tubes/validate_paired_tubes_controller.rb @@ -5,5 +5,6 @@ class Tubes::ValidatePairedTubesController < ApplicationController before_action :check_for_current_user! - def index; end + def index + end end diff --git a/app/frontend/entrypoints/pages/bed_verification.js b/app/frontend/entrypoints/pages/bed_verification.js index 79af43401..085885d0f 100644 --- a/app/frontend/entrypoints/pages/bed_verification.js +++ b/app/frontend/entrypoints/pages/bed_verification.js @@ -30,21 +30,21 @@ let newScanned = function (bed, labware) { .append( $(document.createElement('h3')) .attr('class', 'ui-li-heading') - .text('Bed: ' + bed) + .text('Bed: ' + bed), ) .append(closeIcon()) .append( $(document.createElement('p')) .attr('class', 'ui-li-desc') - .text('Labware: ' + labware) + .text('Labware: ' + labware), ) .append( $(document.createElement('input')) .attr('type', 'hidden') .attr('id', 'bed_labwares[' + bed + ']') .attr('name', 'bed_labwares[' + bed + '][]') - .val(labware) - ) + .val(labware), + ), ) SCAPE.robot_beds[bed] = SCAPE.robot_beds[bed] || [] SCAPE.robot_beds[bed].push(labware) @@ -162,7 +162,7 @@ $('#validate_layout').on('click', function () { }).fail(function (_data, _status) { SCAPE.message( 'The beds could not be validated. There may be network issues, or problems with Sequencescape.', - 'danger' + 'danger', ) fail() }) diff --git a/app/frontend/entrypoints/pages/multi_plate_pooling.js b/app/frontend/entrypoints/pages/multi_plate_pooling.js index 441a30133..af79ae588 100644 --- a/app/frontend/entrypoints/pages/multi_plate_pooling.js +++ b/app/frontend/entrypoints/pages/multi_plate_pooling.js @@ -284,7 +284,7 @@ SCAPE.renderSourceWells = function () { for (let wellName of wells) { well = $('.plate-id-' + plateIndex + ' .' + wellName) well.append( - SCAPE.newAliquot(capPoolOffset + poolNumber, WELLS_IN_COLUMN_MAJOR_ORDER[capPoolOffset + poolNumber]) + SCAPE.newAliquot(capPoolOffset + poolNumber, WELLS_IN_COLUMN_MAJOR_ORDER[capPoolOffset + poolNumber]), ) newInput = $(document.createElement('input')) diff --git a/app/frontend/entrypoints/pages/multi_tube_pooling.js b/app/frontend/entrypoints/pages/multi_tube_pooling.js index 1c55a96b5..95fc5c028 100644 --- a/app/frontend/entrypoints/pages/multi_tube_pooling.js +++ b/app/frontend/entrypoints/pages/multi_tube_pooling.js @@ -74,7 +74,7 @@ newScanned.prototype = { .append( $(document.createElement('h3')) .attr('class', 'ui-li-heading') - .text('Tube: ' + this.tubeBarcode) + .text('Tube: ' + this.tubeBarcode), ) .append($(document.createElement('div')).attr('class', 'tube_validation_report').text('Waiting...')) .append( @@ -82,8 +82,8 @@ newScanned.prototype = { .attr('type', 'hidden') .attr('id', 'tube[parents][' + this.tubeBarcode + ']') .attr('name', 'tube[parents][' + this.tubeBarcode + ']') - .val(1) - ) + .val(1), + ), ) return this.listElement }, @@ -140,7 +140,7 @@ tubeCollector = new statusCollector( }, function () { $('#tube_submit').prop('disabled', true) - } + }, ) $('.sibling-tube').each(function () { diff --git a/app/frontend/entrypoints/pages/tagged-plate.js b/app/frontend/entrypoints/pages/tagged-plate.js index f401b722f..83e1fe5ed 100644 --- a/app/frontend/entrypoints/pages/tagged-plate.js +++ b/app/frontend/entrypoints/pages/tagged-plate.js @@ -87,7 +87,7 @@ qcableLookup.prototype = { return function () { qc_lookup.message( 'The barcode could not be found. There may be network issues, or problems with Sequencescape.', - 'danger' + 'danger', ) } }, @@ -164,7 +164,7 @@ qcableLookup.prototype = { $(document.createElement('div')) .addClass('alert') .addClass('alert-' + status) - .text(message) + .text(message), ) }, dual: function () { @@ -182,7 +182,7 @@ let qcCollector = new tagStatusCollector( function (message) { $('#submit-summary').text(message) $('#plate_submit').prop('disabled', true) - } + }, ) new qcableLookup($('#plate_tag_plate_barcode'), qcCollector) diff --git a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue index 07220aff2..ec11ba7db 100644 --- a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue +++ b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue @@ -252,7 +252,7 @@ export default { this.parentWellSubmissionDetails, this.tagLayout, this.tagSubstitutions, - this.tagGroupOligoStrings + this.tagGroupOligoStrings, ) }, createButtonDisabled() { diff --git a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js index c4aa5a516..3548377a6 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js +++ b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js @@ -23,7 +23,7 @@ function extractParentWellSubmissionDetails(parentPlate) { // TODO Replace this with generic limber logging when available // See https://github.com/sanger/limber/issues/836 console.error( - 'Tag clash functions: extractParentWellSubmissionDetails: Error: Submission Id not found for well' + 'Tag clash functions: extractParentWellSubmissionDetails: Error: Submission Id not found for well', ) return } @@ -94,7 +94,7 @@ function extractChildUsedOligos(parentUsedOligos, parentWellSubmDetails, tagLayo parentWellSubmDetails, tagLayout, tagSubstitutions, - tagGroupOligos + tagGroupOligos, ) ) { return {} @@ -135,7 +135,7 @@ function isValidChildUsedOligoParameters( parentWellSubmDetails, tagLayout, tagSubstitutions, - tagGroupOligos + tagGroupOligos, ) { let isValid = true diff --git a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js index 40e1a90e7..b027dc95a 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js +++ b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js @@ -362,7 +362,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -399,7 +399,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -435,7 +435,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -473,7 +473,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -509,7 +509,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) diff --git a/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js b/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js index 580e8ec0a..341bd7ff0 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js +++ b/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js @@ -147,7 +147,7 @@ const calculateTagLayout = function (data) { data.tagsPerWell, (well, relIndex, absIndex) => { return walkingByFunctions[data.walkingBy](well, tags, relIndex, absIndex, offset, counters) - } + }, ) } diff --git a/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js b/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js index 4b70ceb96..251efe18d 100644 --- a/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js +++ b/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js @@ -28,7 +28,7 @@ describe('LabwareCustomMetadataAddForm', () => { global.fetch = vi.fn().mockReturnValue( Promise.resolve({ json: () => Promise.resolve(data), - }) + }), ) // This is a workaround for the following warning: @@ -80,7 +80,7 @@ describe('LabwareCustomMetadataAddForm', () => { // expect(wrapper.find('#RT DFD Syringe Lot Number').exists()).toBe(true) expect(wrapper.find('#labware_custom_metadata_submit_button').exists()).toBe(true) expect(wrapper.find('#labware_custom_metadata_submit_button').text()).toEqual( - 'Add Custom Metadata to Sequencescape' + 'Add Custom Metadata to Sequencescape', ) }) }) diff --git a/app/frontend/javascript/lib/global_message_system.js b/app/frontend/javascript/lib/global_message_system.js index 82fea0d7a..f8aa308e3 100644 --- a/app/frontend/javascript/lib/global_message_system.js +++ b/app/frontend/javascript/lib/global_message_system.js @@ -16,7 +16,7 @@ SCAPE.message = function (message, status) { $(document.createElement('div')) .addClass('alert') .addClass('alert-' + status) - .text(message) + .text(message), ) } diff --git a/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js b/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js index 29d0a256a..be6912133 100644 --- a/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js +++ b/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js @@ -95,7 +95,7 @@ export default Vue.extend({ headers: { 'X-Requested-With': 'XMLHttpRequest' }, data: payload, }) - }) + }), ) .then((responses) => { const response = responses[0] diff --git a/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue b/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue index fad3d94b4..005de6dbe 100644 --- a/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue +++ b/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue @@ -39,7 +39,7 @@ export default { return [] } const primerPanelsIterable = Array.from(primerPanelsByPlate.values()).reduce((accu, current) => - accu.filter((val) => current.includes(val)) + accu.filter((val) => current.includes(val)), ) return primerPanelsIterable }, diff --git a/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js b/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js index 660316d2f..058fab0bb 100644 --- a/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js +++ b/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js @@ -171,7 +171,7 @@ const sharedSpecs = (args) => { expect(wrapper.vm.duplicatedTransfers.length).toEqual(1) expect(wrapper.vm.transfersError).toEqual( - 'This would result in multiple transfers into the same well. Check if the source plates (DN1S) have more than one active submission.' + 'This would result in multiple transfers into the same well. Check if the source plates (DN1S) have more than one active submission.', ) }) diff --git a/app/frontend/javascript/pipeline-graph/index.js b/app/frontend/javascript/pipeline-graph/index.js index 658a6b454..9b3d477f8 100644 --- a/app/frontend/javascript/pipeline-graph/index.js +++ b/app/frontend/javascript/pipeline-graph/index.js @@ -204,7 +204,7 @@ const applyMouseEvents = function () {
${content}
- ` + `, ) return document.querySelector('.graph-tooltip') }, diff --git a/app/frontend/javascript/plain-javascript/tag-animations.js b/app/frontend/javascript/plain-javascript/tag-animations.js index 37abc6e77..2a96413fb 100644 --- a/app/frontend/javascript/plain-javascript/tag-animations.js +++ b/app/frontend/javascript/plain-javascript/tag-animations.js @@ -27,5 +27,5 @@ document.addEventListener( } } }, - false + false, ) diff --git a/app/frontend/javascript/plain-javascript/threshold-well-failing.js b/app/frontend/javascript/plain-javascript/threshold-well-failing.js index 9d3061587..9c161191f 100644 --- a/app/frontend/javascript/plain-javascript/threshold-well-failing.js +++ b/app/frontend/javascript/plain-javascript/threshold-well-failing.js @@ -51,7 +51,7 @@ document.addEventListener('DOMContentLoaded', () => { // The well must meet all thresholds. const wellInvalid = Object.entries(threshold).some( - ([qcKey, thresholdValue]) => parseFloat(well.dataset[qcKey]) < thresholdValue + ([qcKey, thresholdValue]) => parseFloat(well.dataset[qcKey]) < thresholdValue, ) well.checked = wellInvalid diff --git a/app/frontend/javascript/qc-information/components/QcInformation.vue b/app/frontend/javascript/qc-information/components/QcInformation.vue index fdcceb2a9..fcfd7d556 100644 --- a/app/frontend/javascript/qc-information/components/QcInformation.vue +++ b/app/frontend/javascript/qc-information/components/QcInformation.vue @@ -108,7 +108,7 @@ export default { }, () => { this.state = 'failure' - } + }, ) }, }, diff --git a/app/frontend/javascript/session_scripts.js b/app/frontend/javascript/session_scripts.js index e72d80654..925bfc5a6 100644 --- a/app/frontend/javascript/session_scripts.js +++ b/app/frontend/javascript/session_scripts.js @@ -20,7 +20,7 @@ logIn = function () { if (user_name !== wasLoggedIn) { updateUserName(user_name) warning( - 'The logged in user has changed since this page was last viewed. You are now logged in as ' + user_name + '.' + 'The logged in user has changed since this page was last viewed. You are now logged in as ' + user_name + '.', ) } } else { diff --git a/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js b/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js index a1990a362..32dafca05 100644 --- a/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js +++ b/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js @@ -34,7 +34,7 @@ describe('AssetLookupByUuid', () => { filter: { uuid: assetUuid }, fields: {}, }, - { data: [] } // no plates found + { data: [] }, // no plates found ) const wrapper = wrapperFactoryPlate(api) @@ -59,7 +59,7 @@ describe('AssetLookupByUuid', () => { filter: { uuid: assetUuid }, fields: {}, }, - goodPlate + goodPlate, ) const wrapper = wrapperFactoryPlate(api) diff --git a/app/frontend/javascript/shared/components/LabwareScan.spec.js b/app/frontend/javascript/shared/components/LabwareScan.spec.js index ddfb7fc39..7ec99fb41 100644 --- a/app/frontend/javascript/shared/components/LabwareScan.spec.js +++ b/app/frontend/javascript/shared/components/LabwareScan.spec.js @@ -138,7 +138,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - goodTube + goodTube, ) wrapper.find('input').setValue('DN12345') @@ -170,7 +170,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - nullTube + nullTube, ) const wrapper = wrapperFactoryTube(api) @@ -202,7 +202,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - pendingTube + pendingTube, ) wrapper.find('input').setValue('Good barcode') @@ -263,7 +263,7 @@ describe('LabwareScan', () => { status: 500, }, ], - } + }, ) const wrapper = wrapperFactoryTube(api) @@ -312,7 +312,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - goodPlate + goodPlate, ) wrapper.find('input').setValue('DN12345') @@ -343,7 +343,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - nullPlate + nullPlate, ) const wrapper = wrapperFactoryPlate(api) @@ -373,7 +373,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - badPlate + badPlate, ) wrapper.find('input').setValue('Good barcode') @@ -428,7 +428,7 @@ describe('LabwareScan', () => { status: 500, }, ], - } + }, ) const wrapper = wrapperFactoryPlate(api) diff --git a/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js b/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js index 7ea4886fe..9e3c60d5a 100644 --- a/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js +++ b/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js @@ -99,7 +99,7 @@ describe('DevourSelect mixin', () => { status: 500, }, ], - } + }, ) const wrapper = wrapperFactory(api) diff --git a/app/frontend/javascript/shared/components/plateScanValidators.js b/app/frontend/javascript/shared/components/plateScanValidators.js index 82e89792e..843fa0f8a 100644 --- a/app/frontend/javascript/shared/components/plateScanValidators.js +++ b/app/frontend/javascript/shared/components/plateScanValidators.js @@ -306,13 +306,13 @@ const checkAllLibraryRequestsWithSameReadySubmissions = () => { return (plate) => { const [firstWellSubmissionIds, ...remainingWellsSubmissionIds] = getAllLibrarySubmissionsWithMatchingStateForPlate( plate, - 'ready' + 'ready', ) // To compare lists we use _.isEqual because there is no equivalent function for lists in // plain Javascript if ( remainingWellsSubmissionIds.every((currentElemSubmissionIds) => - _.isEqual(firstWellSubmissionIds.sort(), currentElemSubmissionIds.sort()) + _.isEqual(firstWellSubmissionIds.sort(), currentElemSubmissionIds.sort()), ) ) { return validScanMessage() diff --git a/app/frontend/javascript/shared/devourApiValidators.js b/app/frontend/javascript/shared/devourApiValidators.js index ceb6ef19b..abece2c81 100644 --- a/app/frontend/javascript/shared/devourApiValidators.js +++ b/app/frontend/javascript/shared/devourApiValidators.js @@ -25,7 +25,7 @@ const hasExpectedProperties = (expectedProperties) => { for (const currTagGroup of results) { const hasAllProperties = expectedProperties.every((property) => - Object.prototype.hasOwnProperty.call(currTagGroup, property) + Object.prototype.hasOwnProperty.call(currTagGroup, property), ) if (!hasAllProperties) { diff --git a/app/frontend/javascript/shared/transfersLayouts.js b/app/frontend/javascript/shared/transfersLayouts.js index 43be7b1ef..e1500ff06 100644 --- a/app/frontend/javascript/shared/transfersLayouts.js +++ b/app/frontend/javascript/shared/transfersLayouts.js @@ -54,7 +54,7 @@ const quadrantTransfers = function (requestsWithPlates) { plateObj.index, well.position.name, quadrantOffsets.rowOffset, - quadrantOffsets.colOffset + quadrantOffsets.colOffset, ) const transfer = { request: request, @@ -189,7 +189,7 @@ const buildSequentialTransfersArray = function (transferRequests) { // const buildSequentialLibrarySplitTransfersArray = function ( transferRequests, - numberOfWellsForEachSourcePlateInColumnOrder = 24 + numberOfWellsForEachSourcePlateInColumnOrder = 24, ) { const libraryTypes = [] return transferRequests.map((requestWithPlate) => { diff --git a/app/frontend/javascript/shared/tubeTransferVolumes.js b/app/frontend/javascript/shared/tubeTransferVolumes.js index 342f1cb00..4ca595ecf 100644 --- a/app/frontend/javascript/shared/tubeTransferVolumes.js +++ b/app/frontend/javascript/shared/tubeTransferVolumes.js @@ -13,10 +13,10 @@ const tubeMostRecentMolarity = function (tube) { const qcResults = tube?.receptacle?.qc_results const molarityEntries = qcResults?.filter((result) => result.key === 'molarity' && result.units === 'nM') const sortedByCreatedAt = molarityEntries?.sort( - (resultA, resultB) => -1 * ('' + resultA.created_at).localeCompare(resultB.created_at) + (resultA, resultB) => -1 * ('' + resultA.created_at).localeCompare(resultB.created_at), ) const sortedByIds = sortedByCreatedAt?.sort((resultA, resultB) => - parseInt(resultA.id) > parseInt(resultB.id) ? -1 : 1 + parseInt(resultA.id) > parseInt(resultB.id) ? -1 : 1, ) const mostRecentMolarityResult = sortedByIds?.[0] return mostRecentMolarityResult ? parseFloat(mostRecentMolarityResult?.value) : undefined diff --git a/app/frontend/javascript/test_support/factories/json_factory.js b/app/frontend/javascript/test_support/factories/json_factory.js index 56e4400c9..4490c68ef 100644 --- a/app/frontend/javascript/test_support/factories/json_factory.js +++ b/app/frontend/javascript/test_support/factories/json_factory.js @@ -71,7 +71,7 @@ const extractAssociations = (resource_config, attributeValues, resourceUrl) => { return { relationships, included } }, - { relationships: {}, included: [] } + { relationships: {}, included: [] }, ) } @@ -94,7 +94,7 @@ const buildMany = (associationName, associationValue) => { includeData.push(...singleResource.includeData) return { relationData, includeData } }, - { relationData: { data: [] }, includeData: [] } + { relationData: { data: [] }, includeData: [] }, ) } @@ -168,7 +168,7 @@ const jsonCollectionFactory = (factoryName, collectionAttributes, options = {}) included.push(...json.included) return { data, included } }, - { data: [], included: [] } + { data: [], included: [] }, ) return { diff --git a/app/frontend/javascript/test_support/factories/json_factory.spec.js b/app/frontend/javascript/test_support/factories/json_factory.spec.js index 036869523..bf9cbc073 100644 --- a/app/frontend/javascript/test_support/factories/json_factory.spec.js +++ b/app/frontend/javascript/test_support/factories/json_factory.spec.js @@ -242,7 +242,7 @@ describe('jsonCollectionFactory', () => { ], { base: 'assets/123/comments', - } + }, ) expect(json).toEqual({ diff --git a/app/frontend/javascript/test_support/factories/plate_factory.js b/app/frontend/javascript/test_support/factories/plate_factory.js index 53a9ac1d3..fc7d0b880 100644 --- a/app/frontend/javascript/test_support/factories/plate_factory.js +++ b/app/frontend/javascript/test_support/factories/plate_factory.js @@ -26,7 +26,7 @@ const plateFactory = function (options = {}) { position: { name: indexToName(iteration, 8) }, }, ..._wellOptions, - }) + }), ), } return { ...plateDefaults, ...(plateOptions || {}) } diff --git a/app/frontend/javascript/test_support/mock_api.spec.js b/app/frontend/javascript/test_support/mock_api.spec.js index f33ac7d1e..b0b795a80 100644 --- a/app/frontend/javascript/test_support/mock_api.spec.js +++ b/app/frontend/javascript/test_support/mock_api.spec.js @@ -42,7 +42,7 @@ describe('mockApi', () => { status: 500, }, ], - } + }, ) let response = await api.devour diff --git a/app/frontend/stylesheets/limber/spinner.scss b/app/frontend/stylesheets/limber/spinner.scss index ab8e7ad23..d2430970e 100644 --- a/app/frontend/stylesheets/limber/spinner.scss +++ b/app/frontend/stylesheets/limber/spinner.scss @@ -36,57 +36,111 @@ 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.087em -0.825em 0 -0.42em, + -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, + -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.338em -0.758em 0 -0.42em, + -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, + -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, + box-shadow: + 0 -0.83em 0 -0.4em, + -0.377em -0.74em 0 -0.42em, + -0.645em -0.522em 0 -0.44em, + -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } } @keyframes load6 { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.087em -0.825em 0 -0.42em, + -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, + -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.338em -0.758em 0 -0.42em, + -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, + -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, + box-shadow: + 0 -0.83em 0 -0.4em, + -0.377em -0.74em 0 -0.42em, + -0.645em -0.522em 0 -0.44em, + -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } } diff --git a/app/models/concerns/presenters/creation_behaviour.rb b/app/models/concerns/presenters/creation_behaviour.rb index 73f6b638a..385ce117a 100644 --- a/app/models/concerns/presenters/creation_behaviour.rb +++ b/app/models/concerns/presenters/creation_behaviour.rb @@ -23,10 +23,9 @@ def purposes_of_type(type) end def construct_buttons(scope) - scope.map do |purpose_uuid, purpose_settings| - LabwareCreators - .class_for(purpose_uuid) - .creator_button( + scope + .map do |purpose_uuid, purpose_settings| + LabwareCreators.class_for(purpose_uuid).creator_button( creator: LabwareCreators.class_for(purpose_uuid), parent_uuid: uuid, parent: labware, @@ -35,7 +34,8 @@ def construct_buttons(scope) type: purpose_settings.asset_type, filters: purpose_settings.filters || {} ) - end.force + end + .force end def active_pipelines diff --git a/app/models/concerns/presenters/extended_csv.rb b/app/models/concerns/presenters/extended_csv.rb index 43792c343..687b81192 100644 --- a/app/models/concerns/presenters/extended_csv.rb +++ b/app/models/concerns/presenters/extended_csv.rb @@ -57,14 +57,7 @@ def transfers_for_csv # rubocop:todo Metrics/AbcSize destination_barcode = ct.destination.barcode.machine transfers = ct.transfers.reverse_merge(all_wells).sort { |a, b| split_location(a.first) <=> split_location(b.first) } - { - source_ean:, - source_barcode:, - source_stock:, - destination_ean:, - destination_barcode:, - transfers: - } + { source_ean:, source_barcode:, source_stock:, destination_ean:, destination_barcode:, transfers: } end end end diff --git a/app/models/labware_creators/base.rb b/app/models/labware_creators/base.rb index 92c1913cd..5a3278750 100644 --- a/app/models/labware_creators/base.rb +++ b/app/models/labware_creators/base.rb @@ -117,9 +117,7 @@ def create_plate_from_parent! end def transfer!(attributes) - Sequencescape::Api::V2::Transfer.create!( - attributes.merge(transfer_template_uuid:, user_uuid:) - ) + Sequencescape::Api::V2::Transfer.create!(attributes.merge(transfer_template_uuid:, user_uuid:)) end def transfer_material_from_parent!(child_uuid) diff --git a/app/models/labware_creators/final_tube_from_plate.rb b/app/models/labware_creators/final_tube_from_plate.rb index 1537864e2..7fca03be6 100644 --- a/app/models/labware_creators/final_tube_from_plate.rb +++ b/app/models/labware_creators/final_tube_from_plate.rb @@ -48,11 +48,7 @@ def pass_tubes! raise StandardError, 'Tubes cannot be passed before transfer' if @create_transfer.nil? tubes_from_transfer.each do |tube_uuid| - Sequencescape::Api::V2::StateChange.create!( - target_state: 'passed', - target_uuid: tube_uuid, - user_uuid: - ) + Sequencescape::Api::V2::StateChange.create!(target_state: 'passed', target_uuid: tube_uuid, user_uuid:) end end diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 7c067a18d..51608f418 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -160,9 +160,7 @@ def create_submission_from_parent_tubes sequencescape_submission_parameters = { template_name: configured_params[:template_name], request_options: configured_params[:request_options], - asset_groups: [ - { assets: asset_uuids, autodetect_studies:, autodetect_projects: } - ], + asset_groups: [{ assets: asset_uuids, autodetect_studies:, autodetect_projects: }], api:, user: user_uuid } diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index d1aab1bd2..d640a3ca6 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -246,15 +246,14 @@ def transfer_material_from_parent!(child_plate) # @return [Array] An array of hashes representing the transfer requests. def transfer_request_attributes(child_plate) parent_tubes.each_with_object([]) do |(foreign_barcode, parent_tube), tube_transfers| - tube_transfers << - request_hash( - parent_tube.uuid, - child_plate - .wells - .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } - &.uuid, - { outer_request: source_tube_outer_request_uuid(parent_tube) } - ) + tube_transfers << request_hash( + parent_tube.uuid, + child_plate + .wells + .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } + &.uuid, + { outer_request: source_tube_outer_request_uuid(parent_tube) } + ) end end diff --git a/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb b/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb index c6b95285e..b7ff6d86f 100644 --- a/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb +++ b/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb @@ -14,8 +14,14 @@ module PcrCyclesBinnedPlate class CsvFileForDuplexSeq < CsvFileBase delegate :submit_for_sequencing_column, :sub_pool_column, :coverage_column, to: :well_details_header_row - FIELDS_FOR_WELL_DETAILS = %w[diluent_volume pcr_cycles submit_for_sequencing sub_pool coverage sample_volume] - .freeze + FIELDS_FOR_WELL_DETAILS = %w[ + diluent_volume + pcr_cycles + submit_for_sequencing + sub_pool + coverage + sample_volume + ].freeze # Returns the contents of the header row for the well detail columns def well_details_header_row diff --git a/app/models/labware_creators/plate_split_to_tube_racks.rb b/app/models/labware_creators/plate_split_to_tube_racks.rb index c9bd26883..e476eb7d5 100644 --- a/app/models/labware_creators/plate_split_to_tube_racks.rb +++ b/app/models/labware_creators/plate_split_to_tube_racks.rb @@ -654,9 +654,10 @@ def add_contingency_tube_metadata # @param tube_details [Hash] The tube details hash from the tube rack scan file. # @return [void] def add_tube_metadata(child_tube, tube_posn, tube_details) - LabwareMetadata - .new(user_uuid:, barcode: child_tube.barcode.machine) - .update!(tube_rack_barcode: tube_details['tube_rack_barcode'], tube_rack_position: tube_posn) + LabwareMetadata.new(user_uuid:, barcode: child_tube.barcode.machine).update!( + tube_rack_barcode: tube_details['tube_rack_barcode'], + tube_rack_position: tube_posn + ) end # Generates a transfer request hash for the given source well UUID, target tube UUID, and additional parameters. diff --git a/app/models/labware_creators/pooled_tubes_base.rb b/app/models/labware_creators/pooled_tubes_base.rb index 0ba193629..90f6e5965 100644 --- a/app/models/labware_creators/pooled_tubes_base.rb +++ b/app/models/labware_creators/pooled_tubes_base.rb @@ -41,12 +41,11 @@ def transfer_request_attributes # this currently assumes that pool_identifier will be the submission_uuid # (it would have always been, historically) pool.each do |location| - transfer_requests << - request_hash( - well_locations.fetch(location).uuid, - child_stock_tubes.fetch(name_for(pool)).uuid, - pool_identifier - ) + transfer_requests << request_hash( + well_locations.fetch(location).uuid, + child_stock_tubes.fetch(name_for(pool)).uuid, + pool_identifier + ) end end end diff --git a/app/models/labware_creators/pooled_tubes_by_sample.rb b/app/models/labware_creators/pooled_tubes_by_sample.rb index 8039a40ba..6b9e84a5e 100644 --- a/app/models/labware_creators/pooled_tubes_by_sample.rb +++ b/app/models/labware_creators/pooled_tubes_by_sample.rb @@ -69,12 +69,11 @@ def name_for_details(pool_identifier) def transfer_request_attributes pools.each_with_object([]) do |(pool_identifier, pool), transfer_requests| pool.each do |location| - transfer_requests << - request_hash( - well_locations.fetch(location).uuid, - child_stock_tubes.fetch(name_for(name_for_details(pool_identifier))).uuid, - pool_identifier - ) + transfer_requests << request_hash( + well_locations.fetch(location).uuid, + child_stock_tubes.fetch(name_for(name_for_details(pool_identifier))).uuid, + pool_identifier + ) end end end diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index 76745ae75..a2aedacce 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -17,12 +17,7 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission def create_child_stock_tubes api .specific_tube_creation - .create!( - user: user_uuid, - parents:, - child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: - ) + .create!(user: user_uuid, parents:, child_purposes: [purpose_uuid] * pool_uuids.length, tube_attributes:) .children .index_by(&:name) end diff --git a/app/models/labware_creators/quadrant_stamp_base.rb b/app/models/labware_creators/quadrant_stamp_base.rb index 1757dadc7..2cf134dc8 100644 --- a/app/models/labware_creators/quadrant_stamp_base.rb +++ b/app/models/labware_creators/quadrant_stamp_base.rb @@ -46,8 +46,9 @@ def source_plates_by_quadrant transfers.each do |transfer| target_well_location = transfer.dig(:new_target, :location) target_well_quadrant = WellHelpers.well_quadrant(target_well_location) - source_plates_uuids[target_well_quadrant] = transfer[:source_plate] if source_plates_uuids[target_well_quadrant] - .nil? + source_plates_uuids[target_well_quadrant] = transfer[:source_plate] if source_plates_uuids[ + target_well_quadrant + ].nil? end source_plates_uuids end diff --git a/app/models/robots/bed/invalid.rb b/app/models/robots/bed/invalid.rb index f707b1606..d881210d2 100644 --- a/app/models/robots/bed/invalid.rb +++ b/app/models/robots/bed/invalid.rb @@ -7,7 +7,8 @@ def initialize(barcode) @barcode = barcode end - def load(_plate_barcodes); end + def load(_plate_barcodes) + end def plate nil diff --git a/app/models/robots/bed/plate_to_tube_racks_bed.rb b/app/models/robots/bed/plate_to_tube_racks_bed.rb index 47fa24aa2..aa3d3c928 100644 --- a/app/models/robots/bed/plate_to_tube_racks_bed.rb +++ b/app/models/robots/bed/plate_to_tube_racks_bed.rb @@ -17,9 +17,7 @@ class PlateToTubeRacksBed < Robots::Bed::Base def labware_created_with_robot(robot_barcode) # RobotController uses machine barcode for initialising LabwareMetadata labware.tubes.each do |tube| - LabwareMetadata - .new(user_uuid:, barcode: tube.barcode.machine) - .update!(created_with_robot: robot_barcode) + LabwareMetadata.new(user_uuid:, barcode: tube.barcode.machine).update!(created_with_robot: robot_barcode) end end diff --git a/app/sequencescape/sequencescape/api/v2.rb b/app/sequencescape/sequencescape/api/v2.rb index 7891ecaa9..5b06efc3e 100644 --- a/app/sequencescape/sequencescape/api/v2.rb +++ b/app/sequencescape/sequencescape/api/v2.rb @@ -30,10 +30,7 @@ module Sequencescape::Api::V2 # @return [Sequencescape::V2::Api::Labware] Found labware object # def self.minimal_labware_by_barcode(barcode, select: :uuid) - Sequencescape::Api::V2::Labware - .where(barcode:) - .select(tube_racks: select, plates: select, tubes: select) - .first + Sequencescape::Api::V2::Labware.where(barcode:).select(tube_racks: select, plates: select, tubes: select).first end # sample_description added into includes here for use in bioscan plate label creation @@ -71,10 +68,7 @@ def self.plate_for_completion(uuid) end def self.tube_for_completion(uuid) - Tube - .includes('receptacle.aliquots.request.submission,receptacle.aliquots.request.request_type') - .find(uuid:) - .first + Tube.includes('receptacle.aliquots.request.submission,receptacle.aliquots.request.request_type').find(uuid:).first end def self.plate_with_custom_includes(include_params, search_params) diff --git a/app/sequencescape/sequencescape/api/v2/base.rb b/app/sequencescape/sequencescape/api/v2/base.rb index 2cb7a15e8..933fb5686 100644 --- a/app/sequencescape/sequencescape/api/v2/base.rb +++ b/app/sequencescape/sequencescape/api/v2/base.rb @@ -12,8 +12,12 @@ class SequencescapePaginator < JsonApiClient::Paginating::NestedParamPaginator # set the api base url in an abstract base class self.site = Limber::Application.config.api.v2.connection_options.url - connection.faraday.headers['X-Sequencescape-Client-Id'] = - Limber::Application.config.api.v2.connection_options.authorisation + connection.faraday.headers['X-Sequencescape-Client-Id'] = Limber::Application + .config + .api + .v2 + .connection_options + .authorisation self.plate = false self.tube = false self.paginator = SequencescapePaginator diff --git a/app/sequencescape/sequencescape/api/v2/receptacle.rb b/app/sequencescape/sequencescape/api/v2/receptacle.rb index b940df168..deb61afbc 100644 --- a/app/sequencescape/sequencescape/api/v2/receptacle.rb +++ b/app/sequencescape/sequencescape/api/v2/receptacle.rb @@ -11,7 +11,8 @@ def latest_molarity end def latest_qc(key:, units:) - qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work. + qc_results + .to_a # Convert to array to resolve any api queries. Otherwise select fails to work. .select { |qc| qc.key.casecmp(key).zero? } .select { |qc| qc.units.casecmp(units).zero? } .max_by(&:created_at) diff --git a/app/sequencescape/sequencescape/api/v2/well.rb b/app/sequencescape/sequencescape/api/v2/well.rb index 5b5a8b047..0cd141e8f 100644 --- a/app/sequencescape/sequencescape/api/v2/well.rb +++ b/app/sequencescape/sequencescape/api/v2/well.rb @@ -40,7 +40,8 @@ def latest_cell_viability end def latest_qc(key:, units:) - qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work. + qc_results + .to_a # Convert to array to resolve any api queries. Otherwise select fails to work. .select { |qc| qc.key.casecmp(key).zero? } .select { |qc| qc.units.casecmp(units).zero? } .max_by(&:created_at) diff --git a/bin/bundle b/bin/bundle index 374a0a1fa..8f0e1240e 100755 --- a/bin/bundle +++ b/bin/bundle @@ -8,107 +8,103 @@ # this file is here to facilitate running it. # -require "rubygems" +require 'rubygems' -m = Module.new do - module_function +m = + Module.new do + module_function - def invoked_as_script? - File.expand_path($0) == File.expand_path(__FILE__) - end + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end - def env_var_version - ENV["BUNDLER_VERSION"] - end + def env_var_version + ENV['BUNDLER_VERSION'] + end - def cli_arg_version - return unless invoked_as_script? # don't want to hijack other binstubs - return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` - bundler_version = nil - update_index = nil - ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN - bundler_version = a + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i end - next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ - bundler_version = $1 - update_index = i + bundler_version end - bundler_version - end - def gemfile - gemfile = ENV["BUNDLE_GEMFILE"] - return gemfile if gemfile && !gemfile.empty? + def gemfile + gemfile = ENV['BUNDLE_GEMFILE'] + return gemfile if gemfile && !gemfile.empty? - File.expand_path("../../Gemfile", __FILE__) - end - - def lockfile - lockfile = - case File.basename(gemfile) - when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) - else "#{gemfile}.lock" - end - File.expand_path(lockfile) - end + File.expand_path('../../Gemfile', __FILE__) + end - def lockfile_version - return unless File.file?(lockfile) - lockfile_contents = File.read(lockfile) - return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ - Regexp.last_match(1) - end + def lockfile + lockfile = + case File.basename(gemfile) + when 'gems.rb' + gemfile.sub(/\.rb$/, gemfile) + else + "#{gemfile}.lock" + end + File.expand_path(lockfile) + end - def bundler_requirement - @bundler_requirement ||= - env_var_version || cli_arg_version || - bundler_requirement_for(lockfile_version) - end + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end - def bundler_requirement_for(version) - return "#{Gem::Requirement.default}.a" unless version + def bundler_requirement + @bundler_requirement ||= env_var_version || cli_arg_version || bundler_requirement_for(lockfile_version) + end - bundler_gem_version = Gem::Version.new(version) + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version - requirement = bundler_gem_version.approximate_recommendation + bundler_gem_version = Gem::Version.new(version) - return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") + requirement = bundler_gem_version.approximate_recommendation - requirement += ".a" if bundler_gem_version.prerelease? + return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.7.0') - requirement - end + requirement += '.a' if bundler_gem_version.prerelease? - def load_bundler! - ENV["BUNDLE_GEMFILE"] ||= gemfile + requirement + end - activate_bundler - end + def load_bundler! + ENV['BUNDLE_GEMFILE'] ||= gemfile - def activate_bundler - gem_error = activation_error_handling do - gem "bundler", bundler_requirement + activate_bundler end - return if gem_error.nil? - require_error = activation_error_handling do - require "bundler/version" + + def activate_bundler + gem_error = activation_error_handling { gem 'bundler', bundler_requirement } + return if gem_error.nil? + require_error = activation_error_handling { require 'bundler/version' } + if require_error.nil? && + Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + return + end + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 end - return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) - warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" - exit 42 - end - def activation_error_handling - yield - nil - rescue StandardError, LoadError => e - e + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end end -end m.load_bundler! -if m.invoked_as_script? - load Gem.bin_path("bundler", "bundle") -end +load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script? diff --git a/bin/rails b/bin/rails index efc037749..073966023 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path("../config/application", __dir__) -require_relative "../config/boot" -require "rails/commands" +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index 4fbf10b96..17240489f 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -require_relative "../config/boot" -require "rake" +require_relative '../config/boot' +require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index 1ac8ce0b7..dc69ded5d 100755 --- a/bin/setup +++ b/bin/setup @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require "fileutils" +require 'fileutils' # path to your application root. APP_ROOT = File.expand_path('..', __dir__) diff --git a/bin/vite b/bin/vite index 11fb801e6..9d3b5d5fd 100755 --- a/bin/vite +++ b/bin/vite @@ -8,22 +8,23 @@ # this file is here to facilitate running it. # -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath) -bundle_binstub = File.expand_path("../bundle", __FILE__) +bundle_binstub = File.expand_path('../bundle', __FILE__) if File.file?(bundle_binstub) if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ load(bundle_binstub) else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + abort( + 'Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.' + ) end end -require "rubygems" -require "bundler/setup" +require 'rubygems' +require 'bundler/setup' -load Gem.bin_path("vite_ruby", "vite") +load Gem.bin_path('vite_ruby', 'vite') diff --git a/bin/yarn b/bin/yarn index 9fab2c350..36d20fc9e 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,17 +1,19 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - yarn = ENV["PATH"].split(File::PATH_SEPARATOR). - select { |dir| File.expand_path(dir) != __dir__ }. - product(["yarn", "yarn.cmd", "yarn.ps1"]). - map { |dir, file| File.expand_path(file, dir) }. - find { |file| File.executable?(file) } + yarn = + ENV['PATH'] + .split(File::PATH_SEPARATOR) + .select { |dir| File.expand_path(dir) != __dir__ } + .product(%w[yarn yarn.cmd yarn.ps1]) + .map { |dir, file| File.expand_path(file, dir) } + .find { |file| File.executable?(file) } if yarn exec yarn, *ARGV else - $stderr.puts "Yarn executable was not detected in the system." - $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + $stderr.puts 'Yarn executable was not detected in the system.' + $stderr.puts 'Download Yarn at https://yarnpkg.com/en/docs/install' exit 1 end end diff --git a/lib/purpose_config.rb b/lib/purpose_config.rb index 7c94766b4..f08522d3f 100644 --- a/lib/purpose_config.rb +++ b/lib/purpose_config.rb @@ -109,14 +109,13 @@ def register! # maintains the behaviour of version 1, but includes an addditional # asset_shape option if configured. It raises an error if the purpose # cannot be created. - options_for_creation = - { - name:, - stock_plate: config.fetch(:stock_plate, false), - cherrypickable_target: config.fetch(:cherrypickable_target, false), - input_plate: config.fetch(:input_plate, false), - size: config.fetch(:size, 96) - }.merge(config.slice(:asset_shape)) + options_for_creation = { + name:, + stock_plate: config.fetch(:stock_plate, false), + cherrypickable_target: config.fetch(:cherrypickable_target, false), + input_plate: config.fetch(:input_plate, false), + size: config.fetch(:size, 96) + }.merge(config.slice(:asset_shape)) Sequencescape::Api::V2::PlatePurpose.create!(options_for_creation) end end diff --git a/lib/robot_configuration.rb b/lib/robot_configuration.rb index daabc102c..d17f7f711 100644 --- a/lib/robot_configuration.rb +++ b/lib/robot_configuration.rb @@ -32,13 +32,7 @@ def custom_robot(key, hash) end def bravo_robot(transition_to: 'passed', verify_robot: false, require_robot: false, &) - simple_robot( - 'bravo', - transition_to:, - verify_robot:, - require_robot:, - & - ) + simple_robot('bravo', transition_to:, verify_robot:, require_robot:, &) end def simple_robot(type, transition_to: 'passed', verify_robot: false, require_robot: false, &) diff --git a/lib/tasks/config.rake b/lib/tasks/config.rake index 75630953a..cbfafcba1 100644 --- a/lib/tasks/config.rake +++ b/lib/tasks/config.rake @@ -48,8 +48,10 @@ namespace :config do # TODO: Y24-190 - Remove this once we have moved everything else over to V2; # also the config entries for :searches puts 'Preparing searches ...' - configuration[:searches] = - api.search.all.each_with_object({}) { |search, searches| searches[search.name] = search.uuid } + configuration[:searches] = api + .search + .all + .each_with_object({}) { |search, searches| searches[search.name] = search.uuid } puts 'Preparing transfer templates ...' query = Sequencescape::Api::V2::TransferTemplate.select(:uuid, :name).paginate(per_page: 100) @@ -65,14 +67,14 @@ namespace :config do default_count: 2 } - configuration[:purposes] = - {}.tap do |labware_purposes| - puts 'Preparing purpose configs...' - purpose_config.each { |purpose| labware_purposes[purpose.uuid] = purpose.config } - end + configuration[:purposes] = {}.tap do |labware_purposes| + puts 'Preparing purpose configs...' + purpose_config.each { |purpose| labware_purposes[purpose.uuid] = purpose.config } + end - configuration[:purpose_uuids] = - tracked_purposes.each_with_object({}) { |purpose, store| store[purpose.name] = purpose.uuid } + configuration[:purpose_uuids] = tracked_purposes.each_with_object({}) do |purpose, store| + store[purpose.name] = purpose.uuid + end configuration[:robots] = ROBOT_CONFIG diff --git a/limber.sublime-project b/limber.sublime-project index ff819a7c3..4f8e6d07c 100644 --- a/limber.sublime-project +++ b/limber.sublime-project @@ -22,12 +22,12 @@ "*.swf", "*.jar", "*.zip", - "*.xls" - ] + "*.xls", + ], }, { - "path": "coverage" - } + "path": "coverage", + }, ], // These settings will be applied to anyone working // on the project. They are intended to set up the accepted @@ -35,6 +35,6 @@ "settings": { "tab_size": 2, "translate_tabs_to_spaces": true, - "trim_trailing_white_space_on_save": true - } + "trim_trailing_white_space_on_save": true, + }, } diff --git a/public/404.html b/public/404.html index c5194504f..68d177fa2 100644 --- a/public/404.html +++ b/public/404.html @@ -1,4 +1,4 @@ - + The page you were looking for doesn't exist (404) diff --git a/public/422.html b/public/422.html index d16dd7f62..9e9cf0df2 100644 --- a/public/422.html +++ b/public/422.html @@ -1,4 +1,4 @@ - + The change you wanted was rejected (422) diff --git a/public/500.html b/public/500.html index 5a03944b5..0fc2fcef7 100644 --- a/public/500.html +++ b/public/500.html @@ -1,4 +1,4 @@ - + We're sorry, but something went wrong (500) diff --git a/public/502.html b/public/502.html index b5082d265..6f09738ed 100644 --- a/public/502.html +++ b/public/502.html @@ -1,4 +1,4 @@ - + We're sorry, but something went wrong (502) diff --git a/public/504.html b/public/504.html index 95e94d118..c8927e613 100644 --- a/public/504.html +++ b/public/504.html @@ -1,4 +1,4 @@ - + We're sorry, but something took too long (504) diff --git a/spec/controllers/exports_controller_spec.rb b/spec/controllers/exports_controller_spec.rb index 2492d5a68..bd2013c92 100644 --- a/spec/controllers/exports_controller_spec.rb +++ b/spec/controllers/exports_controller_spec.rb @@ -63,9 +63,10 @@ context 'on generating a csv' do before do - expect(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(includes, barcode: plate_barcode) - .and_return(plate) + expect(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + includes, + barcode: plate_barcode + ).and_return(plate) end context 'where csv id requested is concentrations_ngul.csv' do @@ -318,9 +319,10 @@ before do # Make the controller to receive the plate. # NB. Uses plate_includes if specified in the export configuration. - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(export.plate_includes, barcode: plate_barcode) - .and_return(plate) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + export.plate_includes, + barcode: plate_barcode + ).and_return(plate) # Make the controller to use the export loaded from fixture config. allow(subject).to receive(:export).and_return(export) @@ -334,16 +336,17 @@ asset_ancestors = ancestor_plates.map { |ancestor_plate| double('Sequencescape::Api::V2::Asset', id: ancestor_plate.id) } - allow(plate).to receive_message_chain(:ancestors, :where) - .with(purpose_name: export.ancestor_purpose) - .and_return(asset_ancestors) + allow(plate).to receive_message_chain(:ancestors, :where).with(purpose_name: export.ancestor_purpose).and_return( + asset_ancestors + ) # Stub the plate_with_custom_includes query to return the first ancestor plate. # NB. This stub is required to make the other methods in the show controller # action not to fail when they try to receive the first ancestor plate. - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(export.plate_includes, id: asset_ancestors.first.id) - .and_return(ancestor_plates.first) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + export.plate_includes, + id: asset_ancestors.first.id + ).and_return(ancestor_plates.first) # Stub the plate query to return ancestor plates. builder = double('JsonApiClient::Query::Builder') diff --git a/spec/controllers/plates_controller_spec.rb b/spec/controllers/plates_controller_spec.rb index c109524ee..27a3e5c02 100644 --- a/spec/controllers/plates_controller_spec.rb +++ b/spec/controllers/plates_controller_spec.rb @@ -83,19 +83,7 @@ def expect_state_change_create(attributes) reason: 'Individual Well Failure' ) - post :fail_wells, - params: { - id: plate_uuid, - plate: { - wells: { - 'A1' => 1, - 'B1' => 0 - } - } - }, - session: { - user_uuid: - } + post :fail_wells, params: { id: plate_uuid, plate: { wells: { 'A1' => 1, 'B1' => 0 } } }, session: { user_uuid: } expect(response).to redirect_to(limber_plate_path(plate_uuid)) end diff --git a/spec/controllers/qc_files_controller_spec.rb b/spec/controllers/qc_files_controller_spec.rb index d2a97f533..08a27646c 100644 --- a/spec/controllers/qc_files_controller_spec.rb +++ b/spec/controllers/qc_files_controller_spec.rb @@ -12,14 +12,12 @@ before do stub_api_get(file_uuid, body: json(:qc_file, uuid: file_uuid, filename:)) - stub_request(:get, api_url_for(file_uuid)) - .with(headers: { 'Accept' => 'sequencescape/qc_file' }) - .to_return( - body: 'example file content', - headers: { - 'Content-Disposition' => "attachment; filename=\"#{filename}\"" - } - ) + stub_request(:get, api_url_for(file_uuid)).with(headers: { 'Accept' => 'sequencescape/qc_file' }).to_return( + body: 'example file content', + headers: { + 'Content-Disposition' => "attachment; filename=\"#{filename}\"" + } + ) end it 'returns a file' do @@ -39,21 +37,19 @@ let(:plate_uuid) { 'plate-uuid' } let(:stub_post) do - stub_request(:post, api_url_for(plate_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="test_file.txt"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'test_file.txt'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(plate_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="test_file.txt"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'test_file.txt'), + headers: { + 'content-type' => 'application/json' + } + ) end before do diff --git a/spec/controllers/tube_creation_controller_spec.rb b/spec/controllers/tube_creation_controller_spec.rb index 7e486018b..049073624 100644 --- a/spec/controllers/tube_creation_controller_spec.rb +++ b/spec/controllers/tube_creation_controller_spec.rb @@ -23,14 +23,7 @@ describe '#new' do it 'creates a tube from a tube parent' do - get :new, - params: { - limber_tube_id: parent_uuid, - purpose_uuid: child_purpose_uuid - }, - session: { - user_uuid: - } + get :new, params: { limber_tube_id: parent_uuid, purpose_uuid: child_purpose_uuid }, session: { user_uuid: } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) expect(assigns(:labware_creator).user_uuid).to eq(user_uuid) @@ -38,14 +31,7 @@ end it 'creates a tube from a plate parent' do - get :new, - params: { - limber_plate_id: parent_uuid, - purpose_uuid: child_purpose_uuid - }, - session: { - user_uuid: - } + get :new, params: { limber_plate_id: parent_uuid, purpose_uuid: child_purpose_uuid }, session: { user_uuid: } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) expect(assigns(:labware_creator).user_uuid).to eq(user_uuid) diff --git a/spec/controllers/tubes/tubes_exports_controller_spec.rb b/spec/controllers/tubes/tubes_exports_controller_spec.rb index 365f41e70..e32037013 100644 --- a/spec/controllers/tubes/tubes_exports_controller_spec.rb +++ b/spec/controllers/tubes/tubes_exports_controller_spec.rb @@ -29,9 +29,11 @@ context 'on generating a csv' do before do - expect(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with(includes, selects, barcode: tube_barcode) - .and_return(tube) + expect(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + includes, + selects, + barcode: tube_barcode + ).and_return(tube) end context 'where tsv id requested is bioscan_mbrave.tsv' do diff --git a/spec/factories/plate_factories.rb b/spec/factories/plate_factories.rb index ce72cbfe1..b4cd3cc6c 100644 --- a/spec/factories/plate_factories.rb +++ b/spec/factories/plate_factories.rb @@ -355,21 +355,20 @@ pooled_wells = wells.reject { |w| empty_wells.include?(w) } pool_hash = {} pool_sizes.each_with_index do |pool_size, index| - pool_hash["pool-#{index + 1}-uuid"] = - { - 'wells' => pooled_wells.shift(pool_size).sort_by { |well| WellHelpers.row_order(size).index(well) }, - 'insert_size' => { - from: 100, - to: 300 - }, - 'library_type' => { - name: library_type - }, - 'request_type' => request_type, - 'pcr_cycles' => pool_prc_cycles[index], - 'for_multiplexing' => pool_for_multiplexing[index], - 'pool_complete' => pool_complete - }.merge(extra_pool_info) + pool_hash["pool-#{index + 1}-uuid"] = { + 'wells' => pooled_wells.shift(pool_size).sort_by { |well| WellHelpers.row_order(size).index(well) }, + 'insert_size' => { + from: 100, + to: 300 + }, + 'library_type' => { + name: library_type + }, + 'request_type' => request_type, + 'pcr_cycles' => pool_prc_cycles[index], + 'for_multiplexing' => pool_for_multiplexing[index], + 'pool_complete' => pool_complete + }.merge(extra_pool_info) end pool_hash end diff --git a/spec/factories/poly_metadata_factories.rb b/spec/factories/poly_metadata_factories.rb index 754d5bc01..f92dd7ab4 100644 --- a/spec/factories/poly_metadata_factories.rb +++ b/spec/factories/poly_metadata_factories.rb @@ -12,7 +12,8 @@ after(:build) do |poly_metadatum, evaluator| poly_metadatum.relationships.metadatable = { - 'links' => {}, + 'links' => { + }, 'data' => { 'type' => 'Request', 'id' => evaluator.metadatable.id diff --git a/spec/factories/purpose_config_factories.rb b/spec/factories/purpose_config_factories.rb index 943eafab3..35f9e2147 100644 --- a/spec/factories/purpose_config_factories.rb +++ b/spec/factories/purpose_config_factories.rb @@ -238,11 +238,13 @@ { 'Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => {} + 'request_options' => { + } }, 'Another Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => {} + 'request_options' => { + } } } end @@ -267,14 +269,7 @@ # Configuration to set number_of_source_wells argument factory :pooled_wells_by_sample_in_groups_purpose_config do transient { number_of_source_wells { 2 } } - creator_class do - { - name: 'LabwareCreators::PooledWellsBySampleInGroups', - args: { - number_of_source_wells: - } - } - end + creator_class { { name: 'LabwareCreators::PooledWellsBySampleInGroups', args: { number_of_source_wells: } } } end factory :multi_stamp_tubes_using_tube_rack_scan_purpose_config do diff --git a/spec/factories/strategies/api_strategy.rb b/spec/factories/strategies/api_strategy.rb index 588c984fb..79432b1d6 100644 --- a/spec/factories/strategies/api_strategy.rb +++ b/spec/factories/strategies/api_strategy.rb @@ -11,7 +11,8 @@ def initialize delegate :association, to: :@strategy - def result(evaluation); end + def result(evaluation) + end end FactoryBot.register_strategy(:api_object, ApiStrategy) diff --git a/spec/factories/tube_factories.rb b/spec/factories/tube_factories.rb index ec5589e4b..78909e056 100644 --- a/spec/factories/tube_factories.rb +++ b/spec/factories/tube_factories.rb @@ -112,9 +112,7 @@ request_factory { :library_request } aliquot_count { 2 } aliquot_factory { :v2_tagged_aliquot } - aliquots do - create_list aliquot_factory, aliquot_count, library_state:, outer_request: - end + aliquots { create_list aliquot_factory, aliquot_count, library_state:, outer_request: } parents { [] } purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } @@ -180,9 +178,7 @@ tube_factory { :multiplexed_library_tube } study_count { 1 } end - children do - Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } - end + children { Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } } end factory :tube_collection_with_barcodes_specified do diff --git a/spec/factories/tube_rack_factories.rb b/spec/factories/tube_rack_factories.rb index ef18b454b..cabb37717 100644 --- a/spec/factories/tube_rack_factories.rb +++ b/spec/factories/tube_rack_factories.rb @@ -20,9 +20,7 @@ purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } tubes { {} } - racked_tubes do - tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } - end + racked_tubes { tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } } end id diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 8066a81ae..2d4e50aed 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -196,13 +196,7 @@ associated(:empty_well, location:, uuid: "example-well-uuid-#{i}") else state = custom_state[location] || default_state - associated( - :well, - location:, - uuid: "example-well-uuid-#{i}", - state:, - aliquot_factory: - ) + associated(:well, location:, uuid: "example-well-uuid-#{i}", state:, aliquot_factory:) end end end diff --git a/spec/features/charge_and_pass_libraries_spec.rb b/spec/features/charge_and_pass_libraries_spec.rb index 997902ce5..1ad692cf3 100644 --- a/spec/features/charge_and_pass_libraries_spec.rb +++ b/spec/features/charge_and_pass_libraries_spec.rb @@ -10,9 +10,7 @@ let(:user_swipecard) { 'abcdef' } let(:labware_barcode) { SBCF::SangerBarcode.new(prefix: 'DN', number: 1).machine_barcode.to_s } let(:labware_uuid) { SecureRandom.uuid } - let(:work_completion_request) do - { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } - end + let(:work_completion_request) { { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } } let(:work_completion) { json :work_completion } let(:template_uuid) { SecureRandom.uuid } @@ -52,14 +50,7 @@ end context 'tube with submissions to be made' do - before do - create :passable_tube, - submission: { - request_options:, - template_uuid: - }, - uuid: 'example-purpose-uuid' - end + before { create :passable_tube, submission: { request_options:, template_uuid: }, uuid: 'example-purpose-uuid' } let(:submissions) { [] } let(:request_options) { { read_length: '150' } } let(:labware_barcode) { example_tube_v2.labware_barcode.machine } diff --git a/spec/features/creating_a_plate_spec.rb b/spec/features/creating_a_plate_spec.rb index 6e9bf6084..a3eeec60f 100644 --- a/spec/features/creating_a_plate_spec.rb +++ b/spec/features/creating_a_plate_spec.rb @@ -33,11 +33,7 @@ end let(:another_plate) do - create :v2_stock_plate, - barcode_number: 106, - uuid: another_plate_uuid, - wells:, - purpose_name: 'Limber Cherrypicked' + create :v2_stock_plate, barcode_number: 106, uuid: another_plate_uuid, wells:, purpose_name: 'Limber Cherrypicked' end let(:alternative_plate) do @@ -125,9 +121,9 @@ allow(child_plate).to receive(:stock_plates).and_return(stock_plates) allow(child_plate).to receive(:stock_plate).and_return(stock_plates.last) allow(child_plate).to receive(:ancestors).and_return(ancestors_scope) - allow(ancestors_scope).to receive(:where) - .with(purpose_name: alternative_purpose_name) - .and_return([alternative_plate]) + allow(ancestors_scope).to receive(:where).with(purpose_name: alternative_purpose_name).and_return( + [alternative_plate] + ) allow(job).to receive(:save).and_return(true) allow(PMB::PrintJob).to receive(:new) do |args| diff --git a/spec/features/creating_a_tag_plate_spec.rb b/spec/features/creating_a_tag_plate_spec.rb index 2ca63e57e..79aa1b37d 100644 --- a/spec/features/creating_a_tag_plate_spec.rb +++ b/spec/features/creating_a_tag_plate_spec.rb @@ -49,10 +49,12 @@ background do # Set-up the plate config create :purpose_config, uuid: 'stock-plate-purpose-uuid', name: 'Limber Cherrypicked' - create(:tagged_purpose_config, - tag_layout_templates: acceptable_templates, - uuid: child_purpose_uuid, - enforce_same_template_within_pool:) + create( + :tagged_purpose_config, + tag_layout_templates: acceptable_templates, + uuid: child_purpose_uuid, + enforce_same_template_within_pool: + ) create :pipeline, relationships: { 'Limber Cherrypicked' => 'Tag Purpose' } # We look up the user diff --git a/spec/features/failing_quadrants_spec.rb b/spec/features/failing_quadrants_spec.rb index d063e42e2..dbd1fe632 100644 --- a/spec/features/failing_quadrants_spec.rb +++ b/spec/features/failing_quadrants_spec.rb @@ -20,12 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, - uuid: plate_uuid, - purpose_uuid: 'stock-plate-purpose-uuid', - state: 'passed', - wells:, - size: 384 + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells:, size: 384 end let(:state_change_attributes) do diff --git a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb index 04cb0e4cb..f697ec3b6 100644 --- a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb @@ -135,12 +135,7 @@ expect_api_v2_posts( 'Transfer', [plate_uuid, plate_uuid_2].map do |source_uuid| - { - user_uuid:, - source_uuid:, - destination_uuid: 'tube-0', - transfer_template_uuid: 'whole-plate-to-tube' - } + { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } end ) diff --git a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb index ce4e25992..40a593e30 100644 --- a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb @@ -145,22 +145,21 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with( - include_used: false, - purpose_name: ['example-purpose'], - includes: 'purpose', - paginate: { - size: 30, - number: 1 - } - ) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + include_used: false, + purpose_name: ['example-purpose'], + includes: 'purpose', + paginate: { + size: 30, + number: 1 + } + ).and_return([example_v2_tube, example_v2_tube2]) # Parent lookup - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with(barcode: [tube_barcode_1, tube_barcode_2], includes: []) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + barcode: [tube_barcode_1, tube_barcode_2], + includes: [] + ).and_return([example_v2_tube, example_v2_tube2]) # Allow parent plates to be found in API v2 stub_v2_plate(parent_1, stub_search: false) @@ -186,22 +185,21 @@ stub_v2_tube(example_v2_tube2) # Available tubes search - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with( - include_used: false, - purpose_name: ['example-purpose'], - includes: 'purpose', - paginate: { - size: 30, - number: 1 - } - ) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + include_used: false, + purpose_name: ['example-purpose'], + includes: 'purpose', + paginate: { + size: 30, + number: 1 + } + ).and_return([example_v2_tube, example_v2_tube2]) # Parent lookup - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with(barcode: [tube_barcode_1, tube_barcode_2], includes: []) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + barcode: [tube_barcode_1, tube_barcode_2], + includes: [] + ).and_return([example_v2_tube, example_v2_tube2]) # Old API still used when loading parent stub_api_get(tube_uuid, body: example_tube) diff --git a/spec/features/viewing_a_plate_spec.rb b/spec/features/viewing_a_plate_spec.rb index 222acfb29..db1a0ccf9 100644 --- a/spec/features/viewing_a_plate_spec.rb +++ b/spec/features/viewing_a_plate_spec.rb @@ -12,12 +12,7 @@ let(:state) { 'pending' } let(:purpose_uuid) { 'stock-plate-purpose-uuid' } let(:example_plate) do - create :v2_stock_plate, - uuid: plate_uuid, - barcode_number: 1, - state:, - wells: wells_collection, - purpose_uuid: + create :v2_stock_plate, uuid: plate_uuid, barcode_number: 1, state:, wells: wells_collection, purpose_uuid: end let(:wells_collection) { %w[A1 B1].map { |loc| create(:v2_well, state:, position: { 'name' => loc }) } } let(:printer_list) { create_list(:v2_tube_barcode_printer, 2) + create_list(:v2_plate_barcode_printer, 2) } diff --git a/spec/helpers/barcode_labels_helper_spec.rb b/spec/helpers/barcode_labels_helper_spec.rb index 4fabe3f3d..be355d26e 100644 --- a/spec/helpers/barcode_labels_helper_spec.rb +++ b/spec/helpers/barcode_labels_helper_spec.rb @@ -22,20 +22,12 @@ end it 'renders a partial' do - barcode_printing_form( - labels:, - redirection_url:, - default_printer_name: - ) + barcode_printing_form(labels:, redirection_url:, default_printer_name:) expect(rendered).to be_truthy end it 'has the right locals set' do - barcode_printing_form( - labels:, - redirection_url:, - default_printer_name: - ) + barcode_printing_form(labels:, redirection_url:, default_printer_name:) printer_types = labels.map(&:printer_type) printers = @printers.select { |printer| printer_types.include?(printer.barcode_type) } diff --git a/spec/helpers/plate_helpers_spec.rb b/spec/helpers/plate_helpers_spec.rb index df6be63cc..d39590660 100644 --- a/spec/helpers/plate_helpers_spec.rb +++ b/spec/helpers/plate_helpers_spec.rb @@ -66,9 +66,7 @@ ] end - let(:plate_for_precap) do - build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: - end + let(:plate_for_precap) { build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: } let(:expected_result) do [ diff --git a/spec/models/labware_creators/concentration_binned_plate_spec.rb b/spec/models/labware_creators/concentration_binned_plate_spec.rb index faba3bdef..0528e6604 100644 --- a/spec/models/labware_creators/concentration_binned_plate_spec.rb +++ b/spec/models/labware_creators/concentration_binned_plate_spec.rb @@ -85,10 +85,12 @@ let(:user_uuid) { 'user-uuid' } before do - create(:concentration_binning_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create( + :concentration_binning_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name: + ) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/concentration_normalised_plate_spec.rb b/spec/models/labware_creators/concentration_normalised_plate_spec.rb index dfb7dcd44..8ae7238fe 100644 --- a/spec/models/labware_creators/concentration_normalised_plate_spec.rb +++ b/spec/models/labware_creators/concentration_normalised_plate_spec.rb @@ -115,9 +115,9 @@ it 'makes the expected requests' do # NB. qc assay post is done using v2 Api, whereas plate creation and transfers posts are using v1 Api - expect(Sequencescape::Api::V2::QcAssay).to receive(:create) - .with(qc_results: dest_well_qc_attributes) - .and_return(true) + expect(Sequencescape::Api::V2::QcAssay).to receive(:create).with( + qc_results: dest_well_qc_attributes + ).and_return(true) expect(subject.save!).to eq true expect(plate_creation_request).to have_been_made expect(transfer_creation_request).to have_been_made diff --git a/spec/models/labware_creators/custom_pooled_tubes_spec.rb b/spec/models/labware_creators/custom_pooled_tubes_spec.rb index 5545c6188..2f6b027f9 100644 --- a/spec/models/labware_creators/custom_pooled_tubes_spec.rb +++ b/spec/models/labware_creators/custom_pooled_tubes_spec.rb @@ -56,21 +56,19 @@ let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, file: } } let(:stub_qc_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="robot_pooling_file.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'pooling_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="robot_pooling_file.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'pooling_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:tube_creation_request_uuid) { SecureRandom.uuid } diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 4db2cfda0..db926109c 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -132,14 +132,7 @@ def expect_transfer_creation def expect_state_change_creation expect_api_v2_posts( 'StateChange', - [ - { - reason: 'Used in Library creation', - target_uuid: tag_plate_uuid, - target_state: 'exhausted', - user_uuid: - } - ] + [{ reason: 'Used in Library creation', target_uuid: tag_plate_uuid, target_state: 'exhausted', user_uuid: }] ) end @@ -163,7 +156,8 @@ def expect_state_change_creation direction: 'column', walking_by: 'manual by plate', initial_tag: '1', - substitutions: {}, + substitutions: { + }, tags_per_well: 1 } } diff --git a/spec/models/labware_creators/donor_pooling_spec.rb b/spec/models/labware_creators/donor_pooling_spec.rb index f1cea5e51..e44afaf62 100644 --- a/spec/models/labware_creators/donor_pooling_spec.rb +++ b/spec/models/labware_creators/donor_pooling_spec.rb @@ -67,16 +67,13 @@ create(:donor_pooling_config) # Create the plate purpose config and add to Settings. - create( - :donor_pooling_plate_purpose_config, - uuid: child_purpose_uuid, - default_number_of_pools: - ) + create(:donor_pooling_plate_purpose_config, uuid: child_purpose_uuid, default_number_of_pools:) # Allow the API call to return two plates by default. - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return(source_plates) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return(source_plates) end describe '.attributes' do @@ -590,9 +587,10 @@ describe '#source_barcodes_must_be_different' do before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] * 2 } it 'reports the error' do @@ -611,9 +609,10 @@ [well] end before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] } it 'allows plate creation' do @@ -626,9 +625,10 @@ describe '#source_plates_must_exist' do let(:barcodes) { [parent_1_plate.human_barcode, 'NOT-A-PLATE-BARCODE'] } before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end it 'reports the error' do expect(subject).not_to be_valid diff --git a/spec/models/labware_creators/final_tube_from_plate_spec.rb b/spec/models/labware_creators/final_tube_from_plate_spec.rb index bea569281..bee607d05 100644 --- a/spec/models/labware_creators/final_tube_from_plate_spec.rb +++ b/spec/models/labware_creators/final_tube_from_plate_spec.rb @@ -35,13 +35,7 @@ it 'pools by submission' do expect_api_v2_posts( 'Transfer', - [ - { - user_uuid:, - source_uuid: parent_uuid, - transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' - } - ], + [{ user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' }], [transfer] ) diff --git a/spec/models/labware_creators/fixed_normalised_plate_spec.rb b/spec/models/labware_creators/fixed_normalised_plate_spec.rb index 521c84180..c0cdfd840 100644 --- a/spec/models/labware_creators/fixed_normalised_plate_spec.rb +++ b/spec/models/labware_creators/fixed_normalised_plate_spec.rb @@ -85,10 +85,7 @@ let(:user_uuid) { 'user-uuid' } before do - create(:fixed_normalisation_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create(:fixed_normalisation_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( diff --git a/spec/models/labware_creators/merged_plate_spec.rb b/spec/models/labware_creators/merged_plate_spec.rb index f80d4481c..eaedb49fa 100644 --- a/spec/models/labware_creators/merged_plate_spec.rb +++ b/spec/models/labware_creators/merged_plate_spec.rb @@ -81,12 +81,10 @@ describe '#save!' do before do allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with( - { barcode: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] }, - includes: plate_includes - ) - .and_return([source_plate_1, source_plate_2]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_2]) ) end @@ -209,9 +207,10 @@ ) stub_v2_plate(source_plate_3, stub_search: false) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1, source_plate_3]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_3]) ) end @@ -251,9 +250,10 @@ ) stub_v2_plate(source_plate_3, stub_search: false) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1, source_plate_3]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_3]) ) end @@ -262,12 +262,7 @@ context 'with a missing barcode' do let(:form_attributes) do - { - purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, - barcodes: [source_plate_1.barcode.machine, ''] - } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, barcodes: [source_plate_1.barcode.machine, ''] } end before do @@ -279,9 +274,9 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1]) + receive(:find_all).with({ barcode: [source_plate_1.barcode.machine] }, includes: plate_includes).and_return( + [source_plate_1] + ) ) end @@ -309,9 +304,10 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1]) ) end @@ -349,9 +345,10 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1, source_plate_4]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_4]) ) end diff --git a/spec/models/labware_creators/multi_stamp_tubes_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_spec.rb index a32ee3206..aefd4d001 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_spec.rb @@ -207,9 +207,9 @@ body: json(:v1_custom_metadatum_collection) ) - expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells) - .with(child_uuid) - .and_return(child_plate_v2) + expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells).with(child_uuid).and_return( + child_plate_v2 + ) expect(subject).to receive(:source_tube_outer_request_uuid).with(parent1).and_return('outer-request-1') expect(subject).to receive(:source_tube_outer_request_uuid).with(parent2).and_return('outer-request-2') end diff --git a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb index 00e0975b1..1984cbd17 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb @@ -132,21 +132,19 @@ end let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:child_plate_v1) do @@ -155,12 +153,14 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: 'AB10000001', includes: tube_includes) - .and_return(parent_tube_1) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: 'AB10000002', includes: tube_includes) - .and_return(parent_tube_2) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( + barcode: 'AB10000001', + includes: tube_includes + ).and_return(parent_tube_1) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( + barcode: 'AB10000002', + includes: tube_includes + ).and_return(parent_tube_2) stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) @@ -284,9 +284,10 @@ subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: 'AB10000003', includes: tube_includes) - .and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( + barcode: 'AB10000003', + includes: tube_includes + ).and_return(nil) subject.validate end diff --git a/spec/models/labware_creators/normalised_binned_plate_spec.rb b/spec/models/labware_creators/normalised_binned_plate_spec.rb index 158dcee46..bd3ce6b87 100644 --- a/spec/models/labware_creators/normalised_binned_plate_spec.rb +++ b/spec/models/labware_creators/normalised_binned_plate_spec.rb @@ -85,10 +85,7 @@ let(:user_uuid) { 'user-uuid' } before do - create(:normalised_binning_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create(:normalised_binning_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb index b702bcba3..6ffabb72e 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb @@ -272,26 +272,22 @@ content end - let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } - end + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="duplex_seq_customer_file.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'duplex_seq_dil_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="duplex_seq_customer_file.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'duplex_seq_dil_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:stub_parent_request) { stub_api_get(parent_uuid, body: parent_plate_v1) } @@ -299,10 +295,12 @@ before do stub_parent_request - create(:duplex_seq_customer_csv_file_upload_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create( + :duplex_seq_customer_csv_file_upload_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name: + ) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb index 15cfa9180..610bd8195 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb @@ -308,26 +308,22 @@ content end - let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } - end + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="targeted_nano_seq_customer_file.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'targeted_nano_seq_dil_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="targeted_nano_seq_customer_file.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'targeted_nano_seq_dil_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:stub_parent_request) { stub_api_get(parent_uuid, body: parent_plate_v1) } diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 6dfe9e4d5..cedabd678 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -112,9 +112,7 @@ let(:parent_v1) { json :plate_with_metadata, uuid: parent_uuid, barcode_number: 6, qc_files_actions: %w[read create] } # form attributes - required parameters for the labware creator - let(:form_attributes) do - { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } - end + let(:form_attributes) { { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } } # child tubes for lookup after creation let(:child_tube_1_uuid) { SecureRandom.uuid } @@ -267,12 +265,7 @@ context 'when require_sequencing_tubes_only? is true' do let(:form_attributes) do - { - user_uuid:, - purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, - sequencing_file: - } + { user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, parent_uuid:, sequencing_file: } end before do @@ -611,9 +604,9 @@ context 'when the tube barcode already exists in the LIMS' do before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: foreign_barcode) - .and_return(existing_tube) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: foreign_barcode).and_return( + existing_tube + ) end it 'adds an error to the errors collection' do @@ -720,21 +713,19 @@ # stub the contingency file upload let!(:stub_contingency_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: contingency_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_contingency_tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_contingency_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: contingency_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_contingency_tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_contingency_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # body for stubbing the sequencing file upload @@ -746,21 +737,19 @@ # stub the sequencing file upload let!(:stub_sequencing_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: sequencing_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: sequencing_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # stub the sequencing tube creation @@ -1014,12 +1003,7 @@ context 'with just a sequencing file' do let(:form_attributes) do - { - user_uuid:, - purpose_uuid: child_sequencing_tube_purpose_uuid, - parent_uuid:, - sequencing_file: - } + { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid:, sequencing_file: } end # body for stubbing the sequencing file upload @@ -1031,21 +1015,19 @@ # stub the sequencing file upload let!(:stub_sequencing_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: sequencing_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: sequencing_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # stub the sequencing tube creation diff --git a/spec/models/labware_creators/plate_with_template_spec.rb b/spec/models/labware_creators/plate_with_template_spec.rb index 4cf1c9595..69605de82 100644 --- a/spec/models/labware_creators/plate_with_template_spec.rb +++ b/spec/models/labware_creators/plate_with_template_spec.rb @@ -60,14 +60,7 @@ it 'makes the expected requests' do expect_api_v2_posts( 'Transfer', - [ - { - user_uuid:, - source_uuid: parent_uuid, - destination_uuid: 'child-uuid', - transfer_template_uuid: - } - ] + [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: 'child-uuid', transfer_template_uuid: }] ) expect(subject.save!).to eq true diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb index ac223c108..bb2ee40a4 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb @@ -49,9 +49,7 @@ describe '#save!' do has_a_working_api - let(:form_attributes) do - { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } - end + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } } let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -90,12 +88,7 @@ expect_api_v2_posts( 'Transfer', [parent_uuid, parent2_uuid, parent3_uuid, parent4_uuid].map do |source_uuid| - { - user_uuid:, - source_uuid:, - destination_uuid: 'tube-0', - transfer_template_uuid: 'whole-plate-to-tube' - } + { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } end ) diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb index 67117c8f1..ee8183163 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb @@ -32,14 +32,7 @@ end before do - create :purpose_config, - submission: { - template_uuid:, - request_options: { - read_length: 150 - } - }, - uuid: purpose_uuid + create :purpose_config, submission: { template_uuid:, request_options: { read_length: 150 } }, uuid: purpose_uuid end describe '#new' do @@ -52,9 +45,7 @@ describe '#save!' do has_a_working_api - let(:form_attributes) do - { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } - end + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } } let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -99,9 +90,9 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with(barcode: barcodes, includes: []) - .and_return([parent, parent2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with(barcode: barcodes, includes: []).and_return( + [parent, parent2] + ) tube_creation_request tube_creation_children_request diff --git a/spec/models/labware_creators/quadrant_split_plate_spec.rb b/spec/models/labware_creators/quadrant_split_plate_spec.rb index 3db6aa215..c96a1026e 100644 --- a/spec/models/labware_creators/quadrant_split_plate_spec.rb +++ b/spec/models/labware_creators/quadrant_split_plate_spec.rb @@ -130,9 +130,10 @@ before do create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid) - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ uuid: %w[child-a-uuid child-b-uuid child-c-uuid child-d-uuid] }, includes: ['wells']) - .and_return([child_plate_a, child_plate_b, child_plate_c, child_plate_d]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { uuid: %w[child-a-uuid child-b-uuid child-c-uuid child-d-uuid] }, + includes: ['wells'] + ).and_return([child_plate_a, child_plate_b, child_plate_c, child_plate_d]) stub_v2_plate(plate, stub_search: false) end diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index 34a41d541..4ed83099e 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -310,9 +310,10 @@ stub_api_get('asset-uuid', body: child_plate_v1) metadata = - attributes_for(:v1_custom_metadatum_collection) - .fetch(:metadata, {}) - .merge(stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human) + attributes_for(:v1_custom_metadatum_collection).fetch(:metadata, {}).merge( + stock_barcode_q0: stock_plate1.barcode.human, + stock_barcode_q1: stock_plate2.barcode.human + ) stub_api_put( 'custom_metadatum_collection-uuid', diff --git a/spec/models/labware_creators/shared_examples.rb b/spec/models/labware_creators/shared_examples.rb index 26d4e814b..6de6977a3 100644 --- a/spec/models/labware_creators/shared_examples.rb +++ b/spec/models/labware_creators/shared_examples.rb @@ -266,9 +266,9 @@ it 'makes the expected requests' do # NB. qc assay post is done using v2 Api, whereas plate creation and transfers posts are using v1 Api - expect(Sequencescape::Api::V2::QcAssay).to receive(:create) - .with(qc_results: dest_well_qc_attributes) - .and_return(true) + expect(Sequencescape::Api::V2::QcAssay).to receive(:create).with(qc_results: dest_well_qc_attributes).and_return( + true + ) expect(subject.save!).to eq true expect(plate_creation_request).to have_been_made expect(transfer_creation_request).to have_been_made diff --git a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb index 4e60fcc14..d2cdf7206 100644 --- a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb +++ b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb @@ -43,9 +43,11 @@ allow(Sequencescape::Api::V2::Plate).to receive(:find_by).with(uuid: parent_uuid).and_return(parent) - allow(api).to receive_message_chain(:plate_creation, :create!) - .with(parent: parent_uuid, child_purpose: child_purpose_uuid, user: user_uuid) - .and_return(double(child: child_plate)) + allow(api).to receive_message_chain(:plate_creation, :create!).with( + parent: parent_uuid, + child_purpose: child_purpose_uuid, + user: user_uuid + ).and_return(double(child: child_plate)) allow(Sequencescape::Api::V2::Plate).to receive(:find_by).with(uuid: child_uuid).and_return(child_plate) end diff --git a/spec/models/labware_creators/stamped_plate_spec.rb b/spec/models/labware_creators/stamped_plate_spec.rb index 29e0fd586..22b16157e 100644 --- a/spec/models/labware_creators/stamped_plate_spec.rb +++ b/spec/models/labware_creators/stamped_plate_spec.rb @@ -188,14 +188,7 @@ context 'when a library type is supplied' do let(:form_attributes) do - { - purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, - filters: { - library_type: [lib_type_a] - } - } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: [lib_type_a] } } end it_behaves_like 'a stamped plate creator' @@ -219,14 +212,7 @@ context 'when a library type is supplied that does not match any request' do let(:form_attributes) do - { - purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, - filters: { - library_type: ['LibTypeB'] - } - } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: ['LibTypeB'] } } end it 'raises an exception' do diff --git a/spec/models/labware_creators/tagged_plate_spec.rb b/spec/models/labware_creators/tagged_plate_spec.rb index b45b52bd4..58fdeb2c5 100644 --- a/spec/models/labware_creators/tagged_plate_spec.rb +++ b/spec/models/labware_creators/tagged_plate_spec.rb @@ -30,10 +30,7 @@ let(:disable_cross_plate_pool_detection) { false } before do - create(:purpose_config, - name: child_purpose_name, - uuid: child_purpose_uuid, - disable_cross_plate_pool_detection:) + create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, disable_cross_plate_pool_detection:) plate_request wells_request end @@ -223,14 +220,7 @@ expect_api_v2_posts( 'StateChange', - [ - { - reason: 'Used in Library creation', - target_state: 'exhausted', - target_uuid: tag_plate_uuid, - user_uuid: - } - ] + [{ reason: 'Used in Library creation', target_state: 'exhausted', target_uuid: tag_plate_uuid, user_uuid: }] ) expect(subject.save).to be true diff --git a/spec/models/labware_creators/tube_from_tube_spec.rb b/spec/models/labware_creators/tube_from_tube_spec.rb index 23279244a..112f1b4c7 100644 --- a/spec/models/labware_creators/tube_from_tube_spec.rb +++ b/spec/models/labware_creators/tube_from_tube_spec.rb @@ -60,14 +60,7 @@ it 'creates the child' do expect_api_v2_posts( 'Transfer', - [ - { - user_uuid:, - source_uuid: parent_uuid, - destination_uuid: child_uuid, - transfer_template_uuid: - } - ] + [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: child_uuid, transfer_template_uuid: }] ) subject.save! diff --git a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb index 6e8a7dcd5..136fc50e9 100644 --- a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb +++ b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb @@ -32,9 +32,7 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) do - LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) - end + let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/labware_creators/well_filter_spec.rb b/spec/models/labware_creators/well_filter_spec.rb index 28c79369c..55d02afef 100644 --- a/spec/models/labware_creators/well_filter_spec.rb +++ b/spec/models/labware_creators/well_filter_spec.rb @@ -32,9 +32,7 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) do - LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) - end + let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/labware_metadata_spec.rb b/spec/models/labware_metadata_spec.rb index 49ac36edf..bb82795cd 100644 --- a/spec/models/labware_metadata_spec.rb +++ b/spec/models/labware_metadata_spec.rb @@ -43,9 +43,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) LabwareMetadata.new(labware: plate_with_metadata, user_uuid: user.uuid).update!(updated_metadata) end @@ -63,13 +61,11 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) - LabwareMetadata - .new(barcode: plate_with_metadata.barcode.machine, user_uuid: user.uuid) - .update!(updated_metadata) + LabwareMetadata.new(barcode: plate_with_metadata.barcode.machine, user_uuid: user.uuid).update!( + updated_metadata + ) end end end @@ -95,9 +91,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) LabwareMetadata.new(labware: tube_with_metadata, user_uuid: user.uuid).update!(updated_metadata) end @@ -115,9 +109,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) LabwareMetadata.new(barcode: tube_with_metadata.barcode.machine, user_uuid: user.uuid).update!(updated_metadata) end diff --git a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb index ff74c8b99..99e9baaf9 100644 --- a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb @@ -65,14 +65,7 @@ end context 'when binning configuration is present' do - before do - create( - :concentration_binning_purpose_config, - uuid: labware.purpose.uuid, - warnings:, - label_class: - ) - end + before { create(:concentration_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/final_tube_presenter_spec.rb b/spec/models/presenters/final_tube_presenter_spec.rb index 5fba07000..b6d7b4347 100644 --- a/spec/models/presenters/final_tube_presenter_spec.rb +++ b/spec/models/presenters/final_tube_presenter_spec.rb @@ -5,9 +5,7 @@ require_relative 'shared_labware_presenter_examples' RSpec.describe Presenters::FinalTubePresenter do - let(:labware) do - build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' - end + let(:labware) { build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' } before { create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') } diff --git a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb index fb4860cac..44c5d52b9 100644 --- a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb @@ -66,14 +66,7 @@ end context 'when binning configuration is present' do - before do - create( - :normalised_binning_purpose_config, - uuid: labware.purpose.uuid, - warnings:, - label_class: - ) - end + before { create(:normalised_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/plate_presenter_spec.rb b/spec/models/presenters/plate_presenter_spec.rb index 60b6f29c5..378f4a611 100644 --- a/spec/models/presenters/plate_presenter_spec.rb +++ b/spec/models/presenters/plate_presenter_spec.rb @@ -337,15 +337,7 @@ end context 'with a plate that has no links' do - before do - create( - :purpose_config, - uuid: labware.purpose.uuid, - warnings:, - label_class:, - file_links: [] - ) - end + before { create(:purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links: []) } it 'returns an empty array' do expect(presenter.csv_file_links).to eq([]) diff --git a/spec/models/presenters/standard_presenter_spec.rb b/spec/models/presenters/standard_presenter_spec.rb index 14290d37c..6376b2ff3 100644 --- a/spec/models/presenters/standard_presenter_spec.rb +++ b/spec/models/presenters/standard_presenter_spec.rb @@ -5,13 +5,7 @@ let(:aliquot_type) { :v2_aliquot } let(:state) { 'pending' } let(:labware) do - create :v2_plate, - barcode_number: 1, - state:, - purpose_name:, - purpose_uuid: 'test-purpose', - uuid: 'plate-uuid', - wells: + create :v2_plate, barcode_number: 1, state:, purpose_name:, purpose_uuid: 'test-purpose', uuid: 'plate-uuid', wells: end let(:wells) do [ diff --git a/spec/models/presenters/submission_plate_presenter_spec.rb b/spec/models/presenters/submission_plate_presenter_spec.rb index 5e358992b..aab4a7072 100644 --- a/spec/models/presenters/submission_plate_presenter_spec.rb +++ b/spec/models/presenters/submission_plate_presenter_spec.rb @@ -114,9 +114,7 @@ it_behaves_like 'a labware presenter' it_behaves_like 'a stock presenter' - let(:labware) do - create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions - end + let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } let(:submissions) { create_list :v2_submission, 1, state: 'pending' } let(:barcode_string) { 'DN2T' } @@ -156,9 +154,7 @@ end end - let(:labware) do - create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions - end + let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } let(:now) { Time.zone.parse('2020-11-24 16:13:43 +0000') } let(:submissions) { create_list :v2_submission, 1, state: 'ready', updated_at: now - 5.seconds } let(:barcode_string) { 'DN2T' } @@ -213,12 +209,7 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, - purpose_name:, - barcode_number: 2, - pool_sizes: [2], - direct_submissions: submissions, - state: + create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } @@ -255,12 +246,7 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, - purpose_name:, - barcode_number: 2, - pool_sizes: [2], - direct_submissions: submissions, - state: + create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } diff --git a/spec/models/presenters/tube_rack_presenter_spec.rb b/spec/models/presenters/tube_rack_presenter_spec.rb index bebb8e088..7a4df7cf0 100644 --- a/spec/models/presenters/tube_rack_presenter_spec.rb +++ b/spec/models/presenters/tube_rack_presenter_spec.rb @@ -37,13 +37,7 @@ let(:label_class) { 'Labels::PlateLabel' } before do - create( - :tube_rack_config, - uuid: labware.purpose.uuid, - warnings:, - label_class:, - file_links: - ) + create(:tube_rack_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links:) create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') end diff --git a/spec/models/robots/pooling_robot_spec.rb b/spec/models/robots/pooling_robot_spec.rb index a2bf527ae..bc4dea351 100644 --- a/spec/models/robots/pooling_robot_spec.rb +++ b/spec/models/robots/pooling_robot_spec.rb @@ -104,9 +104,7 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } - end + let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name diff --git a/spec/models/robots/quadrant_robot_spec.rb b/spec/models/robots/quadrant_robot_spec.rb index 58ac0d7d7..97bb3939c 100644 --- a/spec/models/robots/quadrant_robot_spec.rb +++ b/spec/models/robots/quadrant_robot_spec.rb @@ -102,9 +102,7 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } - end + let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name diff --git a/spec/models/sequencescape_submission_spec.rb b/spec/models/sequencescape_submission_spec.rb index 5341d8cf1..b2f1942b9 100644 --- a/spec/models/sequencescape_submission_spec.rb +++ b/spec/models/sequencescape_submission_spec.rb @@ -11,9 +11,7 @@ let(:template_uuid) { 'template-uuid' } let(:request_options) { { read_length: 150 } } let(:user_uuid) { 'user-uuid' } - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } describe '#template_uuid' do context 'when set directly' do @@ -24,9 +22,7 @@ context 'when set via template_name' do let(:template_name) { 'Submission template' } - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } before { Settings.submission_templates = { template_name => template_uuid } } @@ -37,9 +33,7 @@ end describe '#extra_barcodes_trimmed' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } it 'removes any extra whitespaces' do obj = described_class.new(attributes.merge(extra_barcodes: [' 1234 ', ' 5678 ', ' ', ''])) @@ -48,9 +42,7 @@ end describe '#extra_plates' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } let(:plate) { create :v2_plate } let(:obj) { described_class.new(attributes.merge(extra_barcodes: %w[1234 5678])) } @@ -65,25 +57,23 @@ end describe '#extra_assets' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } let(:plate) { create(:passed_plate) } let(:plate2) { create(:passed_plate) } it 'returns the uuids of the labwares wells' do obj = described_class.new(attributes.merge(extra_barcodes: %w[1234 5678])) - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) - .with(barcode: %w[1234 5678]) - .and_return([plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( + barcode: %w[1234 5678] + ).and_return([plate, plate2]) # There are 4 non-empty wells in each labware expect(obj.extra_assets.count).to eq(8) end it 'removes duplicates uuids in the returned list' do - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) - .with(barcode: %w[1234 1234 5678]) - .and_return([plate, plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( + barcode: %w[1234 1234 5678] + ).and_return([plate, plate, plate2]) obj = described_class.new(attributes.merge(extra_barcodes: %w[1234 1234 5678])) expect(obj.extra_assets.count).to eq(8) expect(obj.extra_assets.uniq.count).to eq(8) @@ -91,9 +81,7 @@ end describe '#asset_groups_for_orders_creation' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } it 'returns normal asset groups when no extra barcodes provided' do obj = described_class.new(attributes) @@ -104,9 +92,9 @@ let(:plate2) { create(:passed_plate) } before do - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) - .with(barcode: %w[1234 5678]) - .and_return([plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( + barcode: %w[1234 5678] + ).and_return([plate, plate2]) end it 'returns the current assets plus the extra assets' do diff --git a/spec/sequencescape/api/v2/plate_spec.rb b/spec/sequencescape/api/v2/plate_spec.rb index ad63ee1cb..b68382890 100644 --- a/spec/sequencescape/api/v2/plate_spec.rb +++ b/spec/sequencescape/api/v2/plate_spec.rb @@ -83,32 +83,30 @@ describe '::find_by' do it 'finds a plate' do - stub_request(:get, 'http://example.com:3000/api/v2/plates') - .with( - query: { - fields: { - sample_metadata: 'sample_common_name,collected_by,sample_description', - submissions: 'lanes_of_sequencing' - }, - filter: { - uuid: '8681e102-b737-11ec-8ace-acde48001122' - }, - # This is a bit brittle, as it depends on the exact order. - include: - 'purpose,child_plates.purpose,wells.downstream_tubes.purpose,' \ - 'wells.requests_as_source.request_type,wells.requests_as_source.primer_panel,' \ - 'wells.requests_as_source.pre_capture_pool,wells.requests_as_source.submission,' \ - 'wells.aliquots.sample.sample_metadata,wells.aliquots.request.request_type,' \ - 'wells.aliquots.request.primer_panel,wells.aliquots.request.pre_capture_pool,' \ - 'wells.aliquots.request.submission,' \ - 'wells.transfer_requests_as_target.source_asset' + stub_request(:get, 'http://example.com:3000/api/v2/plates').with( + query: { + fields: { + sample_metadata: 'sample_common_name,collected_by,sample_description', + submissions: 'lanes_of_sequencing' }, - headers: { - 'Accept' => 'application/vnd.api+json', - 'Content-Type' => 'application/vnd.api+json' - } - ) - .to_return(File.new('./spec/contracts/v2-plate-by-uuid-for-presenter.txt')) + filter: { + uuid: '8681e102-b737-11ec-8ace-acde48001122' + }, + # This is a bit brittle, as it depends on the exact order. + include: + 'purpose,child_plates.purpose,wells.downstream_tubes.purpose,' \ + 'wells.requests_as_source.request_type,wells.requests_as_source.primer_panel,' \ + 'wells.requests_as_source.pre_capture_pool,wells.requests_as_source.submission,' \ + 'wells.aliquots.sample.sample_metadata,wells.aliquots.request.request_type,' \ + 'wells.aliquots.request.primer_panel,wells.aliquots.request.pre_capture_pool,' \ + 'wells.aliquots.request.submission,' \ + 'wells.transfer_requests_as_target.source_asset' + }, + headers: { + 'Accept' => 'application/vnd.api+json', + 'Content-Type' => 'application/vnd.api+json' + } + ).to_return(File.new('./spec/contracts/v2-plate-by-uuid-for-presenter.txt')) expect( Sequencescape::Api::V2::Plate.find_by(uuid: '8681e102-b737-11ec-8ace-acde48001122') ).to be_a Sequencescape::Api::V2::Plate diff --git a/spec/sequencescape/api/v2/shared_examples.rb b/spec/sequencescape/api/v2/shared_examples.rb index f695a7147..2c8e67d47 100644 --- a/spec/sequencescape/api/v2/shared_examples.rb +++ b/spec/sequencescape/api/v2/shared_examples.rb @@ -60,12 +60,12 @@ let(:alternative_workline_name) { 'Some other plate with some stuff inside' } before do - allow(SearchHelper).to receive(:alternative_workline_reference_name) - .with(the_labware) - .and_return(alternative_workline_name) - allow(ancestors_scope).to receive(:where) - .with(purpose_name: alternative_workline_name) - .and_return(alternative_workline_reference_plates) + allow(SearchHelper).to receive(:alternative_workline_reference_name).with(the_labware).and_return( + alternative_workline_name + ) + allow(ancestors_scope).to receive(:where).with(purpose_name: alternative_workline_name).and_return( + alternative_workline_reference_plates + ) end it 'returns the last alternative workline reference' do diff --git a/spec/support/api_url_helper.rb b/spec/support/api_url_helper.rb index bb0281796..db511413a 100644 --- a/spec/support/api_url_helper.rb +++ b/spec/support/api_url_helper.rb @@ -28,9 +28,13 @@ def api_url_for(*components) # @param [Int] status: the response status, defaults to 200 # @return mocked_request def stub_api_get(*components, status: 200, body: '{}') - stub_request(:get, api_url_for(*components)) - .with(headers: { 'Accept' => 'application/json' }) - .to_return(status:, body:, headers: { 'content-type' => 'application/json' }) + stub_request(:get, api_url_for(*components)).with(headers: { 'Accept' => 'application/json' }).to_return( + status:, + body:, + headers: { + 'content-type' => 'application/json' + } + ) end # Generate an API stub for a post request. @@ -54,18 +58,17 @@ def stub_api_post(*components, status: 201, body: '{}', payload: {}) end def stub_api_modify(*components, body:, payload:, action: :post, status: 201) - Array(body) - .reduce( - stub_request(action, api_url_for(*components)).with( - headers: { - 'Accept' => 'application/json', - 'content-type' => 'application/json' - }, - body: payload - ) - ) do |request, response| - request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) - end + Array(body).reduce( + stub_request(action, api_url_for(*components)).with( + headers: { + 'Accept' => 'application/json', + 'content-type' => 'application/json' + }, + body: payload + ) + ) do |request, response| + request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) + end end def stub_api_put(*components, body:, payload:) @@ -132,9 +135,10 @@ def stub_v2_plate(plate, stub_search: true, custom_query: nil, custom_includes: if custom_query allow(Sequencescape::Api::V2).to receive(custom_query.first).with(*custom_query.last).and_return(plate) elsif custom_includes - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(custom_includes, { uuid: plate.uuid }) - .and_return(plate) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + custom_includes, + { uuid: plate.uuid } + ).and_return(plate) else allow(Sequencescape::Api::V2).to receive(:plate_for_presenter).with(uuid: plate.uuid).and_return(plate) end diff --git a/spec/support/contract_helper.rb b/spec/support/contract_helper.rb index e11e00d99..9d740f39a 100644 --- a/spec/support/contract_helper.rb +++ b/spec/support/contract_helper.rb @@ -16,7 +16,8 @@ def initialize(root_directory) # rubocop:todo Lint/MissingCopEnableDirective # rubocop:todo Layout/LineLength # rubocop:enable Lint/MissingCopEnableDirective - REQUEST_REGEXP = %r{ # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes + REQUEST_REGEXP = + %r{ # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:enable Layout/LineLength (? \r\n|\r|\n){0} (? GET|PUT|POST|DELETE){0} diff --git a/spec/support/factory_bot_extensions.rb b/spec/support/factory_bot_extensions.rb index 54c26c611..0a35ed26f 100644 --- a/spec/support/factory_bot_extensions.rb +++ b/spec/support/factory_bot_extensions.rb @@ -31,8 +31,9 @@ def with_has_many_associations(*names, actions: ['read']) send(association) do {}.tap do |h| h['size'] = send(:"#{association}_count") if send(:"#{association}_actions").include?('read') - h['actions'] = - send(:"#{association}_actions").index_with { |_action_name| "#{resource_url}/#{association}" } + h['actions'] = send(:"#{association}_actions").index_with do |_action_name| + "#{resource_url}/#{association}" + end end end end diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index e67dd8774..76409187d 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -9,9 +9,9 @@ def stub_search_and_single_result(search, query, result = nil) stub_api_post(search_uuid, 'first', status: 301, payload: query, body: result) else search_url = "http://example.com:3000/#{search_uuid}" - stub_request(:post, "#{search_url}/first") - .with(body: query.to_json) - .to_raise(Sequencescape::Api::ResourceNotFound) + stub_request(:post, "#{search_url}/first").with(body: query.to_json).to_raise( + Sequencescape::Api::ResourceNotFound + ) end end diff --git a/spec/support/robot_helpers.rb b/spec/support/robot_helpers.rb index 8f1f30abe..1b86fd797 100644 --- a/spec/support/robot_helpers.rb +++ b/spec/support/robot_helpers.rb @@ -6,9 +6,10 @@ def bed_labware_lookup(labware, includes = %i[purpose parents]) end def bed_labware_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) - allow(Sequencescape::Api::V2::Labware).to receive(:find_all) - .with({ barcode: Array(barcode) }, includes:) - .and_return(result) + allow(Sequencescape::Api::V2::Labware).to receive(:find_all).with( + { barcode: Array(barcode) }, + includes: + ).and_return(result) end def bed_plate_lookup(plate, includes = %i[purpose parents]) @@ -16,8 +17,8 @@ def bed_plate_lookup(plate, includes = %i[purpose parents]) end def bed_plate_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: Array(barcode) }, includes:) - .and_return(result) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with({ barcode: Array(barcode) }, includes:).and_return( + result + ) end end diff --git a/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb index 30adfccb2..702029715 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb @@ -196,24 +196,36 @@ assign(:workflow, workflow_name) # stub the v2 child tube lookups - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube1.barcode.machine) - .and_return(dest_tube1) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube2.barcode.machine) - .and_return(dest_tube2) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube3.barcode.machine) - .and_return(dest_tube3) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube4.barcode.machine) - .and_return(dest_tube4) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube5.barcode.machine) - .and_return(dest_tube5) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube6.barcode.machine) - .and_return(dest_tube6) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube1.barcode.machine + ).and_return(dest_tube1) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube2.barcode.machine + ).and_return(dest_tube2) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube3.barcode.machine + ).and_return(dest_tube3) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube4.barcode.machine + ).and_return(dest_tube4) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube5.barcode.machine + ).and_return(dest_tube5) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube6.barcode.machine + ).and_return(dest_tube6) end it 'renders the expected content' do diff --git a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb index 720c76f9c..1163ee23b 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb @@ -4,7 +4,7 @@ has_a_working_api let(:wells) do - (1..12).map do |index| # one-based index + (1..12).map do |index| # one-based index supplier_name = "vac-tube-barcode-#{index}" sample_metadata = create(:v2_sample_metadata, supplier_name:) sample = create(:v2_sample, sample_metadata:) @@ -35,7 +35,7 @@ ['Plate Barcode', 'Well Position', 'Vac Tube Barcode', 'Sample Name', 'Well Name'] ] body = - (5..12).map do |index| # one-based index + (5..12).map do |index| # one-based index well = plate.wells_in_columns[index - 1] sample = well.aliquots.first.sample [plate.labware_barcode.human, well.location, sample.sample_metadata.supplier_name, sample.name, well.name] diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 739b39cd4..7510f9e80 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -221,24 +221,36 @@ assign(:workflow, workflow_name) # stub the v2 child tube lookups - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube1.barcode.machine) - .and_return(dest_tube1) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube2.barcode.machine) - .and_return(dest_tube2) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube3.barcode.machine) - .and_return(dest_tube3) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube4.barcode.machine) - .and_return(dest_tube4) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube5.barcode.machine) - .and_return(dest_tube5) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with('custom_metadatum_collection', nil, barcode: dest_tube6.barcode.machine) - .and_return(dest_tube6) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube1.barcode.machine + ).and_return(dest_tube1) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube2.barcode.machine + ).and_return(dest_tube2) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube3.barcode.machine + ).and_return(dest_tube3) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube4.barcode.machine + ).and_return(dest_tube4) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube5.barcode.machine + ).and_return(dest_tube5) + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + 'custom_metadatum_collection', + nil, + barcode: dest_tube6.barcode.machine + ).and_return(dest_tube6) end it 'renders the expected content row by row' do From f0fbaecf888e4eeeffeddcf22ea3cef8de4b3508 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 10:59:19 +0100 Subject: [PATCH 056/141] build: update bundler version to fix spell-checker warning --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e44be4020..474d4256a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -482,4 +482,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.2.33 + 2.5.19 From 4855e72bcb22109d247aa0a34f893805d2b464b1 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 11:10:15 +0100 Subject: [PATCH 057/141] style: update rubocop todo --- .rubocop_todo.yml | 53 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8ad0bced4..c7df71d14 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,17 +1,56 @@ # This configuration was generated by -# `rubocop --auto-gen-config` -# on 2023-10-17 14:45:52 UTC using RuboCop version 1.39.0. +# `rubocop --auto-gen-config --no-exclude-limit` +# on 2024-09-20 10:09:42 UTC using RuboCop version 1.65.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 7 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. -Metrics/MethodLength: - Max: 21 +# Offense count: 2 +# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns. +# AllowedMethods: refine +Metrics/BlockLength: + Exclude: + - 'spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb' + - 'spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb' +# Offense count: 2 +# Configuration parameters: LengthThreshold. Metrics/CollectionLiteralLength: Exclude: - - 'spec/models/labware_creators/quadrant_split_plate_spec.rb' - 'spec/helpers/well_helpers_spec.rb' + - 'spec/models/labware_creators/quadrant_split_plate_spec.rb' + +# Offense count: 36 +# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns. +Metrics/MethodLength: + Exclude: + - 'app/controllers/labware_controller.rb' + - 'app/controllers/pipeline_work_in_progress_controller.rb' + - 'app/controllers/plates_controller.rb' + - 'app/helpers/plate_helper.rb' + - 'app/models/concerns/labware_creators/donor_pooling_calculator.rb' + - 'app/models/concerns/presenters/extended_csv.rb' + - 'app/models/concerns/presenters/statemachine.rb' + - 'app/models/labware_creators/custom_tagged_plate.rb' + - 'app/models/labware_creators/final_tube.rb' + - 'app/models/labware_creators/multi_stamp_tubes.rb' + - 'app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb' + - 'app/models/labware_creators/pcr_cycles_binned_plate/csv_file/well_details_header_base.rb' + - 'app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb' + - 'app/models/labware_creators/plate_split_to_tube_racks.rb' + - 'app/models/labware_creators/stamped_plate_adding_randomised_controls.rb' + - 'app/models/labware_creators/well_filter_allowing_partials.rb' + - 'app/models/pipeline_list.rb' + - 'app/models/print_job.rb' + - 'app/models/robots/splitting_robot.rb' + - 'app/models/sequencescape_submission.rb' + - 'app/models/utility/common_dilution_calculations.rb' + - 'app/models/utility/concentration_binning_calculator.rb' + - 'app/models/utility/normalised_binning_calculator.rb' + - 'app/models/validators/stock_state_validator.rb' + - 'config/initializers/settings.rb' + - 'spec/support/api_url_helper.rb' + - 'spec/support/factory_bot_extensions.rb' + - 'spec/support/feature_helpers.rb' + - 'spec/support/with_pmb_stubbed.rb' From c9a0baf0b73b320a5fbb9f49d075e73211b020d2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 11:20:44 +0100 Subject: [PATCH 058/141] style: rubocop --- .rubocop_todo.yml | 10 +---- ..._to_lrc_bank_seq_and_spare.csv.erb_spec.rb | 40 +++++-------------- ..._bank_tubes_content_report.csv.erb_spec.rb | 40 +++++-------------- 3 files changed, 21 insertions(+), 69 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c7df71d14..6ec73a2fe 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,19 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config --no-exclude-limit` -# on 2024-09-20 10:09:42 UTC using RuboCop version 1.65.1. +# on 2024-09-20 10:20:24 UTC using RuboCop version 1.65.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns. -# AllowedMethods: refine -Metrics/BlockLength: - Exclude: - - 'spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb' - - 'spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb' - # Offense count: 2 # Configuration parameters: LengthThreshold. Metrics/CollectionLiteralLength: diff --git a/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb index 702029715..0044cc0f6 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb_spec.rb @@ -196,36 +196,16 @@ assign(:workflow, workflow_name) # stub the v2 child tube lookups - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube1.barcode.machine - ).and_return(dest_tube1) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube2.barcode.machine - ).and_return(dest_tube2) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube3.barcode.machine - ).and_return(dest_tube3) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube4.barcode.machine - ).and_return(dest_tube4) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube5.barcode.machine - ).and_return(dest_tube5) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube6.barcode.machine - ).and_return(dest_tube6) + custom_includes = 'custom_metadatum_collection' + dest_tubes = [dest_tube1, dest_tube2, dest_tube3, dest_tube4, dest_tube5, dest_tube6] + + dest_tubes.each do |dest_tube| + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + custom_includes, + nil, + barcode: dest_tube.barcode.machine + ).and_return(dest_tube) + end end it 'renders the expected content' do diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 7510f9e80..6aceae34c 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -221,36 +221,16 @@ assign(:workflow, workflow_name) # stub the v2 child tube lookups - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube1.barcode.machine - ).and_return(dest_tube1) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube2.barcode.machine - ).and_return(dest_tube2) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube3.barcode.machine - ).and_return(dest_tube3) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube4.barcode.machine - ).and_return(dest_tube4) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube5.barcode.machine - ).and_return(dest_tube5) - allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - 'custom_metadatum_collection', - nil, - barcode: dest_tube6.barcode.machine - ).and_return(dest_tube6) + custom_includes = 'custom_metadatum_collection' + dest_tubes = [dest_tube1, dest_tube2, dest_tube3, dest_tube4, dest_tube5, dest_tube6] + + dest_tubes.each do |dest_tube| + allow(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + custom_includes, + nil, + barcode: dest_tube.barcode.machine + ).and_return(dest_tube) + end end it 'renders the expected content row by row' do From ef1e530e18664f26c3446e08a2a7c23fe9e817ad Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 12:16:23 +0100 Subject: [PATCH 059/141] trigger: From 196a5a4c3fcbe02ec5155ef54a4500d80c460b2b Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 20 Sep 2024 12:25:33 +0100 Subject: [PATCH 060/141] Fix unit tests for new endpoint usage --- .../labware_creators/multi_stamp_tubes.rb | 14 +-- .../multi_stamp_tubes_using_tube_rack_scan.rb | 12 ++- spec/features/pooling_multiple_plates_spec.rb | 62 +++++++------ .../custom_tagged_plate_spec.rb | 55 +++++++----- .../labware_creators/merged_plate_spec.rb | 58 +++++++----- .../labware_creators/multi_plate_pool_spec.rb | 49 ++++++---- .../labware_creators/multi_stamp_spec.rb | 40 ++++++--- .../multi_stamp_tubes_spec.rb | 86 ++++++------------ ...i_stamp_tubes_using_tube_rack_scan_spec.rb | 70 ++++++--------- .../quadrant_stamp_primer_panel_spec.rb | 90 +++++++++---------- 10 files changed, 272 insertions(+), 264 deletions(-) diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 91bfcc6be..53f6a346a 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -49,7 +49,7 @@ def create_labware! ) .child - transfer_material_from_parent!(@child.uuid) + transfer_material_from_parent! yield(@child) if block_given? true @@ -89,15 +89,15 @@ def parent_tubes Sequencescape::Api::V2::Tube.find_all(uuid: parent_uuids, includes: 'receptacle,aliquots,aliquots.study') end - def transfer_material_from_parent!(child_plate) + def transfer_material_from_parent! api.transfer_request_collection.create!( user: user_uuid, - transfer_requests: transfer_request_attributes(child_plate) + transfer_requests: transfer_request_attributes ) end - def transfer_request_attributes(child_plate) - transfers.map { |transfer| request_hash(transfer, child_plate) } + def transfer_request_attributes + transfers.map { |transfer| request_hash(transfer) } end def source_tube_outer_request_uuid(tube) @@ -110,13 +110,13 @@ def source_tube_outer_request_uuid(tube) pending_reqs.first.uuid || nil end - def request_hash(transfer, child_plate) + def request_hash(transfer) tube = Sequencescape::Api::V2::Tube.find_by(uuid: transfer[:source_tube]) { 'source_asset' => transfer[:source_asset], 'target_asset' => - child_plate.wells.detect { |child_well| child_well.location == transfer.dig(:new_target, :location) }&.uuid, + @child.wells.detect { |child_well| child_well.location == transfer.dig(:new_target, :location) }&.uuid, 'outer_request' => source_tube_outer_request_uuid(tube) } end diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index 47feae545..efde77128 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -73,7 +73,7 @@ def create_labware! ) .child - transfer_material_from_parent!(@child.uuid) + transfer_material_from_parent! yield(@child) if block_given? true @@ -234,24 +234,22 @@ def tube_has_expected_active_request?(tube_in_db) end # Transfers material from the parent tubes to the given child plate. - # @param child_plate [Sequencescape::Api::V2::Plate] The plate to transfer material to. - def transfer_material_from_parent!(child_plate) + def transfer_material_from_parent! api.transfer_request_collection.create!( user: user_uuid, - transfer_requests: transfer_request_attributes(child_plate) + transfer_requests: transfer_request_attributes ) end # Returns an array of hashes representing the transfer requests for the given child plate. # Each hash includes the UUIDs of the parent tube and child well, and the UUID of the outer request. - # @param child_plate [Sequencescape::Api::V2::Plate] The plate to get the transfer requests for. # @return [Array] An array of hashes representing the transfer requests. - def transfer_request_attributes(child_plate) + def transfer_request_attributes parent_tubes.each_with_object([]) do |(foreign_barcode, parent_tube), tube_transfers| tube_transfers << request_hash( parent_tube.uuid, - child_plate + @child .wells .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } &.uuid, diff --git a/spec/features/pooling_multiple_plates_spec.rb b/spec/features/pooling_multiple_plates_spec.rb index b7a49849f..cc8a2f9d7 100644 --- a/spec/features/pooling_multiple_plates_spec.rb +++ b/spec/features/pooling_multiple_plates_spec.rb @@ -34,29 +34,6 @@ purpose_uuid: 'stock-plate-purpose-uuid' end - let(:child_plate_uuid) { SecureRandom.uuid } - let(:child_plate) do - create :v2_plate, - purpose_uuid: 'child-purpose-0', - purpose_name: 'Pool Plate', - uuid: child_plate_uuid, - barcode_number: 3 - end - - let!(:pooled_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: 'child-purpose-0', - parents: [plate_uuid, plate_uuid_2] - } - }, - body: json(:plate_creation, child_uuid: child_plate_uuid) - ) - end - let!(:bulk_transfer_request) do stub_api_post( 'bulk_transfers', @@ -67,25 +44,53 @@ { 'source_uuid' => plate_uuid, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'A1' }, { 'source_uuid' => plate_uuid_2, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' }, { 'source_uuid' => plate_uuid_2, 'source_location' => 'B1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' } ] } }, - body: json(:plate_creation, child_uuid: child_plate_uuid) + body: json(:plate_creation, child_uuid: child_plate.uuid) + ) + end + + let(:child_plate) do + create :v2_plate, + purpose_uuid: 'child-purpose-0', + purpose_name: 'Pool Plate', + barcode_number: 3 + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: 'child-purpose-0', + parent_uuids: [plate_uuid, plate_uuid_2], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] ) end @@ -108,6 +113,8 @@ end scenario 'creates multiple plates' do + expect_pooled_plate_creation + fill_in_swipecard_and_barcode(user_swipecard, plate_barcode_1) plate_title = find('#plate-title') expect(plate_title).to have_text('Pooled example') @@ -119,7 +126,6 @@ expect(page).to have_content('DN2: A1, B1') click_on('Make Pre-Cap pool Plate') expect(page).to have_text('New empty labware added to the system') - expect(pooled_plate_creation_request).to have_been_made expect(bulk_transfer_request).to have_been_made expect(page).to have_text('Pool Plate') end diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 522fd4bd3..0dd4f7381 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -95,25 +95,33 @@ context 'On create' do let(:tag_plate_uuid) { 'tag-plate' } let(:tag_template_uuid) { 'tag-layout-template' } - let(:child_plate_uuid) { SecureRandom.uuid } let(:parents) { [plate_uuid, tag_plate_uuid] } - let!(:plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - parents: parents, - child_purpose: child_purpose_uuid, - user: user_uuid + let(:expected_transfers) { WellHelpers.stamp_hash(96) } + + let(:child_plate) { create :v2_plate } + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: parents, + user_uuid: user_uuid } - }, - body: json(:plate_creation, child_uuid: child_plate_uuid) + ], + [pooled_plate_creation] ) end - let(:expected_transfers) { WellHelpers.stamp_hash(96) } - def expect_state_change_creation expect_api_v2_posts( 'StateChange', @@ -134,7 +142,7 @@ def expect_tag_layout_creation [ { user_uuid: user_uuid, - plate_uuid: child_plate_uuid, + plate_uuid: child_plate.uuid, tag_group_uuid: 'tag-group-uuid', tag2_group_uuid: 'tag2-group-uuid', direction: 'column', @@ -153,7 +161,7 @@ def expect_transfer_creation { user_uuid: user_uuid, source_uuid: plate_uuid, - destination_uuid: child_plate_uuid, + destination_uuid: child_plate.uuid, transfer_template_uuid: transfer_template_uuid, transfers: expected_transfers } @@ -198,15 +206,16 @@ def expect_transfer_creation let(:tag_plate_state) { 'available' } it 'creates a tag plate' do + expect_pooled_plate_creation expect_state_change_creation expect_tag_layout_creation expect_transfer_creation expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('PooledPlateCreation', pooled_plate_creation) stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') stub_api_v2_post('StateChange') @@ -214,17 +223,17 @@ def expect_transfer_creation expect(subject.save).to be true # This will be our new plate - expect(subject.child.uuid).to eq(child_plate_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) end context 'when a user has exhausted the plate in another tab' do it 'creates a tag plate' do + expect_pooled_plate_creation expect_state_change_creation expect_tag_layout_creation expect_transfer_creation expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end end end @@ -236,21 +245,22 @@ def expect_transfer_creation # This one will be VERY different expect_tag_layout_creation + expect_pooled_plate_creation expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('PooledPlateCreation', pooled_plate_creation) stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true # This will be our new plate - expect(subject.child.uuid).to eq(child_plate_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) end end @@ -260,20 +270,21 @@ def expect_transfer_creation let(:parents) { [plate_uuid] } it 'creates a tag plate' do + expect_pooled_plate_creation expect_tag_layout_creation expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('PooledPlateCreation', pooled_plate_creation) stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true - expect(subject.child.uuid).to eq(child_plate_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) end end end diff --git a/spec/models/labware_creators/merged_plate_spec.rb b/spec/models/labware_creators/merged_plate_spec.rb index 987c79ff7..ee9c5ceea 100644 --- a/spec/models/labware_creators/merged_plate_spec.rb +++ b/spec/models/labware_creators/merged_plate_spec.rb @@ -54,15 +54,6 @@ creator_class: 'LabwareCreators::MergedPlate' end - let(:child_plate) do - create :v2_plate, - uuid: 'child-uuid', - barcode_number: '4', - size: plate_size, - outer_requests: requests, - purpose: child_purpose - end - let(:requests) do Array.new(plate_size) { |i| create :library_request, state: 'started', uuid: "request-#{i}", submission_id: 1 } end @@ -70,7 +61,6 @@ let(:user_uuid) { 'user-uuid' } before do - stub_v2_plate(child_plate, stub_search: false) stub_v2_plate(source_plate_1, stub_search: false) stub_v2_plate(source_plate_2, stub_search: false) end @@ -88,20 +78,8 @@ ) .and_return([source_plate_1, source_plate_2]) ) - end - let!(:plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [source_plate_1.uuid, source_plate_2.uuid] - } - }, - body: json(:plate_creation, child_uuid: child_plate.uuid) - ) + stub_v2_plate(child_plate, stub_search: false) end let!(:transfer_creation_request) do @@ -117,10 +95,42 @@ ) end + let(:child_plate) do + create :v2_plate, + uuid: 'child-uuid', + barcode_number: '4', + size: plate_size, + outer_requests: requests, + purpose: child_purpose + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [source_plate_1.uuid, source_plate_2.uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + it 'makes the expected requests' do + expect_pooled_plate_creation + expect(subject).to be_valid expect(subject.save!).to eq true - expect(plate_creation_request).to have_been_made + expect(transfer_creation_request).to have_been_made end end diff --git a/spec/models/labware_creators/multi_plate_pool_spec.rb b/spec/models/labware_creators/multi_plate_pool_spec.rb index adcca6f6e..45b578729 100644 --- a/spec/models/labware_creators/multi_plate_pool_spec.rb +++ b/spec/models/labware_creators/multi_plate_pool_spec.rb @@ -77,18 +77,15 @@ } end - let!(:pooled_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [plate_uuid, plate_b_uuid] - } - }, - body: json(:plate_creation, child_uuid: child_plate_uuid) - ) + let(:child_plate) do + create :v2_plate + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response end let!(:bulk_transfer_request) do @@ -101,38 +98,54 @@ { 'source_uuid' => plate_uuid, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'A1' }, { 'source_uuid' => plate_uuid, 'source_location' => 'B1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'A1' }, { 'source_uuid' => plate_b_uuid, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' }, { 'source_uuid' => plate_b_uuid, 'source_location' => 'B1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' } ] } }, - body: json(:plate_creation, child_uuid: child_plate_uuid) + body: json(:plate_creation, child_uuid: child_plate.uuid) + ) + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [plate_uuid, plate_b_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] ) end context '#save!' do it 'creates a plate!' do + expect_pooled_plate_creation + subject.save! - expect(pooled_plate_creation_request).to have_been_made.once + expect(bulk_transfer_request).to have_been_made.once end end diff --git a/spec/models/labware_creators/multi_stamp_spec.rb b/spec/models/labware_creators/multi_stamp_spec.rb index b7126d1c5..769e43f26 100644 --- a/spec/models/labware_creators/multi_stamp_spec.rb +++ b/spec/models/labware_creators/multi_stamp_spec.rb @@ -41,21 +41,19 @@ stock_plate: stock_plate2 ) end - let(:child_plate_v2) { create :v2_plate, uuid: child_uuid, barcode_number: '5', size: 96 } - let(:child_plate_v1) { json :stock_plate_with_metadata, stock_plate: { barcode: '5', uuid: child_uuid } } + let(:child_plate) { create :v2_plate, barcode_number: '5', size: 96 } let(:child_purpose_uuid) { 'child-purpose' } let(:child_purpose_name) { 'Child Purpose' } let(:user_uuid) { 'user-uuid' } - let(:user) { json :v1_user, uuid: user_uuid } before do create :purpose_config, name: child_purpose_name, uuid: child_purpose_uuid stub_v2_plate(parent1, stub_search: false) stub_v2_plate(parent2, stub_search: false) - stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) + stub_v2_plate(child_plate, stub_search: false, custom_query: [:plate_with_wells, child_plate.uuid]) end context 'on new' do @@ -484,7 +482,7 @@ parents: [parent1_uuid, parent2_uuid] } }, - body: json(:plate_creation, child_uuid: child_uuid) + body: json(:plate_creation, child_uuid: child_plate.uuid) ) end @@ -554,19 +552,39 @@ ) end + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [parent1_uuid, parent2_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + context '#save!' do setup do - stub_api_get(child_plate_v2.uuid, body: child_plate_v1) - - stub_api_get('user-uuid', body: user) - stub_api_get('asset-uuid', body: child_plate_v1) + # stub_api_get('user-uuid', body: user) end it 'creates a plate!' do + expect_pooled_plate_creation + subject.save! - expect(pooled_plate_creation_request).to have_been_made.once + expect(transfer_creation_request).to have_been_made.once - expect(subject.child.uuid).to eq(child_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) expect(subject).to be_valid expect(subject.errors.messages).to be_empty end diff --git a/spec/models/labware_creators/multi_stamp_tubes_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_spec.rb index 9cb244efa..ee41920db 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_spec.rb @@ -32,13 +32,8 @@ receptacle: parent2_receptacle end - let(:child_uuid) { 'child-uuid' } let(:child_purpose_uuid) { 'child-purpose' } let(:child_purpose_name) { 'Child Purpose' } - let(:child_plate_v2) do - create :v2_plate_for_submission, uuid: child_uuid, purpose_name: child_purpose_name, barcode_number: '5', size: 96 - end - let(:child_plate_v1) { json :stock_plate_with_metadata, stock_plate: { barcode: '5', uuid: child_uuid } } let(:user_uuid) { 'user-uuid' } let(:user) { json :v1_user, uuid: user_uuid } @@ -51,7 +46,6 @@ Settings.submission_templates = { 'example' => example_template_uuid } stub_v2_tube(parent1, stub_search: false) stub_v2_tube(parent2, stub_search: false) - stub_v2_plate(child_plate_v2, stub_search: false, custom_includes: 'wells,wells.aliquots,wells.aliquots.study') end context 'on new' do @@ -86,20 +80,6 @@ } end - let!(:ms_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [parent1_tube_uuid, parent2_tube_uuid] - } - }, - body: json(:plate_creation, child_uuid: child_uuid) - ) - end - let(:transfer_requests) do [ { source_asset: 'tube1', target_asset: '5-well-A1', outer_request: 'outer-request-1' }, @@ -119,6 +99,32 @@ body: '{}' ) end + + let(:child_plate) do + create :v2_plate_for_submission, purpose_name: child_purpose_name, barcode_number: '5', size: 96 + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [parent1_tube_uuid, parent2_tube_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + context 'when the submission is created' do describe 'internal methods' do it 'determines the configuration for the submission' do @@ -185,31 +191,8 @@ context '#save!' do setup do - stub_api_get(child_plate_v2.uuid, body: child_plate_v1) - stub_api_get( - 'custom_metadatum_collection-uuid', - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid') - ) - stub_api_get('user-uuid', body: user) - stub_api_get('asset-uuid', body: child_plate_v1) - expect(subject).to receive(:parent_tubes).and_return([parent1, parent2]) - metadata = attributes_for(:v1_custom_metadatum_collection).fetch(:metadata, {}) - - stub_api_put( - 'custom_metadatum_collection-uuid', - payload: { - custom_metadatum_collection: { - metadata: metadata - } - }, - body: json(:v1_custom_metadatum_collection) - ) - - expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells) - .with(child_uuid) - .and_return(child_plate_v2) expect(subject).to receive(:source_tube_outer_request_uuid).with(parent1).and_return('outer-request-1') expect(subject).to receive(:source_tube_outer_request_uuid).with(parent2).and_return('outer-request-2') end @@ -242,19 +225,6 @@ aliquots: [aliquot2] end - let(:child_aliquot1) { create :v2_aliquot, study_id: 1 } - let(:child_aliquot2) { create :v2_aliquot, study_id: 2 } - let(:child_well1) { create :v2_stock_well, location: 'A1', uuid: '5-well-A1', aliquots: [child_aliquot1] } - let(:child_well2) { create :v2_stock_well, location: 'B1', uuid: '5-well-B1', aliquots: [child_aliquot2] } - let(:child_plate_v2) do - create :v2_plate_for_submission, - uuid: child_uuid, - purpose_name: child_purpose_name, - barcode_number: '5', - size: 96, - wells: [child_well1, child_well2] - end - let!(:order_request) do stub_api_get(example_template_uuid, body: json(:submission_template, uuid: example_template_uuid)) stub_api_post( @@ -291,8 +261,10 @@ end it 'creates a plate!' do + expect_pooled_plate_creation + subject.save! - expect(ms_plate_creation_request).to have_been_made.once + expect(transfer_creation_request).to have_been_made.once expect(order_request).to have_been_made.once expect(submission_request).to have_been_made.once diff --git a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb index e0d46906c..0c55fb686 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb @@ -84,30 +84,10 @@ [:purpose, 'receptacle.aliquots.request.request_type', 'receptacle.requests_as_source.request_type'] end - # child aliquots - let(:child_aliquot1) { create :v2_aliquot } - let(:child_aliquot2) { create :v2_aliquot } - - # child wells - let(:child_well1) { create :v2_well, location: 'A1', uuid: '5-well-A1', aliquots: [child_aliquot1] } - let(:child_well2) { create :v2_well, location: 'B1', uuid: '5-well-B1', aliquots: [child_aliquot2] } - # child plate - let(:child_plate_uuid) { 'child-uuid' } let(:child_plate_purpose_uuid) { 'child-purpose' } let(:child_plate_purpose_name) { 'Child Purpose' } - let(:child_plate_v2) do - create :v2_plate, - uuid: child_plate_uuid, - purpose_name: child_plate_purpose_name, - barcode_number: '5', - size: 96, - wells: [child_well1, child_well2] - end - - let(:child_plate_v2) do - create :v2_plate, uuid: child_plate_uuid, purpose_name: child_plate_purpose_name, barcode_number: '5', size: 96 - end + let(:child_plate) { create :v2_plate, purpose_name: child_plate_purpose_name, barcode_number: '5', size: 96 } let(:user_uuid) { 'user-uuid' } let(:user) { json :v1_user, uuid: user_uuid } @@ -132,7 +112,7 @@ end let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')) + stub_request(:post, api_url_for(child_plate.uuid, 'qc_files')) .with( body: file_content, headers: { @@ -151,7 +131,7 @@ let(:child_plate_v1) do # qc_files are created through the API V1. The actions attribute for qcfiles is required by the API V1. - json :plate, uuid: child_plate_uuid, purpose_uuid: child_plate_purpose_uuid, qc_files_actions: %w[read create] + json :plate, uuid: child_plate.uuid, purpose_uuid: child_plate_purpose_uuid, qc_files_actions: %w[read create] end before do @@ -162,9 +142,7 @@ .with(barcode: 'AB10000002', includes: tube_includes) .and_return(parent_tube_2) - stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) - - stub_api_get(child_plate_uuid, body: child_plate_v1) + stub_api_get(child_plate.uuid, body: child_plate_v1) stub_upload_file_creation @@ -194,20 +172,6 @@ { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end - let!(:ms_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_plate_purpose_uuid, - parents: [parent_tube_1_uuid, parent_tube_2_uuid] - } - }, - body: json(:plate_creation, child_plate_uuid: child_plate_uuid) - ) - end - let(:transfer_requests) do [ { source_asset: 'tube-1-uuid', target_asset: '5-well-A1', outer_request: 'request-1' }, @@ -228,6 +192,27 @@ ) end + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_plate_purpose_uuid, + parent_uuids: [parent_tube_1_uuid, parent_tube_2_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } it 'creates a plate!' do @@ -235,10 +220,11 @@ subject.labware.barcode.machine = 'AB10000001' subject.labware.barcode.ean13 = nil + expect_pooled_plate_creation + subject.save - expect(subject.errors.full_messages).to be_empty - expect(ms_plate_creation_request).to have_been_made.once + expect(subject.errors.full_messages).to be_empty expect(transfer_creation_request).to have_been_made.once end end diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index 3e56ef4dc..a1bb21918 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -13,7 +13,6 @@ let(:parent1_uuid) { 'example-plate-uuid' } let(:parent2_uuid) { 'example-plate2-uuid' } - let(:child_uuid) { 'child-uuid' } let(:requests) { Array.new(96) { |i| create :gbs_library_request, state: 'started', uuid: "request-#{i}" } } let(:requests2) { Array.new(96) { |i| create :gbs_library_request, state: 'started', uuid: "request-#{i}" } } let(:stock_plate1) { create :v2_stock_plate_for_plate, barcode_number: '1' } @@ -40,20 +39,18 @@ stock_plate: stock_plate2 ) end - let(:child_plate_v2) { create :v2_plate, uuid: child_uuid, barcode_number: '5', size: 384 } - let(:child_plate_v1) { json :stock_plate_with_metadata, stock_plate: { barcode: '5', uuid: child_uuid } } + let(:child_plate) { create :v2_plate, barcode_number: '5', size: 384 } let(:child_purpose_uuid) { 'child-purpose' } let(:child_purpose_name) { 'Child Purpose' } - let(:user_uuid) { 'user-uuid' } - let(:v1_user) { json :v1_user, uuid: user_uuid } - let(:user) { create :user, uuid: user_uuid } + let(:user) { create :user } before do create :purpose_config, name: child_purpose_name + stub_v2_user(user) stub_v2_plate(parent1, stub_search: false) stub_v2_plate(parent2, stub_search: false) - stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) + stub_v2_plate(child_plate, stub_search: false, custom_query: [:plate_with_wells, child_plate.uuid]) end context 'on new' do @@ -75,7 +72,7 @@ end context 'on create' do - subject { LabwareCreators::QuadrantStampPrimerPanel.new(api, form_attributes.merge(user_uuid: user_uuid)) } + subject { LabwareCreators::QuadrantStampPrimerPanel.new(api, form_attributes.merge(user_uuid: user.uuid)) } let(:form_attributes) do { @@ -246,20 +243,6 @@ } end - let!(:pooled_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [parent1_uuid, parent2_uuid] - } - }, - body: json(:plate_creation, child_uuid: child_uuid) - ) - end - let(:transfer_requests) do [ { source_asset: '3-well-A1', outer_request: 'request-0', target_asset: '5-well-A1' }, @@ -290,7 +273,7 @@ 'transfer_request_collections', payload: { transfer_request_collection: { - user: user_uuid, + user: user.uuid, transfer_requests: transfer_requests } }, @@ -298,36 +281,47 @@ ) end - context '#save!' do - setup do - stub_api_get(child_plate_v2.uuid, body: child_plate_v1) - stub_api_get( - 'custom_metadatum_collection-uuid', - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid') - ) - stub_api_get('user-uuid', body: v1_user) - stub_v2_user(user) - stub_api_get('asset-uuid', body: child_plate_v1) + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) - metadata = - attributes_for(:v1_custom_metadatum_collection) - .fetch(:metadata, {}) - .merge(stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human) + response + end - stub_api_put( - 'custom_metadatum_collection-uuid', - payload: { - custom_metadatum_collection: { - metadata: metadata - } - }, - body: json(:v1_custom_metadatum_collection) - ) - end + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [parent1_uuid, parent2_uuid], + user_uuid: user.uuid + } + ], + [pooled_plate_creation] + ) + end + + def expect_custom_metadatum_collection_creation + expect_api_v2_posts( + 'CustomMetadatumCollection', + [ + { + asset_id: child_plate.id, + metadata: { stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human }, + user_id: user.id + } + ] + ) + end + context '#save!' do it 'creates a plate!' do + expect_pooled_plate_creation + expect_custom_metadatum_collection_creation + subject.save! - expect(pooled_plate_creation_request).to have_been_made.once + expect(transfer_creation_request).to have_been_made.once end end From 27d76f150813cd9809f6d1a6bd2d86fb3e68252c Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 20 Sep 2024 12:31:35 +0100 Subject: [PATCH 061/141] Apply Prettier --- .../labware_creators/custom_tagged_plate.rb | 12 +++++------- app/models/labware_creators/multi_plate_pool.rb | 3 +-- app/models/labware_creators/multi_stamp.rb | 3 +-- app/models/labware_creators/multi_stamp_tubes.rb | 8 ++------ .../multi_stamp_tubes_using_tube_rack_scan.rb | 8 ++------ spec/features/pooling_multiple_plates_spec.rb | 15 ++------------- .../labware_creators/custom_tagged_plate_spec.rb | 8 +------- .../labware_creators/multi_plate_pool_spec.rb | 12 ++---------- spec/models/labware_creators/multi_stamp_spec.rb | 8 +------- .../quadrant_stamp_primer_panel_spec.rb | 13 +++++-------- 10 files changed, 22 insertions(+), 68 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index f08960bda..f804054e2 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -47,13 +47,11 @@ def initialize(*args, &block) def create_plate! # rubocop:todo Metrics/AbcSize @child = - Sequencescape::Api::V2::PooledPlateCreation - .create!( - child_purpose_uuid: purpose_uuid, - parent_uuids: [parent_uuid, tag_plate.asset_uuid].compact_blank, - user_uuid: user_uuid - ) - .child + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: [parent_uuid, tag_plate.asset_uuid].compact_blank, + user_uuid: user_uuid + ).child transfer_material_from_parent!(@child.uuid) diff --git a/app/models/labware_creators/multi_plate_pool.rb b/app/models/labware_creators/multi_plate_pool.rb index b6307285a..597447a01 100644 --- a/app/models/labware_creators/multi_plate_pool.rb +++ b/app/models/labware_creators/multi_plate_pool.rb @@ -22,8 +22,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: transfers.keys, user_uuid: user_uuid - ) - .child + ).child api.bulk_transfer.create!(user: user_uuid, well_transfers: well_transfers) diff --git a/app/models/labware_creators/multi_stamp.rb b/app/models/labware_creators/multi_stamp.rb index 88b93623a..04d09ccbc 100644 --- a/app/models/labware_creators/multi_stamp.rb +++ b/app/models/labware_creators/multi_stamp.rb @@ -35,8 +35,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: parent_uuids, user_uuid: user_uuid - ) - .child + ).child transfer_material_from_parent!(@child.uuid) diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 53f6a346a..c596f399a 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -46,8 +46,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: parent_uuids, user_uuid: user_uuid - ) - .child + ).child transfer_material_from_parent! @@ -90,10 +89,7 @@ def parent_tubes end def transfer_material_from_parent! - api.transfer_request_collection.create!( - user: user_uuid, - transfer_requests: transfer_request_attributes - ) + api.transfer_request_collection.create!(user: user_uuid, transfer_requests: transfer_request_attributes) end def transfer_request_attributes diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index efde77128..73348fd06 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -70,8 +70,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: parent_tube_uuids, user_uuid: user_uuid - ) - .child + ).child transfer_material_from_parent! @@ -235,10 +234,7 @@ def tube_has_expected_active_request?(tube_in_db) # Transfers material from the parent tubes to the given child plate. def transfer_material_from_parent! - api.transfer_request_collection.create!( - user: user_uuid, - transfer_requests: transfer_request_attributes - ) + api.transfer_request_collection.create!(user: user_uuid, transfer_requests: transfer_request_attributes) end # Returns an array of hashes representing the transfer requests for the given child plate. diff --git a/spec/features/pooling_multiple_plates_spec.rb b/spec/features/pooling_multiple_plates_spec.rb index cc8a2f9d7..41a3cee7b 100644 --- a/spec/features/pooling_multiple_plates_spec.rb +++ b/spec/features/pooling_multiple_plates_spec.rb @@ -66,12 +66,7 @@ ) end - let(:child_plate) do - create :v2_plate, - purpose_uuid: 'child-purpose-0', - purpose_name: 'Pool Plate', - barcode_number: 3 - end + let(:child_plate) { create :v2_plate, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool Plate', barcode_number: 3 } let(:pooled_plate_creation) do response = double @@ -83,13 +78,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: 'child-purpose-0', - parent_uuids: [plate_uuid, plate_uuid_2], - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: 'child-purpose-0', parent_uuids: [plate_uuid, plate_uuid_2], user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 0dd4f7381..695a2bd52 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -111,13 +111,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: parents, - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: parents, user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/multi_plate_pool_spec.rb b/spec/models/labware_creators/multi_plate_pool_spec.rb index 45b578729..db21e59fd 100644 --- a/spec/models/labware_creators/multi_plate_pool_spec.rb +++ b/spec/models/labware_creators/multi_plate_pool_spec.rb @@ -77,9 +77,7 @@ } end - let(:child_plate) do - create :v2_plate - end + let(:child_plate) { create :v2_plate } let(:pooled_plate_creation) do response = double @@ -129,13 +127,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: [plate_uuid, plate_b_uuid], - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: [plate_uuid, plate_b_uuid], user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/multi_stamp_spec.rb b/spec/models/labware_creators/multi_stamp_spec.rb index 769e43f26..d96580b67 100644 --- a/spec/models/labware_creators/multi_stamp_spec.rb +++ b/spec/models/labware_creators/multi_stamp_spec.rb @@ -562,13 +562,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: [parent1_uuid, parent2_uuid], - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: [parent1_uuid, parent2_uuid], user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index a1bb21918..488f372c8 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -291,13 +291,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: [parent1_uuid, parent2_uuid], - user_uuid: user.uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: [parent1_uuid, parent2_uuid], user_uuid: user.uuid }], [pooled_plate_creation] ) end @@ -308,7 +302,10 @@ def expect_custom_metadatum_collection_creation [ { asset_id: child_plate.id, - metadata: { stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human }, + metadata: { + stock_barcode_q0: stock_plate1.barcode.human, + stock_barcode_q1: stock_plate2.barcode.human + }, user_id: user.id } ] From aaabd5729eff5fe28e402ca1f2c9650fa658ce20 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 12:42:18 +0100 Subject: [PATCH 062/141] fix: remove use of strip which raises an exception on invalid chars --- .../common_file_handling/csv_file/row_base.rb | 4 +--- .../common_file_handling/csv_file/row_base_spec.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/models/labware_creators/common_file_handling/csv_file/row_base.rb b/app/models/labware_creators/common_file_handling/csv_file/row_base.rb index eaf8d46ad..f29870ec2 100644 --- a/app/models/labware_creators/common_file_handling/csv_file/row_base.rb +++ b/app/models/labware_creators/common_file_handling/csv_file/row_base.rb @@ -86,9 +86,7 @@ def check_for_invalid_characters private def cell_is_blank?(cell) - # NB. cannot use cell.blank? as triggers an exception if cell contains the unusual characters - # are trying to spot - cell.nil? || cell.strip.empty? + cell.nil? end def cell_is_valid_utf8?(cell) diff --git a/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb b/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb index 0f7b4f2c7..b62e36ea8 100644 --- a/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb +++ b/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb @@ -47,6 +47,15 @@ ) end end + + context 'when row_data contains valid characters and empty cells' do + let(:row_data) { ['A1', '', nil] } + + it 'does not add any errors' do + subject.check_for_invalid_characters + expect(subject.errors.full_messages).to be_empty + end + end end # Testing the validation for the number of columns From 1a58e1662d8f7baffa5694c4037fe9903c2356c5 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 20 Sep 2024 13:56:45 +0100 Subject: [PATCH 063/141] build: try displatch check-release-version workflow on PR creation --- .github/workflows/check_release_version.yml | 1 + .github/workflows/create_release_pr.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/check_release_version.yml b/.github/workflows/check_release_version.yml index 911217835..0c0a4c4d4 100644 --- a/.github/workflows/check_release_version.yml +++ b/.github/workflows/check_release_version.yml @@ -2,6 +2,7 @@ name: Check release version on: + workflow_dispatch: pull_request: branches: - master diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 0d2545dbd..c480c0644 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -57,6 +57,7 @@ jobs: if [ -z "$EXISTING_PR" ]; then gh pr create --base master --head develop --title "$PR_TITLE" --body "$PR_BODY" + gh workflow run check_release_version.yml else gh pr edit "$EXISTING_PR" --body "$PR_BODY" fi From 263d4946af98bec3b53897b1abe7e125a94a7301 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 23 Sep 2024 12:19:00 +0100 Subject: [PATCH 064/141] Use provided UUID for child plate purpose --- spec/features/pooling_multiple_plates_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/features/pooling_multiple_plates_spec.rb b/spec/features/pooling_multiple_plates_spec.rb index 41a3cee7b..e86f00458 100644 --- a/spec/features/pooling_multiple_plates_spec.rb +++ b/spec/features/pooling_multiple_plates_spec.rb @@ -66,7 +66,7 @@ ) end - let(:child_plate) { create :v2_plate, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool Plate', barcode_number: 3 } + let(:child_plate) { create :v2_plate, purpose_name: 'Pool Plate', barcode_number: 3 } let(:pooled_plate_creation) do response = double @@ -78,7 +78,9 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [{ child_purpose_uuid: 'child-purpose-0', parent_uuids: [plate_uuid, plate_uuid_2], user_uuid: user_uuid }], + [ + { child_purpose_uuid: child_plate.purpose.uuid, parent_uuids: [plate_uuid, plate_uuid_2], user_uuid: user_uuid } + ], [pooled_plate_creation] ) end @@ -88,7 +90,7 @@ def expect_pooled_plate_creation create :purpose_config, creator_class: 'LabwareCreators::MultiPlatePool', name: 'Pool Plate', - uuid: 'child-purpose-0' + uuid: child_plate.purpose.uuid create :pipeline, relationships: { 'Pooled example' => 'Pool Plate' } # We look up the user From 60a6e75f0e25361b9e50e1a35318f98e25d191e7 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 23 Sep 2024 17:16:22 +0100 Subject: [PATCH 065/141] Use correct attributes on specific_tube_creations endpoint --- .../labware_creators/pooled_tubes_by_submission_with_phi_x.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index 50d7a916d..cef106449 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -17,7 +17,7 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission def create_child_stock_tubes Sequencescape::Api::V2::SpecificTubeCreation .create!( - child_purposes: [purpose_uuid] * pool_uuids.length, + child_purpose_uuids: [purpose_uuid] * pool_uuids.length, parent_uuids: parents, tube_attributes: tube_attributes, user_uuid: user_uuid From 52db8e18666b34602d723add534750f98783698f Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 23 Sep 2024 17:16:41 +0100 Subject: [PATCH 066/141] Remove unneeded API v1 stub for specific_tube_creations --- .../plate_split_to_tube_racks_spec.rb | 45 ------------------- 1 file changed, 45 deletions(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 697beec5b..c11589021 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -663,51 +663,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) } end - # stub the contingency tube creation - let!(:stub_contingency_tube_creation_request_uuid) { SecureRandom.uuid } - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [ - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid - ], - tube_attributes: [ - # sample 1 from well A2 to contingency tube 1 in A1 - { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, - # sample 2 from well B2 to contingency tube 2 in B1 - { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, - # sample 1 from well A3 to contingency tube 3 in C1 - { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 3) - ) - end - - # stub what contingency tubes were just made - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 3, - names: %w[SPR:NT1O:A1 SPR:NT2P:B1 SPR:NT1O:C1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12, 13], - uuid_index_offset: 2 - ) - ) - end - # body for stubbing the contingency file upload let(:contingency_file_content) do content = contingency_file.read From 5de4c8b79157ddb5f5fae79d1172ec2fbcdbb22a Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Sep 2024 10:25:42 +0100 Subject: [PATCH 067/141] trigger: From 5301fc98e9e353924d2e4e6fcc7935f006ca1ad0 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Sep 2024 10:35:03 +0100 Subject: [PATCH 068/141] revert: this will only work once the workflow_dispatch is in develop --- .github/workflows/create_release_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index c480c0644..0d2545dbd 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -57,7 +57,6 @@ jobs: if [ -z "$EXISTING_PR" ]; then gh pr create --base master --head develop --title "$PR_TITLE" --body "$PR_BODY" - gh workflow run check_release_version.yml else gh pr edit "$EXISTING_PR" --body "$PR_BODY" fi From 43d11e9b57225786d38514f788b3fd02d964b28e Mon Sep 17 00:00:00 2001 From: Stephen Hulme <135011085+StephenHulme@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:23:43 +0100 Subject: [PATCH 069/141] build: remove unnecessary list nesting Co-authored-by: Stuart McHattie --- .github/workflows/create_release_pr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 0d2545dbd..cd65bbd2c 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -44,10 +44,10 @@ jobs: #### Instructions for Reviewers -     \- _Check stories are ready for release_ -     \- _Check for any database migrations_ -     \- _Check for debug code_ -     \- _Check version is appropiate_ + - _Check stories are ready for release._ + - _Check for any database migrations._ + - _Check for debug code._ + - _Check version is appropriate._ This description will be overwritten on the next push This PR was auto-generated on $(TZ=Europe/London date --iso-8601=seconds)" From bd149e7b16ab7050826f01ffc093a58a9382d30f Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Sep 2024 12:08:42 +0100 Subject: [PATCH 070/141] test: add additional checks for spaces and invalid characters --- .../csv_file/row_base_spec.rb | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb b/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb index b62e36ea8..f9c83288d 100644 --- a/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb +++ b/spec/models/labware_creators/common_file_handling/csv_file/row_base_spec.rb @@ -48,7 +48,52 @@ end end - context 'when row_data contains valid characters and empty cells' do + context 'when row_data contains valid characters with invisible spaces' do + let(:row_barcode) { "some\u00A0 data" } # \u00A0 is a non-breaking space + + it 'adds an error for the invisible space' do + subject.check_for_invalid_characters + expect(subject.errors.full_messages).to include( + "contains invalid character(s) at column 2 in #{subject}, " \ + 'please use only standard characters and UTF-8 encoding for your csv file' + ) + end + end + + context 'when row_data contains only spaces' do + let(:row_barcode) { ' ' } + + it 'does not add any errors' do + subject.check_for_invalid_characters + expect(subject.errors.full_messages).to be_empty + end + end + + context 'when row_data contains spaces with invisible characters' do + let(:row_barcode) { " \u200B \u200B " } # \u200B is a zero-width space + + it 'adds an error for the invisible space' do + subject.check_for_invalid_characters + expect(subject.errors.full_messages).to include( + "contains invalid character(s) at column 2 in #{subject}, " \ + 'please use only standard characters and UTF-8 encoding for your csv file' + ) + end + end + + context 'when row_data contains invalid invisible characters' do + let(:row_barcode) { "\u200Csome data\u200C" } # \u200C is a zero-width non-joiner + + it 'adds an error for the invalid invisible character' do + subject.check_for_invalid_characters + expect(subject.errors.full_messages).to include( + "contains invalid character(s) at column 2 in #{subject}, " \ + 'please use only standard characters and UTF-8 encoding for your csv file' + ) + end + end + + context 'when row_data contains valid characters and nil cells' do let(:row_data) { ['A1', '', nil] } it 'does not add any errors' do From 82ede890255cbc4c481a1274249ee2ad8262db15 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 24 Sep 2024 16:53:21 +0100 Subject: [PATCH 071/141] trigger: From da4c7072489f698c042309ea808617deb5896cf6 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:17:54 +0000 Subject: [PATCH 072/141] Update webrick to version 1.8.2 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 054373965..2d30aada9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -407,7 +407,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) + webrick (1.8.2) websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) From a0953b4df07bfe88e44cf68bbf743abc50177630 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 12:32:58 +0100 Subject: [PATCH 073/141] trigger: From 00e6a82be0ed4607a32d85654960f4e36a20c95f Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 13:31:32 +0100 Subject: [PATCH 074/141] trigger: From 79bb12b3b02ca53320a5aa13cc2c1ae048921b1b Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 13:43:56 +0100 Subject: [PATCH 075/141] Revert "style: prettier" This reverts commit e17ed9ea7aadb1899e7695aee02371c7177d232a. --- app/controllers/health_controller.rb | 3 +- app/controllers/labware_controller.rb | 5 +- app/controllers/robots_controller.rb | 6 +- app/controllers/search_controller.rb | 3 +- .../tubes/validate_paired_tubes_controller.rb | 3 +- .../entrypoints/pages/bed_verification.js | 10 +- .../entrypoints/pages/multi_plate_pooling.js | 2 +- .../entrypoints/pages/multi_tube_pooling.js | 8 +- .../entrypoints/pages/tagged-plate.js | 6 +- .../components/CustomTaggedPlate.vue | 2 +- .../custom-tagged-plate/tagClashFunctions.js | 6 +- .../tagClashFunctions.spec.js | 10 +- .../custom-tagged-plate/tagLayoutFunctions.js | 2 +- .../LabwareCustomMetadataAddForm.spec.js | 4 +- .../javascript/lib/global_message_system.js | 2 +- .../components/MultiStampLibrarySplitter.js | 2 +- .../components/PrimerPanelFilter.vue | 2 +- .../multi_stamp_instance.shared_spec.js | 2 +- .../javascript/pipeline-graph/index.js | 2 +- .../plain-javascript/tag-animations.js | 2 +- .../threshold-well-failing.js | 2 +- .../components/QcInformation.vue | 2 +- app/frontend/javascript/session_scripts.js | 2 +- .../components/AssetLookupByUuid.spec.js | 4 +- .../shared/components/LabwareScan.spec.js | 16 +- .../components/mixins/devourSelect.spec.js | 2 +- .../shared/components/plateScanValidators.js | 4 +- .../javascript/shared/devourApiValidators.js | 2 +- .../javascript/shared/transfersLayouts.js | 4 +- .../javascript/shared/tubeTransferVolumes.js | 4 +- .../test_support/factories/json_factory.js | 6 +- .../factories/json_factory.spec.js | 2 +- .../test_support/factories/plate_factory.js | 2 +- .../javascript/test_support/mock_api.spec.js | 2 +- app/frontend/stylesheets/limber/spinner.scss | 86 ++-------- .../concerns/presenters/creation_behaviour.rb | 10 +- .../concerns/presenters/extended_csv.rb | 9 +- app/models/labware_creators/base.rb | 4 +- .../labware_creators/final_tube_from_plate.rb | 6 +- .../labware_creators/multi_stamp_tubes.rb | 4 +- .../multi_stamp_tubes_using_tube_rack_scan.rb | 17 +- .../csv_file_for_duplex_seq.rb | 10 +- .../plate_split_to_tube_racks.rb | 7 +- .../labware_creators/pooled_tubes_base.rb | 11 +- .../pooled_tubes_by_sample.rb | 11 +- .../pooled_tubes_by_submission_with_phi_x.rb | 7 +- .../labware_creators/quadrant_stamp_base.rb | 5 +- app/models/robots/bed/invalid.rb | 3 +- .../robots/bed/plate_to_tube_racks_bed.rb | 4 +- app/sequencescape/sequencescape/api/v2.rb | 10 +- .../sequencescape/api/v2/base.rb | 8 +- .../sequencescape/api/v2/receptacle.rb | 3 +- .../sequencescape/api/v2/well.rb | 3 +- bin/bundle | 152 +++++++++--------- bin/rails | 6 +- bin/rake | 4 +- bin/setup | 2 +- bin/vite | 19 ++- bin/yarn | 16 +- lib/purpose_config.rb | 15 +- lib/robot_configuration.rb | 8 +- lib/tasks/config.rake | 20 ++- limber.sublime-project | 12 +- public/404.html | 2 +- public/422.html | 2 +- public/500.html | 2 +- public/502.html | 2 +- public/504.html | 2 +- spec/controllers/exports_controller_spec.rb | 27 ++-- spec/controllers/plates_controller_spec.rb | 14 +- spec/controllers/qc_files_controller_spec.rb | 42 ++--- .../tube_creation_controller_spec.rb | 18 ++- .../tubes/tubes_exports_controller_spec.rb | 8 +- spec/factories/plate_factories.rb | 29 ++-- spec/factories/poly_metadata_factories.rb | 3 +- spec/factories/purpose_config_factories.rb | 15 +- spec/factories/strategies/api_strategy.rb | 3 +- spec/factories/tube_factories.rb | 8 +- spec/factories/tube_rack_factories.rb | 4 +- spec/factories/well_factories.rb | 8 +- .../charge_and_pass_libraries_spec.rb | 13 +- spec/features/creating_a_plate_spec.rb | 12 +- spec/features/creating_a_tag_plate_spec.rb | 10 +- spec/features/failing_quadrants_spec.rb | 7 +- ...ling_multiple_plates_into_one_tube_spec.rb | 7 +- ...oling_multiple_tubes_into_one_tube_spec.rb | 54 ++++--- spec/features/viewing_a_plate_spec.rb | 7 +- spec/helpers/barcode_labels_helper_spec.rb | 12 +- spec/helpers/plate_helpers_spec.rb | 4 +- .../concentration_binned_plate_spec.rb | 10 +- .../concentration_normalised_plate_spec.rb | 6 +- .../custom_pooled_tubes_spec.rb | 28 ++-- .../custom_tagged_plate_spec.rb | 12 +- .../labware_creators/donor_pooling_spec.rb | 34 ++-- .../final_tube_from_plate_spec.rb | 8 +- .../fixed_normalised_plate_spec.rb | 5 +- .../labware_creators/merged_plate_spec.rb | 51 +++--- .../multi_stamp_tubes_spec.rb | 6 +- ...i_stamp_tubes_using_tube_rack_scan_spec.rb | 49 +++--- .../normalised_binned_plate_spec.rb | 5 +- ...cycles_binned_plate_for_duplex_seq_spec.rb | 42 ++--- ...cycles_binned_plate_for_t_nano_seq_spec.rb | 32 ++-- .../plate_split_to_tube_racks_spec.rb | 108 +++++++------ .../plate_with_template_spec.rb | 9 +- .../pooled_tubes_from_whole_plates_spec.rb | 11 +- .../pooled_tubes_from_whole_tubes_spec.rb | 19 ++- .../quadrant_split_plate_spec.rb | 7 +- .../quadrant_stamp_primer_panel_spec.rb | 7 +- .../labware_creators/shared_examples.rb | 6 +- ...d_plate_reordering_columns_to_rows_spec.rb | 8 +- .../labware_creators/stamped_plate_spec.rb | 18 ++- .../labware_creators/tagged_plate_spec.rb | 14 +- .../labware_creators/tube_from_tube_spec.rb | 9 +- .../well_filter_allowing_partials_spec.rb | 4 +- .../labware_creators/well_filter_spec.rb | 4 +- spec/models/labware_metadata_spec.rb | 22 ++- ...ncentration_binned_plate_presenter_spec.rb | 9 +- .../presenters/final_tube_presenter_spec.rb | 4 +- .../normalised_binned_plate_presenter_spec.rb | 9 +- .../models/presenters/plate_presenter_spec.rb | 10 +- .../presenters/standard_presenter_spec.rb | 8 +- .../submission_plate_presenter_spec.rb | 22 ++- .../presenters/tube_rack_presenter_spec.rb | 8 +- spec/models/robots/pooling_robot_spec.rb | 4 +- spec/models/robots/quadrant_robot_spec.rb | 4 +- spec/models/sequencescape_submission_spec.rb | 42 +++-- spec/sequencescape/api/v2/plate_spec.rb | 48 +++--- spec/sequencescape/api/v2/shared_examples.rb | 12 +- spec/support/api_url_helper.rb | 40 +++-- spec/support/contract_helper.rb | 3 +- spec/support/factory_bot_extensions.rb | 5 +- spec/support/feature_helpers.rb | 6 +- spec/support/robot_helpers.rb | 13 +- ...frost_pbs_to_cellaca_count.csv.erb_spec.rb | 4 +- 134 files changed, 959 insertions(+), 749 deletions(-) diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 1298857fc..02b1ee3cf 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -2,6 +2,5 @@ # Controller to display a page stating that Limber is up, as a health check endpoint class HealthController < ApplicationController - def show - end + def show; end end diff --git a/app/controllers/labware_controller.rb b/app/controllers/labware_controller.rb index eec1a449d..36126b57e 100644 --- a/app/controllers/labware_controller.rb +++ b/app/controllers/labware_controller.rb @@ -22,9 +22,8 @@ def show # rubocop:todo Metrics/AbcSize format.html { render @presenter.page } format.csv do render @presenter.csv - response.headers[ - 'Content-Disposition' - ] = "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename + response.headers['Content-Disposition'] = + "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename end format.json end diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb index 1b119511d..8559b5d7d 100644 --- a/app/controllers/robots_controller.rb +++ b/app/controllers/robots_controller.rb @@ -73,9 +73,9 @@ def update_bed_labware_metadata(bed, robot_barcode) # @raise [Sequencescape::Api::ResourceNotFound] if the labware cannot be found # def labware_created_with_robot(labware_barcode, robot_barcode) - LabwareMetadata.new(user_uuid: current_user_uuid, barcode: labware_barcode).update!( - created_with_robot: robot_barcode - ) + LabwareMetadata + .new(user_uuid: current_user_uuid, barcode: labware_barcode) + .update!(created_with_robot: robot_barcode) end def verify diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index e3ecce169..f2d5e3345 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -7,8 +7,7 @@ class InputError < StandardError before_action :check_for_login!, only: [:my_plates] # rubocop:todo Rails/LexicallyScopedActionFilter - def new - end + def new; end def ongoing_plates # rubocop:todo Metrics/AbcSize plate_search = api.search.find(Settings.searches.fetch('Find plates')) diff --git a/app/controllers/tubes/validate_paired_tubes_controller.rb b/app/controllers/tubes/validate_paired_tubes_controller.rb index db1c8980f..ca929c7cd 100644 --- a/app/controllers/tubes/validate_paired_tubes_controller.rb +++ b/app/controllers/tubes/validate_paired_tubes_controller.rb @@ -5,6 +5,5 @@ class Tubes::ValidatePairedTubesController < ApplicationController before_action :check_for_current_user! - def index - end + def index; end end diff --git a/app/frontend/entrypoints/pages/bed_verification.js b/app/frontend/entrypoints/pages/bed_verification.js index 085885d0f..79af43401 100644 --- a/app/frontend/entrypoints/pages/bed_verification.js +++ b/app/frontend/entrypoints/pages/bed_verification.js @@ -30,21 +30,21 @@ let newScanned = function (bed, labware) { .append( $(document.createElement('h3')) .attr('class', 'ui-li-heading') - .text('Bed: ' + bed), + .text('Bed: ' + bed) ) .append(closeIcon()) .append( $(document.createElement('p')) .attr('class', 'ui-li-desc') - .text('Labware: ' + labware), + .text('Labware: ' + labware) ) .append( $(document.createElement('input')) .attr('type', 'hidden') .attr('id', 'bed_labwares[' + bed + ']') .attr('name', 'bed_labwares[' + bed + '][]') - .val(labware), - ), + .val(labware) + ) ) SCAPE.robot_beds[bed] = SCAPE.robot_beds[bed] || [] SCAPE.robot_beds[bed].push(labware) @@ -162,7 +162,7 @@ $('#validate_layout').on('click', function () { }).fail(function (_data, _status) { SCAPE.message( 'The beds could not be validated. There may be network issues, or problems with Sequencescape.', - 'danger', + 'danger' ) fail() }) diff --git a/app/frontend/entrypoints/pages/multi_plate_pooling.js b/app/frontend/entrypoints/pages/multi_plate_pooling.js index af79ae588..441a30133 100644 --- a/app/frontend/entrypoints/pages/multi_plate_pooling.js +++ b/app/frontend/entrypoints/pages/multi_plate_pooling.js @@ -284,7 +284,7 @@ SCAPE.renderSourceWells = function () { for (let wellName of wells) { well = $('.plate-id-' + plateIndex + ' .' + wellName) well.append( - SCAPE.newAliquot(capPoolOffset + poolNumber, WELLS_IN_COLUMN_MAJOR_ORDER[capPoolOffset + poolNumber]), + SCAPE.newAliquot(capPoolOffset + poolNumber, WELLS_IN_COLUMN_MAJOR_ORDER[capPoolOffset + poolNumber]) ) newInput = $(document.createElement('input')) diff --git a/app/frontend/entrypoints/pages/multi_tube_pooling.js b/app/frontend/entrypoints/pages/multi_tube_pooling.js index 95fc5c028..1c55a96b5 100644 --- a/app/frontend/entrypoints/pages/multi_tube_pooling.js +++ b/app/frontend/entrypoints/pages/multi_tube_pooling.js @@ -74,7 +74,7 @@ newScanned.prototype = { .append( $(document.createElement('h3')) .attr('class', 'ui-li-heading') - .text('Tube: ' + this.tubeBarcode), + .text('Tube: ' + this.tubeBarcode) ) .append($(document.createElement('div')).attr('class', 'tube_validation_report').text('Waiting...')) .append( @@ -82,8 +82,8 @@ newScanned.prototype = { .attr('type', 'hidden') .attr('id', 'tube[parents][' + this.tubeBarcode + ']') .attr('name', 'tube[parents][' + this.tubeBarcode + ']') - .val(1), - ), + .val(1) + ) ) return this.listElement }, @@ -140,7 +140,7 @@ tubeCollector = new statusCollector( }, function () { $('#tube_submit').prop('disabled', true) - }, + } ) $('.sibling-tube').each(function () { diff --git a/app/frontend/entrypoints/pages/tagged-plate.js b/app/frontend/entrypoints/pages/tagged-plate.js index 83e1fe5ed..f401b722f 100644 --- a/app/frontend/entrypoints/pages/tagged-plate.js +++ b/app/frontend/entrypoints/pages/tagged-plate.js @@ -87,7 +87,7 @@ qcableLookup.prototype = { return function () { qc_lookup.message( 'The barcode could not be found. There may be network issues, or problems with Sequencescape.', - 'danger', + 'danger' ) } }, @@ -164,7 +164,7 @@ qcableLookup.prototype = { $(document.createElement('div')) .addClass('alert') .addClass('alert-' + status) - .text(message), + .text(message) ) }, dual: function () { @@ -182,7 +182,7 @@ let qcCollector = new tagStatusCollector( function (message) { $('#submit-summary').text(message) $('#plate_submit').prop('disabled', true) - }, + } ) new qcableLookup($('#plate_tag_plate_barcode'), qcCollector) diff --git a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue index ec11ba7db..07220aff2 100644 --- a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue +++ b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue @@ -252,7 +252,7 @@ export default { this.parentWellSubmissionDetails, this.tagLayout, this.tagSubstitutions, - this.tagGroupOligoStrings, + this.tagGroupOligoStrings ) }, createButtonDisabled() { diff --git a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js index 3548377a6..c4aa5a516 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js +++ b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js @@ -23,7 +23,7 @@ function extractParentWellSubmissionDetails(parentPlate) { // TODO Replace this with generic limber logging when available // See https://github.com/sanger/limber/issues/836 console.error( - 'Tag clash functions: extractParentWellSubmissionDetails: Error: Submission Id not found for well', + 'Tag clash functions: extractParentWellSubmissionDetails: Error: Submission Id not found for well' ) return } @@ -94,7 +94,7 @@ function extractChildUsedOligos(parentUsedOligos, parentWellSubmDetails, tagLayo parentWellSubmDetails, tagLayout, tagSubstitutions, - tagGroupOligos, + tagGroupOligos ) ) { return {} @@ -135,7 +135,7 @@ function isValidChildUsedOligoParameters( parentWellSubmDetails, tagLayout, tagSubstitutions, - tagGroupOligos, + tagGroupOligos ) { let isValid = true diff --git a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js index b027dc95a..40e1a90e7 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js +++ b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js @@ -362,7 +362,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos, + tagGroupOligos ) expect(response).toEqual(exptSubmUsedTags) @@ -399,7 +399,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos, + tagGroupOligos ) expect(response).toEqual(exptSubmUsedTags) @@ -435,7 +435,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos, + tagGroupOligos ) expect(response).toEqual(exptSubmUsedTags) @@ -473,7 +473,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos, + tagGroupOligos ) expect(response).toEqual(exptSubmUsedTags) @@ -509,7 +509,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos, + tagGroupOligos ) expect(response).toEqual(exptSubmUsedTags) diff --git a/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js b/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js index 341bd7ff0..580e8ec0a 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js +++ b/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js @@ -147,7 +147,7 @@ const calculateTagLayout = function (data) { data.tagsPerWell, (well, relIndex, absIndex) => { return walkingByFunctions[data.walkingBy](well, tags, relIndex, absIndex, offset, counters) - }, + } ) } diff --git a/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js b/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js index 251efe18d..4b70ceb96 100644 --- a/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js +++ b/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js @@ -28,7 +28,7 @@ describe('LabwareCustomMetadataAddForm', () => { global.fetch = vi.fn().mockReturnValue( Promise.resolve({ json: () => Promise.resolve(data), - }), + }) ) // This is a workaround for the following warning: @@ -80,7 +80,7 @@ describe('LabwareCustomMetadataAddForm', () => { // expect(wrapper.find('#RT DFD Syringe Lot Number').exists()).toBe(true) expect(wrapper.find('#labware_custom_metadata_submit_button').exists()).toBe(true) expect(wrapper.find('#labware_custom_metadata_submit_button').text()).toEqual( - 'Add Custom Metadata to Sequencescape', + 'Add Custom Metadata to Sequencescape' ) }) }) diff --git a/app/frontend/javascript/lib/global_message_system.js b/app/frontend/javascript/lib/global_message_system.js index f8aa308e3..82fea0d7a 100644 --- a/app/frontend/javascript/lib/global_message_system.js +++ b/app/frontend/javascript/lib/global_message_system.js @@ -16,7 +16,7 @@ SCAPE.message = function (message, status) { $(document.createElement('div')) .addClass('alert') .addClass('alert-' + status) - .text(message), + .text(message) ) } diff --git a/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js b/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js index be6912133..29d0a256a 100644 --- a/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js +++ b/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js @@ -95,7 +95,7 @@ export default Vue.extend({ headers: { 'X-Requested-With': 'XMLHttpRequest' }, data: payload, }) - }), + }) ) .then((responses) => { const response = responses[0] diff --git a/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue b/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue index 005de6dbe..fad3d94b4 100644 --- a/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue +++ b/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue @@ -39,7 +39,7 @@ export default { return [] } const primerPanelsIterable = Array.from(primerPanelsByPlate.values()).reduce((accu, current) => - accu.filter((val) => current.includes(val)), + accu.filter((val) => current.includes(val)) ) return primerPanelsIterable }, diff --git a/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js b/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js index 058fab0bb..660316d2f 100644 --- a/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js +++ b/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js @@ -171,7 +171,7 @@ const sharedSpecs = (args) => { expect(wrapper.vm.duplicatedTransfers.length).toEqual(1) expect(wrapper.vm.transfersError).toEqual( - 'This would result in multiple transfers into the same well. Check if the source plates (DN1S) have more than one active submission.', + 'This would result in multiple transfers into the same well. Check if the source plates (DN1S) have more than one active submission.' ) }) diff --git a/app/frontend/javascript/pipeline-graph/index.js b/app/frontend/javascript/pipeline-graph/index.js index 9b3d477f8..658a6b454 100644 --- a/app/frontend/javascript/pipeline-graph/index.js +++ b/app/frontend/javascript/pipeline-graph/index.js @@ -204,7 +204,7 @@ const applyMouseEvents = function () {
${content}
- `, + ` ) return document.querySelector('.graph-tooltip') }, diff --git a/app/frontend/javascript/plain-javascript/tag-animations.js b/app/frontend/javascript/plain-javascript/tag-animations.js index 2a96413fb..37abc6e77 100644 --- a/app/frontend/javascript/plain-javascript/tag-animations.js +++ b/app/frontend/javascript/plain-javascript/tag-animations.js @@ -27,5 +27,5 @@ document.addEventListener( } } }, - false, + false ) diff --git a/app/frontend/javascript/plain-javascript/threshold-well-failing.js b/app/frontend/javascript/plain-javascript/threshold-well-failing.js index 9c161191f..9d3061587 100644 --- a/app/frontend/javascript/plain-javascript/threshold-well-failing.js +++ b/app/frontend/javascript/plain-javascript/threshold-well-failing.js @@ -51,7 +51,7 @@ document.addEventListener('DOMContentLoaded', () => { // The well must meet all thresholds. const wellInvalid = Object.entries(threshold).some( - ([qcKey, thresholdValue]) => parseFloat(well.dataset[qcKey]) < thresholdValue, + ([qcKey, thresholdValue]) => parseFloat(well.dataset[qcKey]) < thresholdValue ) well.checked = wellInvalid diff --git a/app/frontend/javascript/qc-information/components/QcInformation.vue b/app/frontend/javascript/qc-information/components/QcInformation.vue index fcfd7d556..fdcceb2a9 100644 --- a/app/frontend/javascript/qc-information/components/QcInformation.vue +++ b/app/frontend/javascript/qc-information/components/QcInformation.vue @@ -108,7 +108,7 @@ export default { }, () => { this.state = 'failure' - }, + } ) }, }, diff --git a/app/frontend/javascript/session_scripts.js b/app/frontend/javascript/session_scripts.js index 925bfc5a6..e72d80654 100644 --- a/app/frontend/javascript/session_scripts.js +++ b/app/frontend/javascript/session_scripts.js @@ -20,7 +20,7 @@ logIn = function () { if (user_name !== wasLoggedIn) { updateUserName(user_name) warning( - 'The logged in user has changed since this page was last viewed. You are now logged in as ' + user_name + '.', + 'The logged in user has changed since this page was last viewed. You are now logged in as ' + user_name + '.' ) } } else { diff --git a/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js b/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js index 32dafca05..a1990a362 100644 --- a/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js +++ b/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js @@ -34,7 +34,7 @@ describe('AssetLookupByUuid', () => { filter: { uuid: assetUuid }, fields: {}, }, - { data: [] }, // no plates found + { data: [] } // no plates found ) const wrapper = wrapperFactoryPlate(api) @@ -59,7 +59,7 @@ describe('AssetLookupByUuid', () => { filter: { uuid: assetUuid }, fields: {}, }, - goodPlate, + goodPlate ) const wrapper = wrapperFactoryPlate(api) diff --git a/app/frontend/javascript/shared/components/LabwareScan.spec.js b/app/frontend/javascript/shared/components/LabwareScan.spec.js index 7ec99fb41..ddfb7fc39 100644 --- a/app/frontend/javascript/shared/components/LabwareScan.spec.js +++ b/app/frontend/javascript/shared/components/LabwareScan.spec.js @@ -138,7 +138,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - goodTube, + goodTube ) wrapper.find('input').setValue('DN12345') @@ -170,7 +170,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - nullTube, + nullTube ) const wrapper = wrapperFactoryTube(api) @@ -202,7 +202,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - pendingTube, + pendingTube ) wrapper.find('input').setValue('Good barcode') @@ -263,7 +263,7 @@ describe('LabwareScan', () => { status: 500, }, ], - }, + } ) const wrapper = wrapperFactoryTube(api) @@ -312,7 +312,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - goodPlate, + goodPlate ) wrapper.find('input').setValue('DN12345') @@ -343,7 +343,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - nullPlate, + nullPlate ) const wrapper = wrapperFactoryPlate(api) @@ -373,7 +373,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - badPlate, + badPlate ) wrapper.find('input').setValue('Good barcode') @@ -428,7 +428,7 @@ describe('LabwareScan', () => { status: 500, }, ], - }, + } ) const wrapper = wrapperFactoryPlate(api) diff --git a/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js b/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js index 9e3c60d5a..7ea4886fe 100644 --- a/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js +++ b/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js @@ -99,7 +99,7 @@ describe('DevourSelect mixin', () => { status: 500, }, ], - }, + } ) const wrapper = wrapperFactory(api) diff --git a/app/frontend/javascript/shared/components/plateScanValidators.js b/app/frontend/javascript/shared/components/plateScanValidators.js index 843fa0f8a..82e89792e 100644 --- a/app/frontend/javascript/shared/components/plateScanValidators.js +++ b/app/frontend/javascript/shared/components/plateScanValidators.js @@ -306,13 +306,13 @@ const checkAllLibraryRequestsWithSameReadySubmissions = () => { return (plate) => { const [firstWellSubmissionIds, ...remainingWellsSubmissionIds] = getAllLibrarySubmissionsWithMatchingStateForPlate( plate, - 'ready', + 'ready' ) // To compare lists we use _.isEqual because there is no equivalent function for lists in // plain Javascript if ( remainingWellsSubmissionIds.every((currentElemSubmissionIds) => - _.isEqual(firstWellSubmissionIds.sort(), currentElemSubmissionIds.sort()), + _.isEqual(firstWellSubmissionIds.sort(), currentElemSubmissionIds.sort()) ) ) { return validScanMessage() diff --git a/app/frontend/javascript/shared/devourApiValidators.js b/app/frontend/javascript/shared/devourApiValidators.js index abece2c81..ceb6ef19b 100644 --- a/app/frontend/javascript/shared/devourApiValidators.js +++ b/app/frontend/javascript/shared/devourApiValidators.js @@ -25,7 +25,7 @@ const hasExpectedProperties = (expectedProperties) => { for (const currTagGroup of results) { const hasAllProperties = expectedProperties.every((property) => - Object.prototype.hasOwnProperty.call(currTagGroup, property), + Object.prototype.hasOwnProperty.call(currTagGroup, property) ) if (!hasAllProperties) { diff --git a/app/frontend/javascript/shared/transfersLayouts.js b/app/frontend/javascript/shared/transfersLayouts.js index e1500ff06..43be7b1ef 100644 --- a/app/frontend/javascript/shared/transfersLayouts.js +++ b/app/frontend/javascript/shared/transfersLayouts.js @@ -54,7 +54,7 @@ const quadrantTransfers = function (requestsWithPlates) { plateObj.index, well.position.name, quadrantOffsets.rowOffset, - quadrantOffsets.colOffset, + quadrantOffsets.colOffset ) const transfer = { request: request, @@ -189,7 +189,7 @@ const buildSequentialTransfersArray = function (transferRequests) { // const buildSequentialLibrarySplitTransfersArray = function ( transferRequests, - numberOfWellsForEachSourcePlateInColumnOrder = 24, + numberOfWellsForEachSourcePlateInColumnOrder = 24 ) { const libraryTypes = [] return transferRequests.map((requestWithPlate) => { diff --git a/app/frontend/javascript/shared/tubeTransferVolumes.js b/app/frontend/javascript/shared/tubeTransferVolumes.js index 4ca595ecf..342f1cb00 100644 --- a/app/frontend/javascript/shared/tubeTransferVolumes.js +++ b/app/frontend/javascript/shared/tubeTransferVolumes.js @@ -13,10 +13,10 @@ const tubeMostRecentMolarity = function (tube) { const qcResults = tube?.receptacle?.qc_results const molarityEntries = qcResults?.filter((result) => result.key === 'molarity' && result.units === 'nM') const sortedByCreatedAt = molarityEntries?.sort( - (resultA, resultB) => -1 * ('' + resultA.created_at).localeCompare(resultB.created_at), + (resultA, resultB) => -1 * ('' + resultA.created_at).localeCompare(resultB.created_at) ) const sortedByIds = sortedByCreatedAt?.sort((resultA, resultB) => - parseInt(resultA.id) > parseInt(resultB.id) ? -1 : 1, + parseInt(resultA.id) > parseInt(resultB.id) ? -1 : 1 ) const mostRecentMolarityResult = sortedByIds?.[0] return mostRecentMolarityResult ? parseFloat(mostRecentMolarityResult?.value) : undefined diff --git a/app/frontend/javascript/test_support/factories/json_factory.js b/app/frontend/javascript/test_support/factories/json_factory.js index 4490c68ef..56e4400c9 100644 --- a/app/frontend/javascript/test_support/factories/json_factory.js +++ b/app/frontend/javascript/test_support/factories/json_factory.js @@ -71,7 +71,7 @@ const extractAssociations = (resource_config, attributeValues, resourceUrl) => { return { relationships, included } }, - { relationships: {}, included: [] }, + { relationships: {}, included: [] } ) } @@ -94,7 +94,7 @@ const buildMany = (associationName, associationValue) => { includeData.push(...singleResource.includeData) return { relationData, includeData } }, - { relationData: { data: [] }, includeData: [] }, + { relationData: { data: [] }, includeData: [] } ) } @@ -168,7 +168,7 @@ const jsonCollectionFactory = (factoryName, collectionAttributes, options = {}) included.push(...json.included) return { data, included } }, - { data: [], included: [] }, + { data: [], included: [] } ) return { diff --git a/app/frontend/javascript/test_support/factories/json_factory.spec.js b/app/frontend/javascript/test_support/factories/json_factory.spec.js index bf9cbc073..036869523 100644 --- a/app/frontend/javascript/test_support/factories/json_factory.spec.js +++ b/app/frontend/javascript/test_support/factories/json_factory.spec.js @@ -242,7 +242,7 @@ describe('jsonCollectionFactory', () => { ], { base: 'assets/123/comments', - }, + } ) expect(json).toEqual({ diff --git a/app/frontend/javascript/test_support/factories/plate_factory.js b/app/frontend/javascript/test_support/factories/plate_factory.js index fc7d0b880..53a9ac1d3 100644 --- a/app/frontend/javascript/test_support/factories/plate_factory.js +++ b/app/frontend/javascript/test_support/factories/plate_factory.js @@ -26,7 +26,7 @@ const plateFactory = function (options = {}) { position: { name: indexToName(iteration, 8) }, }, ..._wellOptions, - }), + }) ), } return { ...plateDefaults, ...(plateOptions || {}) } diff --git a/app/frontend/javascript/test_support/mock_api.spec.js b/app/frontend/javascript/test_support/mock_api.spec.js index b0b795a80..f33ac7d1e 100644 --- a/app/frontend/javascript/test_support/mock_api.spec.js +++ b/app/frontend/javascript/test_support/mock_api.spec.js @@ -42,7 +42,7 @@ describe('mockApi', () => { status: 500, }, ], - }, + } ) let response = await api.devour diff --git a/app/frontend/stylesheets/limber/spinner.scss b/app/frontend/stylesheets/limber/spinner.scss index d2430970e..ab8e7ad23 100644 --- a/app/frontend/stylesheets/limber/spinner.scss +++ b/app/frontend/stylesheets/limber/spinner.scss @@ -36,111 +36,57 @@ 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); - box-shadow: - 0 -0.83em 0 -0.4em, - 0 -0.83em 0 -0.42em, - 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, - 0 -0.83em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: - 0 -0.83em 0 -0.4em, - 0 -0.83em 0 -0.42em, - 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, - 0 -0.83em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: - 0 -0.83em 0 -0.4em, - -0.087em -0.825em 0 -0.42em, - -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, - -0.297em -0.775em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: - 0 -0.83em 0 -0.4em, - -0.338em -0.758em 0 -0.42em, - -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, - -0.749em -0.34em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: - 0 -0.83em 0 -0.4em, - -0.377em -0.74em 0 -0.42em, - -0.645em -0.522em 0 -0.44em, - -0.775em -0.297em 0 -0.46em, + box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); - box-shadow: - 0 -0.83em 0 -0.4em, - 0 -0.83em 0 -0.42em, - 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, - 0 -0.83em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } } @keyframes load6 { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); - box-shadow: - 0 -0.83em 0 -0.4em, - 0 -0.83em 0 -0.42em, - 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, - 0 -0.83em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: - 0 -0.83em 0 -0.4em, - 0 -0.83em 0 -0.42em, - 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, - 0 -0.83em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: - 0 -0.83em 0 -0.4em, - -0.087em -0.825em 0 -0.42em, - -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, - -0.297em -0.775em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: - 0 -0.83em 0 -0.4em, - -0.338em -0.758em 0 -0.42em, - -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, - -0.749em -0.34em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: - 0 -0.83em 0 -0.4em, - -0.377em -0.74em 0 -0.42em, - -0.645em -0.522em 0 -0.44em, - -0.775em -0.297em 0 -0.46em, + box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); - box-shadow: - 0 -0.83em 0 -0.4em, - 0 -0.83em 0 -0.42em, - 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, - 0 -0.83em 0 -0.477em; + box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } } diff --git a/app/models/concerns/presenters/creation_behaviour.rb b/app/models/concerns/presenters/creation_behaviour.rb index 385ce117a..73f6b638a 100644 --- a/app/models/concerns/presenters/creation_behaviour.rb +++ b/app/models/concerns/presenters/creation_behaviour.rb @@ -23,9 +23,10 @@ def purposes_of_type(type) end def construct_buttons(scope) - scope - .map do |purpose_uuid, purpose_settings| - LabwareCreators.class_for(purpose_uuid).creator_button( + scope.map do |purpose_uuid, purpose_settings| + LabwareCreators + .class_for(purpose_uuid) + .creator_button( creator: LabwareCreators.class_for(purpose_uuid), parent_uuid: uuid, parent: labware, @@ -34,8 +35,7 @@ def construct_buttons(scope) type: purpose_settings.asset_type, filters: purpose_settings.filters || {} ) - end - .force + end.force end def active_pipelines diff --git a/app/models/concerns/presenters/extended_csv.rb b/app/models/concerns/presenters/extended_csv.rb index 687b81192..43792c343 100644 --- a/app/models/concerns/presenters/extended_csv.rb +++ b/app/models/concerns/presenters/extended_csv.rb @@ -57,7 +57,14 @@ def transfers_for_csv # rubocop:todo Metrics/AbcSize destination_barcode = ct.destination.barcode.machine transfers = ct.transfers.reverse_merge(all_wells).sort { |a, b| split_location(a.first) <=> split_location(b.first) } - { source_ean:, source_barcode:, source_stock:, destination_ean:, destination_barcode:, transfers: } + { + source_ean:, + source_barcode:, + source_stock:, + destination_ean:, + destination_barcode:, + transfers: + } end end end diff --git a/app/models/labware_creators/base.rb b/app/models/labware_creators/base.rb index 5a3278750..92c1913cd 100644 --- a/app/models/labware_creators/base.rb +++ b/app/models/labware_creators/base.rb @@ -117,7 +117,9 @@ def create_plate_from_parent! end def transfer!(attributes) - Sequencescape::Api::V2::Transfer.create!(attributes.merge(transfer_template_uuid:, user_uuid:)) + Sequencescape::Api::V2::Transfer.create!( + attributes.merge(transfer_template_uuid:, user_uuid:) + ) end def transfer_material_from_parent!(child_uuid) diff --git a/app/models/labware_creators/final_tube_from_plate.rb b/app/models/labware_creators/final_tube_from_plate.rb index 7fca03be6..1537864e2 100644 --- a/app/models/labware_creators/final_tube_from_plate.rb +++ b/app/models/labware_creators/final_tube_from_plate.rb @@ -48,7 +48,11 @@ def pass_tubes! raise StandardError, 'Tubes cannot be passed before transfer' if @create_transfer.nil? tubes_from_transfer.each do |tube_uuid| - Sequencescape::Api::V2::StateChange.create!(target_state: 'passed', target_uuid: tube_uuid, user_uuid:) + Sequencescape::Api::V2::StateChange.create!( + target_state: 'passed', + target_uuid: tube_uuid, + user_uuid: + ) end end diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 51608f418..7c067a18d 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -160,7 +160,9 @@ def create_submission_from_parent_tubes sequencescape_submission_parameters = { template_name: configured_params[:template_name], request_options: configured_params[:request_options], - asset_groups: [{ assets: asset_uuids, autodetect_studies:, autodetect_projects: }], + asset_groups: [ + { assets: asset_uuids, autodetect_studies:, autodetect_projects: } + ], api:, user: user_uuid } diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index d640a3ca6..d1aab1bd2 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -246,14 +246,15 @@ def transfer_material_from_parent!(child_plate) # @return [Array] An array of hashes representing the transfer requests. def transfer_request_attributes(child_plate) parent_tubes.each_with_object([]) do |(foreign_barcode, parent_tube), tube_transfers| - tube_transfers << request_hash( - parent_tube.uuid, - child_plate - .wells - .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } - &.uuid, - { outer_request: source_tube_outer_request_uuid(parent_tube) } - ) + tube_transfers << + request_hash( + parent_tube.uuid, + child_plate + .wells + .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } + &.uuid, + { outer_request: source_tube_outer_request_uuid(parent_tube) } + ) end end diff --git a/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb b/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb index b7ff6d86f..c6b95285e 100644 --- a/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb +++ b/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb @@ -14,14 +14,8 @@ module PcrCyclesBinnedPlate class CsvFileForDuplexSeq < CsvFileBase delegate :submit_for_sequencing_column, :sub_pool_column, :coverage_column, to: :well_details_header_row - FIELDS_FOR_WELL_DETAILS = %w[ - diluent_volume - pcr_cycles - submit_for_sequencing - sub_pool - coverage - sample_volume - ].freeze + FIELDS_FOR_WELL_DETAILS = %w[diluent_volume pcr_cycles submit_for_sequencing sub_pool coverage sample_volume] + .freeze # Returns the contents of the header row for the well detail columns def well_details_header_row diff --git a/app/models/labware_creators/plate_split_to_tube_racks.rb b/app/models/labware_creators/plate_split_to_tube_racks.rb index e476eb7d5..c9bd26883 100644 --- a/app/models/labware_creators/plate_split_to_tube_racks.rb +++ b/app/models/labware_creators/plate_split_to_tube_racks.rb @@ -654,10 +654,9 @@ def add_contingency_tube_metadata # @param tube_details [Hash] The tube details hash from the tube rack scan file. # @return [void] def add_tube_metadata(child_tube, tube_posn, tube_details) - LabwareMetadata.new(user_uuid:, barcode: child_tube.barcode.machine).update!( - tube_rack_barcode: tube_details['tube_rack_barcode'], - tube_rack_position: tube_posn - ) + LabwareMetadata + .new(user_uuid:, barcode: child_tube.barcode.machine) + .update!(tube_rack_barcode: tube_details['tube_rack_barcode'], tube_rack_position: tube_posn) end # Generates a transfer request hash for the given source well UUID, target tube UUID, and additional parameters. diff --git a/app/models/labware_creators/pooled_tubes_base.rb b/app/models/labware_creators/pooled_tubes_base.rb index 90f6e5965..0ba193629 100644 --- a/app/models/labware_creators/pooled_tubes_base.rb +++ b/app/models/labware_creators/pooled_tubes_base.rb @@ -41,11 +41,12 @@ def transfer_request_attributes # this currently assumes that pool_identifier will be the submission_uuid # (it would have always been, historically) pool.each do |location| - transfer_requests << request_hash( - well_locations.fetch(location).uuid, - child_stock_tubes.fetch(name_for(pool)).uuid, - pool_identifier - ) + transfer_requests << + request_hash( + well_locations.fetch(location).uuid, + child_stock_tubes.fetch(name_for(pool)).uuid, + pool_identifier + ) end end end diff --git a/app/models/labware_creators/pooled_tubes_by_sample.rb b/app/models/labware_creators/pooled_tubes_by_sample.rb index 6b9e84a5e..8039a40ba 100644 --- a/app/models/labware_creators/pooled_tubes_by_sample.rb +++ b/app/models/labware_creators/pooled_tubes_by_sample.rb @@ -69,11 +69,12 @@ def name_for_details(pool_identifier) def transfer_request_attributes pools.each_with_object([]) do |(pool_identifier, pool), transfer_requests| pool.each do |location| - transfer_requests << request_hash( - well_locations.fetch(location).uuid, - child_stock_tubes.fetch(name_for(name_for_details(pool_identifier))).uuid, - pool_identifier - ) + transfer_requests << + request_hash( + well_locations.fetch(location).uuid, + child_stock_tubes.fetch(name_for(name_for_details(pool_identifier))).uuid, + pool_identifier + ) end end end diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index a2aedacce..76745ae75 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -17,7 +17,12 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission def create_child_stock_tubes api .specific_tube_creation - .create!(user: user_uuid, parents:, child_purposes: [purpose_uuid] * pool_uuids.length, tube_attributes:) + .create!( + user: user_uuid, + parents:, + child_purposes: [purpose_uuid] * pool_uuids.length, + tube_attributes: + ) .children .index_by(&:name) end diff --git a/app/models/labware_creators/quadrant_stamp_base.rb b/app/models/labware_creators/quadrant_stamp_base.rb index 2cf134dc8..1757dadc7 100644 --- a/app/models/labware_creators/quadrant_stamp_base.rb +++ b/app/models/labware_creators/quadrant_stamp_base.rb @@ -46,9 +46,8 @@ def source_plates_by_quadrant transfers.each do |transfer| target_well_location = transfer.dig(:new_target, :location) target_well_quadrant = WellHelpers.well_quadrant(target_well_location) - source_plates_uuids[target_well_quadrant] = transfer[:source_plate] if source_plates_uuids[ - target_well_quadrant - ].nil? + source_plates_uuids[target_well_quadrant] = transfer[:source_plate] if source_plates_uuids[target_well_quadrant] + .nil? end source_plates_uuids end diff --git a/app/models/robots/bed/invalid.rb b/app/models/robots/bed/invalid.rb index d881210d2..f707b1606 100644 --- a/app/models/robots/bed/invalid.rb +++ b/app/models/robots/bed/invalid.rb @@ -7,8 +7,7 @@ def initialize(barcode) @barcode = barcode end - def load(_plate_barcodes) - end + def load(_plate_barcodes); end def plate nil diff --git a/app/models/robots/bed/plate_to_tube_racks_bed.rb b/app/models/robots/bed/plate_to_tube_racks_bed.rb index aa3d3c928..47fa24aa2 100644 --- a/app/models/robots/bed/plate_to_tube_racks_bed.rb +++ b/app/models/robots/bed/plate_to_tube_racks_bed.rb @@ -17,7 +17,9 @@ class PlateToTubeRacksBed < Robots::Bed::Base def labware_created_with_robot(robot_barcode) # RobotController uses machine barcode for initialising LabwareMetadata labware.tubes.each do |tube| - LabwareMetadata.new(user_uuid:, barcode: tube.barcode.machine).update!(created_with_robot: robot_barcode) + LabwareMetadata + .new(user_uuid:, barcode: tube.barcode.machine) + .update!(created_with_robot: robot_barcode) end end diff --git a/app/sequencescape/sequencescape/api/v2.rb b/app/sequencescape/sequencescape/api/v2.rb index 5b06efc3e..7891ecaa9 100644 --- a/app/sequencescape/sequencescape/api/v2.rb +++ b/app/sequencescape/sequencescape/api/v2.rb @@ -30,7 +30,10 @@ module Sequencescape::Api::V2 # @return [Sequencescape::V2::Api::Labware] Found labware object # def self.minimal_labware_by_barcode(barcode, select: :uuid) - Sequencescape::Api::V2::Labware.where(barcode:).select(tube_racks: select, plates: select, tubes: select).first + Sequencescape::Api::V2::Labware + .where(barcode:) + .select(tube_racks: select, plates: select, tubes: select) + .first end # sample_description added into includes here for use in bioscan plate label creation @@ -68,7 +71,10 @@ def self.plate_for_completion(uuid) end def self.tube_for_completion(uuid) - Tube.includes('receptacle.aliquots.request.submission,receptacle.aliquots.request.request_type').find(uuid:).first + Tube + .includes('receptacle.aliquots.request.submission,receptacle.aliquots.request.request_type') + .find(uuid:) + .first end def self.plate_with_custom_includes(include_params, search_params) diff --git a/app/sequencescape/sequencescape/api/v2/base.rb b/app/sequencescape/sequencescape/api/v2/base.rb index 933fb5686..2cb7a15e8 100644 --- a/app/sequencescape/sequencescape/api/v2/base.rb +++ b/app/sequencescape/sequencescape/api/v2/base.rb @@ -12,12 +12,8 @@ class SequencescapePaginator < JsonApiClient::Paginating::NestedParamPaginator # set the api base url in an abstract base class self.site = Limber::Application.config.api.v2.connection_options.url - connection.faraday.headers['X-Sequencescape-Client-Id'] = Limber::Application - .config - .api - .v2 - .connection_options - .authorisation + connection.faraday.headers['X-Sequencescape-Client-Id'] = + Limber::Application.config.api.v2.connection_options.authorisation self.plate = false self.tube = false self.paginator = SequencescapePaginator diff --git a/app/sequencescape/sequencescape/api/v2/receptacle.rb b/app/sequencescape/sequencescape/api/v2/receptacle.rb index deb61afbc..b940df168 100644 --- a/app/sequencescape/sequencescape/api/v2/receptacle.rb +++ b/app/sequencescape/sequencescape/api/v2/receptacle.rb @@ -11,8 +11,7 @@ def latest_molarity end def latest_qc(key:, units:) - qc_results - .to_a # Convert to array to resolve any api queries. Otherwise select fails to work. + qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work. .select { |qc| qc.key.casecmp(key).zero? } .select { |qc| qc.units.casecmp(units).zero? } .max_by(&:created_at) diff --git a/app/sequencescape/sequencescape/api/v2/well.rb b/app/sequencescape/sequencescape/api/v2/well.rb index 0cd141e8f..5b5a8b047 100644 --- a/app/sequencescape/sequencescape/api/v2/well.rb +++ b/app/sequencescape/sequencescape/api/v2/well.rb @@ -40,8 +40,7 @@ def latest_cell_viability end def latest_qc(key:, units:) - qc_results - .to_a # Convert to array to resolve any api queries. Otherwise select fails to work. + qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work. .select { |qc| qc.key.casecmp(key).zero? } .select { |qc| qc.units.casecmp(units).zero? } .max_by(&:created_at) diff --git a/bin/bundle b/bin/bundle index 8f0e1240e..374a0a1fa 100755 --- a/bin/bundle +++ b/bin/bundle @@ -8,103 +8,107 @@ # this file is here to facilitate running it. # -require 'rubygems' +require "rubygems" -m = - Module.new do - module_function +m = Module.new do + module_function - def invoked_as_script? - File.expand_path($0) == File.expand_path(__FILE__) - end + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end - def env_var_version - ENV['BUNDLER_VERSION'] - end + def env_var_version + ENV["BUNDLER_VERSION"] + end - def cli_arg_version - return unless invoked_as_script? # don't want to hijack other binstubs - return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update` - bundler_version = nil - update_index = nil - ARGV.each_with_index do |a, i| - bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN - next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ - bundler_version = $1 - update_index = i + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a end - bundler_version + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i end + bundler_version + end - def gemfile - gemfile = ENV['BUNDLE_GEMFILE'] - return gemfile if gemfile && !gemfile.empty? + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? - File.expand_path('../../Gemfile', __FILE__) - end + File.expand_path("../../Gemfile", __FILE__) + end - def lockfile - lockfile = - case File.basename(gemfile) - when 'gems.rb' - gemfile.sub(/\.rb$/, gemfile) - else - "#{gemfile}.lock" - end - File.expand_path(lockfile) - end + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end - def lockfile_version - return unless File.file?(lockfile) - lockfile_contents = File.read(lockfile) - return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ - Regexp.last_match(1) - end + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end - def bundler_requirement - @bundler_requirement ||= env_var_version || cli_arg_version || bundler_requirement_for(lockfile_version) - end + def bundler_requirement + @bundler_requirement ||= + env_var_version || cli_arg_version || + bundler_requirement_for(lockfile_version) + end - def bundler_requirement_for(version) - return "#{Gem::Requirement.default}.a" unless version + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version - bundler_gem_version = Gem::Version.new(version) + bundler_gem_version = Gem::Version.new(version) - requirement = bundler_gem_version.approximate_recommendation + requirement = bundler_gem_version.approximate_recommendation - return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.7.0') + return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") - requirement += '.a' if bundler_gem_version.prerelease? + requirement += ".a" if bundler_gem_version.prerelease? - requirement - end + requirement + end - def load_bundler! - ENV['BUNDLE_GEMFILE'] ||= gemfile + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile - activate_bundler - end + activate_bundler + end - def activate_bundler - gem_error = activation_error_handling { gem 'bundler', bundler_requirement } - return if gem_error.nil? - require_error = activation_error_handling { require 'bundler/version' } - if require_error.nil? && - Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) - return - end - warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" - exit 42 + def activate_bundler + gem_error = activation_error_handling do + gem "bundler", bundler_requirement end - - def activation_error_handling - yield - nil - rescue StandardError, LoadError => e - e + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e end +end m.load_bundler! -load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script? +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/bin/rails b/bin/rails index 073966023..efc037749 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index 17240489f..4fbf10b96 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index dc69ded5d..1ac8ce0b7 100755 --- a/bin/setup +++ b/bin/setup @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require 'fileutils' +require "fileutils" # path to your application root. APP_ROOT = File.expand_path('..', __dir__) diff --git a/bin/vite b/bin/vite index 9d3b5d5fd..11fb801e6 100755 --- a/bin/vite +++ b/bin/vite @@ -8,23 +8,22 @@ # this file is here to facilitate running it. # -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath) +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) -bundle_binstub = File.expand_path('../bundle', __FILE__) +bundle_binstub = File.expand_path("../bundle", __FILE__) if File.file?(bundle_binstub) if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ load(bundle_binstub) else - abort( - 'Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.' - ) + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") end end -require 'rubygems' -require 'bundler/setup' +require "rubygems" +require "bundler/setup" -load Gem.bin_path('vite_ruby', 'vite') +load Gem.bin_path("vite_ruby", "vite") diff --git a/bin/yarn b/bin/yarn index 36d20fc9e..9fab2c350 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,19 +1,17 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - yarn = - ENV['PATH'] - .split(File::PATH_SEPARATOR) - .select { |dir| File.expand_path(dir) != __dir__ } - .product(%w[yarn yarn.cmd yarn.ps1]) - .map { |dir, file| File.expand_path(file, dir) } - .find { |file| File.executable?(file) } + yarn = ENV["PATH"].split(File::PATH_SEPARATOR). + select { |dir| File.expand_path(dir) != __dir__ }. + product(["yarn", "yarn.cmd", "yarn.ps1"]). + map { |dir, file| File.expand_path(file, dir) }. + find { |file| File.executable?(file) } if yarn exec yarn, *ARGV else - $stderr.puts 'Yarn executable was not detected in the system.' - $stderr.puts 'Download Yarn at https://yarnpkg.com/en/docs/install' + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1 end end diff --git a/lib/purpose_config.rb b/lib/purpose_config.rb index f08522d3f..7c94766b4 100644 --- a/lib/purpose_config.rb +++ b/lib/purpose_config.rb @@ -109,13 +109,14 @@ def register! # maintains the behaviour of version 1, but includes an addditional # asset_shape option if configured. It raises an error if the purpose # cannot be created. - options_for_creation = { - name:, - stock_plate: config.fetch(:stock_plate, false), - cherrypickable_target: config.fetch(:cherrypickable_target, false), - input_plate: config.fetch(:input_plate, false), - size: config.fetch(:size, 96) - }.merge(config.slice(:asset_shape)) + options_for_creation = + { + name:, + stock_plate: config.fetch(:stock_plate, false), + cherrypickable_target: config.fetch(:cherrypickable_target, false), + input_plate: config.fetch(:input_plate, false), + size: config.fetch(:size, 96) + }.merge(config.slice(:asset_shape)) Sequencescape::Api::V2::PlatePurpose.create!(options_for_creation) end end diff --git a/lib/robot_configuration.rb b/lib/robot_configuration.rb index d17f7f711..daabc102c 100644 --- a/lib/robot_configuration.rb +++ b/lib/robot_configuration.rb @@ -32,7 +32,13 @@ def custom_robot(key, hash) end def bravo_robot(transition_to: 'passed', verify_robot: false, require_robot: false, &) - simple_robot('bravo', transition_to:, verify_robot:, require_robot:, &) + simple_robot( + 'bravo', + transition_to:, + verify_robot:, + require_robot:, + & + ) end def simple_robot(type, transition_to: 'passed', verify_robot: false, require_robot: false, &) diff --git a/lib/tasks/config.rake b/lib/tasks/config.rake index cbfafcba1..75630953a 100644 --- a/lib/tasks/config.rake +++ b/lib/tasks/config.rake @@ -48,10 +48,8 @@ namespace :config do # TODO: Y24-190 - Remove this once we have moved everything else over to V2; # also the config entries for :searches puts 'Preparing searches ...' - configuration[:searches] = api - .search - .all - .each_with_object({}) { |search, searches| searches[search.name] = search.uuid } + configuration[:searches] = + api.search.all.each_with_object({}) { |search, searches| searches[search.name] = search.uuid } puts 'Preparing transfer templates ...' query = Sequencescape::Api::V2::TransferTemplate.select(:uuid, :name).paginate(per_page: 100) @@ -67,14 +65,14 @@ namespace :config do default_count: 2 } - configuration[:purposes] = {}.tap do |labware_purposes| - puts 'Preparing purpose configs...' - purpose_config.each { |purpose| labware_purposes[purpose.uuid] = purpose.config } - end + configuration[:purposes] = + {}.tap do |labware_purposes| + puts 'Preparing purpose configs...' + purpose_config.each { |purpose| labware_purposes[purpose.uuid] = purpose.config } + end - configuration[:purpose_uuids] = tracked_purposes.each_with_object({}) do |purpose, store| - store[purpose.name] = purpose.uuid - end + configuration[:purpose_uuids] = + tracked_purposes.each_with_object({}) { |purpose, store| store[purpose.name] = purpose.uuid } configuration[:robots] = ROBOT_CONFIG diff --git a/limber.sublime-project b/limber.sublime-project index 4f8e6d07c..ff819a7c3 100644 --- a/limber.sublime-project +++ b/limber.sublime-project @@ -22,12 +22,12 @@ "*.swf", "*.jar", "*.zip", - "*.xls", - ], + "*.xls" + ] }, { - "path": "coverage", - }, + "path": "coverage" + } ], // These settings will be applied to anyone working // on the project. They are intended to set up the accepted @@ -35,6 +35,6 @@ "settings": { "tab_size": 2, "translate_tabs_to_spaces": true, - "trim_trailing_white_space_on_save": true, - }, + "trim_trailing_white_space_on_save": true + } } diff --git a/public/404.html b/public/404.html index 68d177fa2..c5194504f 100644 --- a/public/404.html +++ b/public/404.html @@ -1,4 +1,4 @@ - + The page you were looking for doesn't exist (404) diff --git a/public/422.html b/public/422.html index 9e9cf0df2..d16dd7f62 100644 --- a/public/422.html +++ b/public/422.html @@ -1,4 +1,4 @@ - + The change you wanted was rejected (422) diff --git a/public/500.html b/public/500.html index 0fc2fcef7..5a03944b5 100644 --- a/public/500.html +++ b/public/500.html @@ -1,4 +1,4 @@ - + We're sorry, but something went wrong (500) diff --git a/public/502.html b/public/502.html index 6f09738ed..b5082d265 100644 --- a/public/502.html +++ b/public/502.html @@ -1,4 +1,4 @@ - + We're sorry, but something went wrong (502) diff --git a/public/504.html b/public/504.html index c8927e613..95e94d118 100644 --- a/public/504.html +++ b/public/504.html @@ -1,4 +1,4 @@ - + We're sorry, but something took too long (504) diff --git a/spec/controllers/exports_controller_spec.rb b/spec/controllers/exports_controller_spec.rb index bd2013c92..2492d5a68 100644 --- a/spec/controllers/exports_controller_spec.rb +++ b/spec/controllers/exports_controller_spec.rb @@ -63,10 +63,9 @@ context 'on generating a csv' do before do - expect(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( - includes, - barcode: plate_barcode - ).and_return(plate) + expect(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) + .with(includes, barcode: plate_barcode) + .and_return(plate) end context 'where csv id requested is concentrations_ngul.csv' do @@ -319,10 +318,9 @@ before do # Make the controller to receive the plate. # NB. Uses plate_includes if specified in the export configuration. - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( - export.plate_includes, - barcode: plate_barcode - ).and_return(plate) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) + .with(export.plate_includes, barcode: plate_barcode) + .and_return(plate) # Make the controller to use the export loaded from fixture config. allow(subject).to receive(:export).and_return(export) @@ -336,17 +334,16 @@ asset_ancestors = ancestor_plates.map { |ancestor_plate| double('Sequencescape::Api::V2::Asset', id: ancestor_plate.id) } - allow(plate).to receive_message_chain(:ancestors, :where).with(purpose_name: export.ancestor_purpose).and_return( - asset_ancestors - ) + allow(plate).to receive_message_chain(:ancestors, :where) + .with(purpose_name: export.ancestor_purpose) + .and_return(asset_ancestors) # Stub the plate_with_custom_includes query to return the first ancestor plate. # NB. This stub is required to make the other methods in the show controller # action not to fail when they try to receive the first ancestor plate. - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( - export.plate_includes, - id: asset_ancestors.first.id - ).and_return(ancestor_plates.first) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) + .with(export.plate_includes, id: asset_ancestors.first.id) + .and_return(ancestor_plates.first) # Stub the plate query to return ancestor plates. builder = double('JsonApiClient::Query::Builder') diff --git a/spec/controllers/plates_controller_spec.rb b/spec/controllers/plates_controller_spec.rb index 27a3e5c02..c109524ee 100644 --- a/spec/controllers/plates_controller_spec.rb +++ b/spec/controllers/plates_controller_spec.rb @@ -83,7 +83,19 @@ def expect_state_change_create(attributes) reason: 'Individual Well Failure' ) - post :fail_wells, params: { id: plate_uuid, plate: { wells: { 'A1' => 1, 'B1' => 0 } } }, session: { user_uuid: } + post :fail_wells, + params: { + id: plate_uuid, + plate: { + wells: { + 'A1' => 1, + 'B1' => 0 + } + } + }, + session: { + user_uuid: + } expect(response).to redirect_to(limber_plate_path(plate_uuid)) end diff --git a/spec/controllers/qc_files_controller_spec.rb b/spec/controllers/qc_files_controller_spec.rb index 08a27646c..d2a97f533 100644 --- a/spec/controllers/qc_files_controller_spec.rb +++ b/spec/controllers/qc_files_controller_spec.rb @@ -12,12 +12,14 @@ before do stub_api_get(file_uuid, body: json(:qc_file, uuid: file_uuid, filename:)) - stub_request(:get, api_url_for(file_uuid)).with(headers: { 'Accept' => 'sequencescape/qc_file' }).to_return( - body: 'example file content', - headers: { - 'Content-Disposition' => "attachment; filename=\"#{filename}\"" - } - ) + stub_request(:get, api_url_for(file_uuid)) + .with(headers: { 'Accept' => 'sequencescape/qc_file' }) + .to_return( + body: 'example file content', + headers: { + 'Content-Disposition' => "attachment; filename=\"#{filename}\"" + } + ) end it 'returns a file' do @@ -37,19 +39,21 @@ let(:plate_uuid) { 'plate-uuid' } let(:stub_post) do - stub_request(:post, api_url_for(plate_uuid, 'qc_files')).with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="test_file.txt"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'test_file.txt'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(plate_uuid, 'qc_files')) + .with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="test_file.txt"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'test_file.txt'), + headers: { + 'content-type' => 'application/json' + } + ) end before do diff --git a/spec/controllers/tube_creation_controller_spec.rb b/spec/controllers/tube_creation_controller_spec.rb index 049073624..7e486018b 100644 --- a/spec/controllers/tube_creation_controller_spec.rb +++ b/spec/controllers/tube_creation_controller_spec.rb @@ -23,7 +23,14 @@ describe '#new' do it 'creates a tube from a tube parent' do - get :new, params: { limber_tube_id: parent_uuid, purpose_uuid: child_purpose_uuid }, session: { user_uuid: } + get :new, + params: { + limber_tube_id: parent_uuid, + purpose_uuid: child_purpose_uuid + }, + session: { + user_uuid: + } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) expect(assigns(:labware_creator).user_uuid).to eq(user_uuid) @@ -31,7 +38,14 @@ end it 'creates a tube from a plate parent' do - get :new, params: { limber_plate_id: parent_uuid, purpose_uuid: child_purpose_uuid }, session: { user_uuid: } + get :new, + params: { + limber_plate_id: parent_uuid, + purpose_uuid: child_purpose_uuid + }, + session: { + user_uuid: + } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) expect(assigns(:labware_creator).user_uuid).to eq(user_uuid) diff --git a/spec/controllers/tubes/tubes_exports_controller_spec.rb b/spec/controllers/tubes/tubes_exports_controller_spec.rb index e32037013..365f41e70 100644 --- a/spec/controllers/tubes/tubes_exports_controller_spec.rb +++ b/spec/controllers/tubes/tubes_exports_controller_spec.rb @@ -29,11 +29,9 @@ context 'on generating a csv' do before do - expect(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( - includes, - selects, - barcode: tube_barcode - ).and_return(tube) + expect(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) + .with(includes, selects, barcode: tube_barcode) + .and_return(tube) end context 'where tsv id requested is bioscan_mbrave.tsv' do diff --git a/spec/factories/plate_factories.rb b/spec/factories/plate_factories.rb index b4cd3cc6c..ce72cbfe1 100644 --- a/spec/factories/plate_factories.rb +++ b/spec/factories/plate_factories.rb @@ -355,20 +355,21 @@ pooled_wells = wells.reject { |w| empty_wells.include?(w) } pool_hash = {} pool_sizes.each_with_index do |pool_size, index| - pool_hash["pool-#{index + 1}-uuid"] = { - 'wells' => pooled_wells.shift(pool_size).sort_by { |well| WellHelpers.row_order(size).index(well) }, - 'insert_size' => { - from: 100, - to: 300 - }, - 'library_type' => { - name: library_type - }, - 'request_type' => request_type, - 'pcr_cycles' => pool_prc_cycles[index], - 'for_multiplexing' => pool_for_multiplexing[index], - 'pool_complete' => pool_complete - }.merge(extra_pool_info) + pool_hash["pool-#{index + 1}-uuid"] = + { + 'wells' => pooled_wells.shift(pool_size).sort_by { |well| WellHelpers.row_order(size).index(well) }, + 'insert_size' => { + from: 100, + to: 300 + }, + 'library_type' => { + name: library_type + }, + 'request_type' => request_type, + 'pcr_cycles' => pool_prc_cycles[index], + 'for_multiplexing' => pool_for_multiplexing[index], + 'pool_complete' => pool_complete + }.merge(extra_pool_info) end pool_hash end diff --git a/spec/factories/poly_metadata_factories.rb b/spec/factories/poly_metadata_factories.rb index f92dd7ab4..754d5bc01 100644 --- a/spec/factories/poly_metadata_factories.rb +++ b/spec/factories/poly_metadata_factories.rb @@ -12,8 +12,7 @@ after(:build) do |poly_metadatum, evaluator| poly_metadatum.relationships.metadatable = { - 'links' => { - }, + 'links' => {}, 'data' => { 'type' => 'Request', 'id' => evaluator.metadatable.id diff --git a/spec/factories/purpose_config_factories.rb b/spec/factories/purpose_config_factories.rb index 35f9e2147..943eafab3 100644 --- a/spec/factories/purpose_config_factories.rb +++ b/spec/factories/purpose_config_factories.rb @@ -238,13 +238,11 @@ { 'Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => { - } + 'request_options' => {} }, 'Another Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => { - } + 'request_options' => {} } } end @@ -269,7 +267,14 @@ # Configuration to set number_of_source_wells argument factory :pooled_wells_by_sample_in_groups_purpose_config do transient { number_of_source_wells { 2 } } - creator_class { { name: 'LabwareCreators::PooledWellsBySampleInGroups', args: { number_of_source_wells: } } } + creator_class do + { + name: 'LabwareCreators::PooledWellsBySampleInGroups', + args: { + number_of_source_wells: + } + } + end end factory :multi_stamp_tubes_using_tube_rack_scan_purpose_config do diff --git a/spec/factories/strategies/api_strategy.rb b/spec/factories/strategies/api_strategy.rb index 79432b1d6..588c984fb 100644 --- a/spec/factories/strategies/api_strategy.rb +++ b/spec/factories/strategies/api_strategy.rb @@ -11,8 +11,7 @@ def initialize delegate :association, to: :@strategy - def result(evaluation) - end + def result(evaluation); end end FactoryBot.register_strategy(:api_object, ApiStrategy) diff --git a/spec/factories/tube_factories.rb b/spec/factories/tube_factories.rb index 78909e056..ec5589e4b 100644 --- a/spec/factories/tube_factories.rb +++ b/spec/factories/tube_factories.rb @@ -112,7 +112,9 @@ request_factory { :library_request } aliquot_count { 2 } aliquot_factory { :v2_tagged_aliquot } - aliquots { create_list aliquot_factory, aliquot_count, library_state:, outer_request: } + aliquots do + create_list aliquot_factory, aliquot_count, library_state:, outer_request: + end parents { [] } purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } @@ -178,7 +180,9 @@ tube_factory { :multiplexed_library_tube } study_count { 1 } end - children { Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } } + children do + Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } + end end factory :tube_collection_with_barcodes_specified do diff --git a/spec/factories/tube_rack_factories.rb b/spec/factories/tube_rack_factories.rb index cabb37717..ef18b454b 100644 --- a/spec/factories/tube_rack_factories.rb +++ b/spec/factories/tube_rack_factories.rb @@ -20,7 +20,9 @@ purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } tubes { {} } - racked_tubes { tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } } + racked_tubes do + tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } + end end id diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 2d4e50aed..8066a81ae 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -196,7 +196,13 @@ associated(:empty_well, location:, uuid: "example-well-uuid-#{i}") else state = custom_state[location] || default_state - associated(:well, location:, uuid: "example-well-uuid-#{i}", state:, aliquot_factory:) + associated( + :well, + location:, + uuid: "example-well-uuid-#{i}", + state:, + aliquot_factory: + ) end end end diff --git a/spec/features/charge_and_pass_libraries_spec.rb b/spec/features/charge_and_pass_libraries_spec.rb index 1ad692cf3..997902ce5 100644 --- a/spec/features/charge_and_pass_libraries_spec.rb +++ b/spec/features/charge_and_pass_libraries_spec.rb @@ -10,7 +10,9 @@ let(:user_swipecard) { 'abcdef' } let(:labware_barcode) { SBCF::SangerBarcode.new(prefix: 'DN', number: 1).machine_barcode.to_s } let(:labware_uuid) { SecureRandom.uuid } - let(:work_completion_request) { { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } } + let(:work_completion_request) do + { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } + end let(:work_completion) { json :work_completion } let(:template_uuid) { SecureRandom.uuid } @@ -50,7 +52,14 @@ end context 'tube with submissions to be made' do - before { create :passable_tube, submission: { request_options:, template_uuid: }, uuid: 'example-purpose-uuid' } + before do + create :passable_tube, + submission: { + request_options:, + template_uuid: + }, + uuid: 'example-purpose-uuid' + end let(:submissions) { [] } let(:request_options) { { read_length: '150' } } let(:labware_barcode) { example_tube_v2.labware_barcode.machine } diff --git a/spec/features/creating_a_plate_spec.rb b/spec/features/creating_a_plate_spec.rb index a3eeec60f..6e9bf6084 100644 --- a/spec/features/creating_a_plate_spec.rb +++ b/spec/features/creating_a_plate_spec.rb @@ -33,7 +33,11 @@ end let(:another_plate) do - create :v2_stock_plate, barcode_number: 106, uuid: another_plate_uuid, wells:, purpose_name: 'Limber Cherrypicked' + create :v2_stock_plate, + barcode_number: 106, + uuid: another_plate_uuid, + wells:, + purpose_name: 'Limber Cherrypicked' end let(:alternative_plate) do @@ -121,9 +125,9 @@ allow(child_plate).to receive(:stock_plates).and_return(stock_plates) allow(child_plate).to receive(:stock_plate).and_return(stock_plates.last) allow(child_plate).to receive(:ancestors).and_return(ancestors_scope) - allow(ancestors_scope).to receive(:where).with(purpose_name: alternative_purpose_name).and_return( - [alternative_plate] - ) + allow(ancestors_scope).to receive(:where) + .with(purpose_name: alternative_purpose_name) + .and_return([alternative_plate]) allow(job).to receive(:save).and_return(true) allow(PMB::PrintJob).to receive(:new) do |args| diff --git a/spec/features/creating_a_tag_plate_spec.rb b/spec/features/creating_a_tag_plate_spec.rb index 79aa1b37d..2ca63e57e 100644 --- a/spec/features/creating_a_tag_plate_spec.rb +++ b/spec/features/creating_a_tag_plate_spec.rb @@ -49,12 +49,10 @@ background do # Set-up the plate config create :purpose_config, uuid: 'stock-plate-purpose-uuid', name: 'Limber Cherrypicked' - create( - :tagged_purpose_config, - tag_layout_templates: acceptable_templates, - uuid: child_purpose_uuid, - enforce_same_template_within_pool: - ) + create(:tagged_purpose_config, + tag_layout_templates: acceptable_templates, + uuid: child_purpose_uuid, + enforce_same_template_within_pool:) create :pipeline, relationships: { 'Limber Cherrypicked' => 'Tag Purpose' } # We look up the user diff --git a/spec/features/failing_quadrants_spec.rb b/spec/features/failing_quadrants_spec.rb index dbd1fe632..d063e42e2 100644 --- a/spec/features/failing_quadrants_spec.rb +++ b/spec/features/failing_quadrants_spec.rb @@ -20,7 +20,12 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells:, size: 384 + create :v2_plate, + uuid: plate_uuid, + purpose_uuid: 'stock-plate-purpose-uuid', + state: 'passed', + wells:, + size: 384 end let(:state_change_attributes) do diff --git a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb index f697ec3b6..04cb0e4cb 100644 --- a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb @@ -135,7 +135,12 @@ expect_api_v2_posts( 'Transfer', [plate_uuid, plate_uuid_2].map do |source_uuid| - { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } + { + user_uuid:, + source_uuid:, + destination_uuid: 'tube-0', + transfer_template_uuid: 'whole-plate-to-tube' + } end ) diff --git a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb index 40a593e30..ce4e25992 100644 --- a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb @@ -145,21 +145,22 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( - include_used: false, - purpose_name: ['example-purpose'], - includes: 'purpose', - paginate: { - size: 30, - number: 1 - } - ).and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all) + .with( + include_used: false, + purpose_name: ['example-purpose'], + includes: 'purpose', + paginate: { + size: 30, + number: 1 + } + ) + .and_return([example_v2_tube, example_v2_tube2]) # Parent lookup - allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( - barcode: [tube_barcode_1, tube_barcode_2], - includes: [] - ).and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all) + .with(barcode: [tube_barcode_1, tube_barcode_2], includes: []) + .and_return([example_v2_tube, example_v2_tube2]) # Allow parent plates to be found in API v2 stub_v2_plate(parent_1, stub_search: false) @@ -185,21 +186,22 @@ stub_v2_tube(example_v2_tube2) # Available tubes search - allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( - include_used: false, - purpose_name: ['example-purpose'], - includes: 'purpose', - paginate: { - size: 30, - number: 1 - } - ).and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all) + .with( + include_used: false, + purpose_name: ['example-purpose'], + includes: 'purpose', + paginate: { + size: 30, + number: 1 + } + ) + .and_return([example_v2_tube, example_v2_tube2]) # Parent lookup - allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( - barcode: [tube_barcode_1, tube_barcode_2], - includes: [] - ).and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all) + .with(barcode: [tube_barcode_1, tube_barcode_2], includes: []) + .and_return([example_v2_tube, example_v2_tube2]) # Old API still used when loading parent stub_api_get(tube_uuid, body: example_tube) diff --git a/spec/features/viewing_a_plate_spec.rb b/spec/features/viewing_a_plate_spec.rb index db1a0ccf9..222acfb29 100644 --- a/spec/features/viewing_a_plate_spec.rb +++ b/spec/features/viewing_a_plate_spec.rb @@ -12,7 +12,12 @@ let(:state) { 'pending' } let(:purpose_uuid) { 'stock-plate-purpose-uuid' } let(:example_plate) do - create :v2_stock_plate, uuid: plate_uuid, barcode_number: 1, state:, wells: wells_collection, purpose_uuid: + create :v2_stock_plate, + uuid: plate_uuid, + barcode_number: 1, + state:, + wells: wells_collection, + purpose_uuid: end let(:wells_collection) { %w[A1 B1].map { |loc| create(:v2_well, state:, position: { 'name' => loc }) } } let(:printer_list) { create_list(:v2_tube_barcode_printer, 2) + create_list(:v2_plate_barcode_printer, 2) } diff --git a/spec/helpers/barcode_labels_helper_spec.rb b/spec/helpers/barcode_labels_helper_spec.rb index be355d26e..4fabe3f3d 100644 --- a/spec/helpers/barcode_labels_helper_spec.rb +++ b/spec/helpers/barcode_labels_helper_spec.rb @@ -22,12 +22,20 @@ end it 'renders a partial' do - barcode_printing_form(labels:, redirection_url:, default_printer_name:) + barcode_printing_form( + labels:, + redirection_url:, + default_printer_name: + ) expect(rendered).to be_truthy end it 'has the right locals set' do - barcode_printing_form(labels:, redirection_url:, default_printer_name:) + barcode_printing_form( + labels:, + redirection_url:, + default_printer_name: + ) printer_types = labels.map(&:printer_type) printers = @printers.select { |printer| printer_types.include?(printer.barcode_type) } diff --git a/spec/helpers/plate_helpers_spec.rb b/spec/helpers/plate_helpers_spec.rb index d39590660..df6be63cc 100644 --- a/spec/helpers/plate_helpers_spec.rb +++ b/spec/helpers/plate_helpers_spec.rb @@ -66,7 +66,9 @@ ] end - let(:plate_for_precap) { build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: } + let(:plate_for_precap) do + build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: + end let(:expected_result) do [ diff --git a/spec/models/labware_creators/concentration_binned_plate_spec.rb b/spec/models/labware_creators/concentration_binned_plate_spec.rb index 0528e6604..faba3bdef 100644 --- a/spec/models/labware_creators/concentration_binned_plate_spec.rb +++ b/spec/models/labware_creators/concentration_binned_plate_spec.rb @@ -85,12 +85,10 @@ let(:user_uuid) { 'user-uuid' } before do - create( - :concentration_binning_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name: - ) + create(:concentration_binning_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/concentration_normalised_plate_spec.rb b/spec/models/labware_creators/concentration_normalised_plate_spec.rb index 8ae7238fe..dfb7dcd44 100644 --- a/spec/models/labware_creators/concentration_normalised_plate_spec.rb +++ b/spec/models/labware_creators/concentration_normalised_plate_spec.rb @@ -115,9 +115,9 @@ it 'makes the expected requests' do # NB. qc assay post is done using v2 Api, whereas plate creation and transfers posts are using v1 Api - expect(Sequencescape::Api::V2::QcAssay).to receive(:create).with( - qc_results: dest_well_qc_attributes - ).and_return(true) + expect(Sequencescape::Api::V2::QcAssay).to receive(:create) + .with(qc_results: dest_well_qc_attributes) + .and_return(true) expect(subject.save!).to eq true expect(plate_creation_request).to have_been_made expect(transfer_creation_request).to have_been_made diff --git a/spec/models/labware_creators/custom_pooled_tubes_spec.rb b/spec/models/labware_creators/custom_pooled_tubes_spec.rb index 2f6b027f9..5545c6188 100644 --- a/spec/models/labware_creators/custom_pooled_tubes_spec.rb +++ b/spec/models/labware_creators/custom_pooled_tubes_spec.rb @@ -56,19 +56,21 @@ let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, file: } } let(:stub_qc_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="robot_pooling_file.csv"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'pooling_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')) + .with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="robot_pooling_file.csv"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'pooling_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:tube_creation_request_uuid) { SecureRandom.uuid } diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index db926109c..4db2cfda0 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -132,7 +132,14 @@ def expect_transfer_creation def expect_state_change_creation expect_api_v2_posts( 'StateChange', - [{ reason: 'Used in Library creation', target_uuid: tag_plate_uuid, target_state: 'exhausted', user_uuid: }] + [ + { + reason: 'Used in Library creation', + target_uuid: tag_plate_uuid, + target_state: 'exhausted', + user_uuid: + } + ] ) end @@ -156,8 +163,7 @@ def expect_state_change_creation direction: 'column', walking_by: 'manual by plate', initial_tag: '1', - substitutions: { - }, + substitutions: {}, tags_per_well: 1 } } diff --git a/spec/models/labware_creators/donor_pooling_spec.rb b/spec/models/labware_creators/donor_pooling_spec.rb index e44afaf62..f1cea5e51 100644 --- a/spec/models/labware_creators/donor_pooling_spec.rb +++ b/spec/models/labware_creators/donor_pooling_spec.rb @@ -67,13 +67,16 @@ create(:donor_pooling_config) # Create the plate purpose config and add to Settings. - create(:donor_pooling_plate_purpose_config, uuid: child_purpose_uuid, default_number_of_pools:) + create( + :donor_pooling_plate_purpose_config, + uuid: child_purpose_uuid, + default_number_of_pools: + ) # Allow the API call to return two plates by default. - allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( - { barcode: barcodes }, - includes: described_class::SOURCE_PLATE_INCLUDES - ).and_return(source_plates) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all) + .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) + .and_return(source_plates) end describe '.attributes' do @@ -587,10 +590,9 @@ describe '#source_barcodes_must_be_different' do before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( - { barcode: barcodes }, - includes: described_class::SOURCE_PLATE_INCLUDES - ).and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all) + .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) + .and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] * 2 } it 'reports the error' do @@ -609,10 +611,9 @@ [well] end before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( - { barcode: barcodes }, - includes: described_class::SOURCE_PLATE_INCLUDES - ).and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all) + .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) + .and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] } it 'allows plate creation' do @@ -625,10 +626,9 @@ describe '#source_plates_must_exist' do let(:barcodes) { [parent_1_plate.human_barcode, 'NOT-A-PLATE-BARCODE'] } before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( - { barcode: barcodes }, - includes: described_class::SOURCE_PLATE_INCLUDES - ).and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all) + .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) + .and_return([parent_1_plate]) end it 'reports the error' do expect(subject).not_to be_valid diff --git a/spec/models/labware_creators/final_tube_from_plate_spec.rb b/spec/models/labware_creators/final_tube_from_plate_spec.rb index bee607d05..bea569281 100644 --- a/spec/models/labware_creators/final_tube_from_plate_spec.rb +++ b/spec/models/labware_creators/final_tube_from_plate_spec.rb @@ -35,7 +35,13 @@ it 'pools by submission' do expect_api_v2_posts( 'Transfer', - [{ user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' }], + [ + { + user_uuid:, + source_uuid: parent_uuid, + transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' + } + ], [transfer] ) diff --git a/spec/models/labware_creators/fixed_normalised_plate_spec.rb b/spec/models/labware_creators/fixed_normalised_plate_spec.rb index c0cdfd840..521c84180 100644 --- a/spec/models/labware_creators/fixed_normalised_plate_spec.rb +++ b/spec/models/labware_creators/fixed_normalised_plate_spec.rb @@ -85,7 +85,10 @@ let(:user_uuid) { 'user-uuid' } before do - create(:fixed_normalisation_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) + create(:fixed_normalisation_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( diff --git a/spec/models/labware_creators/merged_plate_spec.rb b/spec/models/labware_creators/merged_plate_spec.rb index eaedb49fa..f80d4481c 100644 --- a/spec/models/labware_creators/merged_plate_spec.rb +++ b/spec/models/labware_creators/merged_plate_spec.rb @@ -81,10 +81,12 @@ describe '#save!' do before do allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all).with( - { barcode: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] }, - includes: plate_includes - ).and_return([source_plate_1, source_plate_2]) + receive(:find_all) + .with( + { barcode: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] }, + includes: plate_includes + ) + .and_return([source_plate_1, source_plate_2]) ) end @@ -207,10 +209,9 @@ ) stub_v2_plate(source_plate_3, stub_search: false) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all).with( - { barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, - includes: plate_includes - ).and_return([source_plate_1, source_plate_3]) + receive(:find_all) + .with({ barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, includes: plate_includes) + .and_return([source_plate_1, source_plate_3]) ) end @@ -250,10 +251,9 @@ ) stub_v2_plate(source_plate_3, stub_search: false) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all).with( - { barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, - includes: plate_includes - ).and_return([source_plate_1, source_plate_3]) + receive(:find_all) + .with({ barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, includes: plate_includes) + .and_return([source_plate_1, source_plate_3]) ) end @@ -262,7 +262,12 @@ context 'with a missing barcode' do let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, barcodes: [source_plate_1.barcode.machine, ''] } + { + purpose_uuid: child_purpose_uuid, + parent_uuid:, + user_uuid:, + barcodes: [source_plate_1.barcode.machine, ''] + } end before do @@ -274,9 +279,9 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all).with({ barcode: [source_plate_1.barcode.machine] }, includes: plate_includes).and_return( - [source_plate_1] - ) + receive(:find_all) + .with({ barcode: [source_plate_1.barcode.machine] }, includes: plate_includes) + .and_return([source_plate_1]) ) end @@ -304,10 +309,9 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all).with( - { barcode: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] }, - includes: plate_includes - ).and_return([source_plate_1]) + receive(:find_all) + .with({ barcode: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] }, includes: plate_includes) + .and_return([source_plate_1]) ) end @@ -345,10 +349,9 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all).with( - { barcode: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] }, - includes: plate_includes - ).and_return([source_plate_1, source_plate_4]) + receive(:find_all) + .with({ barcode: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] }, includes: plate_includes) + .and_return([source_plate_1, source_plate_4]) ) end diff --git a/spec/models/labware_creators/multi_stamp_tubes_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_spec.rb index aefd4d001..a32ee3206 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_spec.rb @@ -207,9 +207,9 @@ body: json(:v1_custom_metadatum_collection) ) - expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells).with(child_uuid).and_return( - child_plate_v2 - ) + expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells) + .with(child_uuid) + .and_return(child_plate_v2) expect(subject).to receive(:source_tube_outer_request_uuid).with(parent1).and_return('outer-request-1') expect(subject).to receive(:source_tube_outer_request_uuid).with(parent2).and_return('outer-request-2') end diff --git a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb index 1984cbd17..00e0975b1 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb @@ -132,19 +132,21 @@ end let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')).with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="tube_rack_scan.csv"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')) + .with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="tube_rack_scan.csv"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:child_plate_v1) do @@ -153,14 +155,12 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( - barcode: 'AB10000001', - includes: tube_includes - ).and_return(parent_tube_1) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( - barcode: 'AB10000002', - includes: tube_includes - ).and_return(parent_tube_2) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by) + .with(barcode: 'AB10000001', includes: tube_includes) + .and_return(parent_tube_1) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by) + .with(barcode: 'AB10000002', includes: tube_includes) + .and_return(parent_tube_2) stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) @@ -284,10 +284,9 @@ subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( - barcode: 'AB10000003', - includes: tube_includes - ).and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by) + .with(barcode: 'AB10000003', includes: tube_includes) + .and_return(nil) subject.validate end diff --git a/spec/models/labware_creators/normalised_binned_plate_spec.rb b/spec/models/labware_creators/normalised_binned_plate_spec.rb index bd3ce6b87..158dcee46 100644 --- a/spec/models/labware_creators/normalised_binned_plate_spec.rb +++ b/spec/models/labware_creators/normalised_binned_plate_spec.rb @@ -85,7 +85,10 @@ let(:user_uuid) { 'user-uuid' } before do - create(:normalised_binning_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) + create(:normalised_binning_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb index 6ffabb72e..b702bcba3 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb @@ -272,22 +272,26 @@ content end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } + let(:form_attributes) do + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } + end let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="duplex_seq_customer_file.csv"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'duplex_seq_dil_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')) + .with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="duplex_seq_customer_file.csv"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'duplex_seq_dil_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:stub_parent_request) { stub_api_get(parent_uuid, body: parent_plate_v1) } @@ -295,12 +299,10 @@ before do stub_parent_request - create( - :duplex_seq_customer_csv_file_upload_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name: - ) + create(:duplex_seq_customer_csv_file_upload_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name:) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb index 610bd8195..15cfa9180 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb @@ -308,22 +308,26 @@ content end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } + let(:form_attributes) do + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } + end let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="targeted_nano_seq_customer_file.csv"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'targeted_nano_seq_dil_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')) + .with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="targeted_nano_seq_customer_file.csv"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'targeted_nano_seq_dil_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:stub_parent_request) { stub_api_get(parent_uuid, body: parent_plate_v1) } diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index cedabd678..6dfe9e4d5 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -112,7 +112,9 @@ let(:parent_v1) { json :plate_with_metadata, uuid: parent_uuid, barcode_number: 6, qc_files_actions: %w[read create] } # form attributes - required parameters for the labware creator - let(:form_attributes) { { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } } + let(:form_attributes) do + { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } + end # child tubes for lookup after creation let(:child_tube_1_uuid) { SecureRandom.uuid } @@ -265,7 +267,12 @@ context 'when require_sequencing_tubes_only? is true' do let(:form_attributes) do - { user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, parent_uuid:, sequencing_file: } + { + user_uuid:, + purpose_uuid: child_contingency_tube_purpose_uuid, + parent_uuid:, + sequencing_file: + } end before do @@ -604,9 +611,9 @@ context 'when the tube barcode already exists in the LIMS' do before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: foreign_barcode).and_return( - existing_tube - ) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by) + .with(barcode: foreign_barcode) + .and_return(existing_tube) end it 'adds an error to the errors collection' do @@ -713,19 +720,21 @@ # stub the contingency file upload let!(:stub_contingency_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( - body: contingency_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_contingency_tube_rack_scan.csv"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_contingency_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')) + .with( + body: contingency_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_contingency_tube_rack_scan.csv"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_contingency_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # body for stubbing the sequencing file upload @@ -737,19 +746,21 @@ # stub the sequencing file upload let!(:stub_sequencing_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( - body: sequencing_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')) + .with( + body: sequencing_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # stub the sequencing tube creation @@ -1003,7 +1014,12 @@ context 'with just a sequencing file' do let(:form_attributes) do - { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid:, sequencing_file: } + { + user_uuid:, + purpose_uuid: child_sequencing_tube_purpose_uuid, + parent_uuid:, + sequencing_file: + } end # body for stubbing the sequencing file upload @@ -1015,19 +1031,21 @@ # stub the sequencing file upload let!(:stub_sequencing_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( - body: sequencing_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' - } - ).to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')) + .with( + body: sequencing_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' + } + ) + .to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # stub the sequencing tube creation diff --git a/spec/models/labware_creators/plate_with_template_spec.rb b/spec/models/labware_creators/plate_with_template_spec.rb index 69605de82..4cf1c9595 100644 --- a/spec/models/labware_creators/plate_with_template_spec.rb +++ b/spec/models/labware_creators/plate_with_template_spec.rb @@ -60,7 +60,14 @@ it 'makes the expected requests' do expect_api_v2_posts( 'Transfer', - [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: 'child-uuid', transfer_template_uuid: }] + [ + { + user_uuid:, + source_uuid: parent_uuid, + destination_uuid: 'child-uuid', + transfer_template_uuid: + } + ] ) expect(subject.save!).to eq true diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb index bb2ee40a4..ac223c108 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb @@ -49,7 +49,9 @@ describe '#save!' do has_a_working_api - let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } } + let(:form_attributes) do + { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } + end let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -88,7 +90,12 @@ expect_api_v2_posts( 'Transfer', [parent_uuid, parent2_uuid, parent3_uuid, parent4_uuid].map do |source_uuid| - { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } + { + user_uuid:, + source_uuid:, + destination_uuid: 'tube-0', + transfer_template_uuid: 'whole-plate-to-tube' + } end ) diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb index ee8183163..67117c8f1 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb @@ -32,7 +32,14 @@ end before do - create :purpose_config, submission: { template_uuid:, request_options: { read_length: 150 } }, uuid: purpose_uuid + create :purpose_config, + submission: { + template_uuid:, + request_options: { + read_length: 150 + } + }, + uuid: purpose_uuid end describe '#new' do @@ -45,7 +52,9 @@ describe '#save!' do has_a_working_api - let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } } + let(:form_attributes) do + { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } + end let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -90,9 +99,9 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with(barcode: barcodes, includes: []).and_return( - [parent, parent2] - ) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all) + .with(barcode: barcodes, includes: []) + .and_return([parent, parent2]) tube_creation_request tube_creation_children_request diff --git a/spec/models/labware_creators/quadrant_split_plate_spec.rb b/spec/models/labware_creators/quadrant_split_plate_spec.rb index c96a1026e..3db6aa215 100644 --- a/spec/models/labware_creators/quadrant_split_plate_spec.rb +++ b/spec/models/labware_creators/quadrant_split_plate_spec.rb @@ -130,10 +130,9 @@ before do create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid) - allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( - { uuid: %w[child-a-uuid child-b-uuid child-c-uuid child-d-uuid] }, - includes: ['wells'] - ).and_return([child_plate_a, child_plate_b, child_plate_c, child_plate_d]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all) + .with({ uuid: %w[child-a-uuid child-b-uuid child-c-uuid child-d-uuid] }, includes: ['wells']) + .and_return([child_plate_a, child_plate_b, child_plate_c, child_plate_d]) stub_v2_plate(plate, stub_search: false) end diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index 4ed83099e..34a41d541 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -310,10 +310,9 @@ stub_api_get('asset-uuid', body: child_plate_v1) metadata = - attributes_for(:v1_custom_metadatum_collection).fetch(:metadata, {}).merge( - stock_barcode_q0: stock_plate1.barcode.human, - stock_barcode_q1: stock_plate2.barcode.human - ) + attributes_for(:v1_custom_metadatum_collection) + .fetch(:metadata, {}) + .merge(stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human) stub_api_put( 'custom_metadatum_collection-uuid', diff --git a/spec/models/labware_creators/shared_examples.rb b/spec/models/labware_creators/shared_examples.rb index 6de6977a3..26d4e814b 100644 --- a/spec/models/labware_creators/shared_examples.rb +++ b/spec/models/labware_creators/shared_examples.rb @@ -266,9 +266,9 @@ it 'makes the expected requests' do # NB. qc assay post is done using v2 Api, whereas plate creation and transfers posts are using v1 Api - expect(Sequencescape::Api::V2::QcAssay).to receive(:create).with(qc_results: dest_well_qc_attributes).and_return( - true - ) + expect(Sequencescape::Api::V2::QcAssay).to receive(:create) + .with(qc_results: dest_well_qc_attributes) + .and_return(true) expect(subject.save!).to eq true expect(plate_creation_request).to have_been_made expect(transfer_creation_request).to have_been_made diff --git a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb index d2cdf7206..4e60fcc14 100644 --- a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb +++ b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb @@ -43,11 +43,9 @@ allow(Sequencescape::Api::V2::Plate).to receive(:find_by).with(uuid: parent_uuid).and_return(parent) - allow(api).to receive_message_chain(:plate_creation, :create!).with( - parent: parent_uuid, - child_purpose: child_purpose_uuid, - user: user_uuid - ).and_return(double(child: child_plate)) + allow(api).to receive_message_chain(:plate_creation, :create!) + .with(parent: parent_uuid, child_purpose: child_purpose_uuid, user: user_uuid) + .and_return(double(child: child_plate)) allow(Sequencescape::Api::V2::Plate).to receive(:find_by).with(uuid: child_uuid).and_return(child_plate) end diff --git a/spec/models/labware_creators/stamped_plate_spec.rb b/spec/models/labware_creators/stamped_plate_spec.rb index 22b16157e..29e0fd586 100644 --- a/spec/models/labware_creators/stamped_plate_spec.rb +++ b/spec/models/labware_creators/stamped_plate_spec.rb @@ -188,7 +188,14 @@ context 'when a library type is supplied' do let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: [lib_type_a] } } + { + purpose_uuid: child_purpose_uuid, + parent_uuid:, + user_uuid:, + filters: { + library_type: [lib_type_a] + } + } end it_behaves_like 'a stamped plate creator' @@ -212,7 +219,14 @@ context 'when a library type is supplied that does not match any request' do let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: ['LibTypeB'] } } + { + purpose_uuid: child_purpose_uuid, + parent_uuid:, + user_uuid:, + filters: { + library_type: ['LibTypeB'] + } + } end it 'raises an exception' do diff --git a/spec/models/labware_creators/tagged_plate_spec.rb b/spec/models/labware_creators/tagged_plate_spec.rb index 58fdeb2c5..b45b52bd4 100644 --- a/spec/models/labware_creators/tagged_plate_spec.rb +++ b/spec/models/labware_creators/tagged_plate_spec.rb @@ -30,7 +30,10 @@ let(:disable_cross_plate_pool_detection) { false } before do - create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, disable_cross_plate_pool_detection:) + create(:purpose_config, + name: child_purpose_name, + uuid: child_purpose_uuid, + disable_cross_plate_pool_detection:) plate_request wells_request end @@ -220,7 +223,14 @@ expect_api_v2_posts( 'StateChange', - [{ reason: 'Used in Library creation', target_state: 'exhausted', target_uuid: tag_plate_uuid, user_uuid: }] + [ + { + reason: 'Used in Library creation', + target_state: 'exhausted', + target_uuid: tag_plate_uuid, + user_uuid: + } + ] ) expect(subject.save).to be true diff --git a/spec/models/labware_creators/tube_from_tube_spec.rb b/spec/models/labware_creators/tube_from_tube_spec.rb index 112f1b4c7..23279244a 100644 --- a/spec/models/labware_creators/tube_from_tube_spec.rb +++ b/spec/models/labware_creators/tube_from_tube_spec.rb @@ -60,7 +60,14 @@ it 'creates the child' do expect_api_v2_posts( 'Transfer', - [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: child_uuid, transfer_template_uuid: }] + [ + { + user_uuid:, + source_uuid: parent_uuid, + destination_uuid: child_uuid, + transfer_template_uuid: + } + ] ) subject.save! diff --git a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb index 136fc50e9..6e8a7dcd5 100644 --- a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb +++ b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb @@ -32,7 +32,9 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } + let(:labware_creator) do + LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) + end let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/labware_creators/well_filter_spec.rb b/spec/models/labware_creators/well_filter_spec.rb index 55d02afef..28c79369c 100644 --- a/spec/models/labware_creators/well_filter_spec.rb +++ b/spec/models/labware_creators/well_filter_spec.rb @@ -32,7 +32,9 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } + let(:labware_creator) do + LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) + end let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/labware_metadata_spec.rb b/spec/models/labware_metadata_spec.rb index bb82795cd..49ac36edf 100644 --- a/spec/models/labware_metadata_spec.rb +++ b/spec/models/labware_metadata_spec.rb @@ -43,7 +43,9 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) + expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) + .with(metadata:) + .and_return(true) LabwareMetadata.new(labware: plate_with_metadata, user_uuid: user.uuid).update!(updated_metadata) end @@ -61,11 +63,13 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) + expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) + .with(metadata:) + .and_return(true) - LabwareMetadata.new(barcode: plate_with_metadata.barcode.machine, user_uuid: user.uuid).update!( - updated_metadata - ) + LabwareMetadata + .new(barcode: plate_with_metadata.barcode.machine, user_uuid: user.uuid) + .update!(updated_metadata) end end end @@ -91,7 +95,9 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) + expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) + .with(metadata:) + .and_return(true) LabwareMetadata.new(labware: tube_with_metadata, user_uuid: user.uuid).update!(updated_metadata) end @@ -109,7 +115,9 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) + expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) + .with(metadata:) + .and_return(true) LabwareMetadata.new(barcode: tube_with_metadata.barcode.machine, user_uuid: user.uuid).update!(updated_metadata) end diff --git a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb index 99e9baaf9..ff74c8b99 100644 --- a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb @@ -65,7 +65,14 @@ end context 'when binning configuration is present' do - before { create(:concentration_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } + before do + create( + :concentration_binning_purpose_config, + uuid: labware.purpose.uuid, + warnings:, + label_class: + ) + end it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/final_tube_presenter_spec.rb b/spec/models/presenters/final_tube_presenter_spec.rb index b6d7b4347..5fba07000 100644 --- a/spec/models/presenters/final_tube_presenter_spec.rb +++ b/spec/models/presenters/final_tube_presenter_spec.rb @@ -5,7 +5,9 @@ require_relative 'shared_labware_presenter_examples' RSpec.describe Presenters::FinalTubePresenter do - let(:labware) { build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' } + let(:labware) do + build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' + end before { create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') } diff --git a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb index 44c5d52b9..fb4860cac 100644 --- a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb @@ -66,7 +66,14 @@ end context 'when binning configuration is present' do - before { create(:normalised_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } + before do + create( + :normalised_binning_purpose_config, + uuid: labware.purpose.uuid, + warnings:, + label_class: + ) + end it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/plate_presenter_spec.rb b/spec/models/presenters/plate_presenter_spec.rb index 378f4a611..60b6f29c5 100644 --- a/spec/models/presenters/plate_presenter_spec.rb +++ b/spec/models/presenters/plate_presenter_spec.rb @@ -337,7 +337,15 @@ end context 'with a plate that has no links' do - before { create(:purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links: []) } + before do + create( + :purpose_config, + uuid: labware.purpose.uuid, + warnings:, + label_class:, + file_links: [] + ) + end it 'returns an empty array' do expect(presenter.csv_file_links).to eq([]) diff --git a/spec/models/presenters/standard_presenter_spec.rb b/spec/models/presenters/standard_presenter_spec.rb index 6376b2ff3..14290d37c 100644 --- a/spec/models/presenters/standard_presenter_spec.rb +++ b/spec/models/presenters/standard_presenter_spec.rb @@ -5,7 +5,13 @@ let(:aliquot_type) { :v2_aliquot } let(:state) { 'pending' } let(:labware) do - create :v2_plate, barcode_number: 1, state:, purpose_name:, purpose_uuid: 'test-purpose', uuid: 'plate-uuid', wells: + create :v2_plate, + barcode_number: 1, + state:, + purpose_name:, + purpose_uuid: 'test-purpose', + uuid: 'plate-uuid', + wells: end let(:wells) do [ diff --git a/spec/models/presenters/submission_plate_presenter_spec.rb b/spec/models/presenters/submission_plate_presenter_spec.rb index aab4a7072..5e358992b 100644 --- a/spec/models/presenters/submission_plate_presenter_spec.rb +++ b/spec/models/presenters/submission_plate_presenter_spec.rb @@ -114,7 +114,9 @@ it_behaves_like 'a labware presenter' it_behaves_like 'a stock presenter' - let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } + let(:labware) do + create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions + end let(:submissions) { create_list :v2_submission, 1, state: 'pending' } let(:barcode_string) { 'DN2T' } @@ -154,7 +156,9 @@ end end - let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } + let(:labware) do + create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions + end let(:now) { Time.zone.parse('2020-11-24 16:13:43 +0000') } let(:submissions) { create_list :v2_submission, 1, state: 'ready', updated_at: now - 5.seconds } let(:barcode_string) { 'DN2T' } @@ -209,7 +213,12 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: + create :v2_stock_plate, + purpose_name:, + barcode_number: 2, + pool_sizes: [2], + direct_submissions: submissions, + state: end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } @@ -246,7 +255,12 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: + create :v2_stock_plate, + purpose_name:, + barcode_number: 2, + pool_sizes: [2], + direct_submissions: submissions, + state: end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } diff --git a/spec/models/presenters/tube_rack_presenter_spec.rb b/spec/models/presenters/tube_rack_presenter_spec.rb index 7a4df7cf0..bebb8e088 100644 --- a/spec/models/presenters/tube_rack_presenter_spec.rb +++ b/spec/models/presenters/tube_rack_presenter_spec.rb @@ -37,7 +37,13 @@ let(:label_class) { 'Labels::PlateLabel' } before do - create(:tube_rack_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links:) + create( + :tube_rack_config, + uuid: labware.purpose.uuid, + warnings:, + label_class:, + file_links: + ) create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') end diff --git a/spec/models/robots/pooling_robot_spec.rb b/spec/models/robots/pooling_robot_spec.rb index bc4dea351..a2bf527ae 100644 --- a/spec/models/robots/pooling_robot_spec.rb +++ b/spec/models/robots/pooling_robot_spec.rb @@ -104,7 +104,9 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } + let(:wells) do + %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } + end before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name diff --git a/spec/models/robots/quadrant_robot_spec.rb b/spec/models/robots/quadrant_robot_spec.rb index 97bb3939c..58ac0d7d7 100644 --- a/spec/models/robots/quadrant_robot_spec.rb +++ b/spec/models/robots/quadrant_robot_spec.rb @@ -102,7 +102,9 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } + let(:wells) do + %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } + end before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name diff --git a/spec/models/sequencescape_submission_spec.rb b/spec/models/sequencescape_submission_spec.rb index b2f1942b9..5341d8cf1 100644 --- a/spec/models/sequencescape_submission_spec.rb +++ b/spec/models/sequencescape_submission_spec.rb @@ -11,7 +11,9 @@ let(:template_uuid) { 'template-uuid' } let(:request_options) { { read_length: 150 } } let(:user_uuid) { 'user-uuid' } - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api:, assets:, template_uuid:, request_options:, user: user_uuid } + end describe '#template_uuid' do context 'when set directly' do @@ -22,7 +24,9 @@ context 'when set via template_name' do let(:template_name) { 'Submission template' } - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api:, assets:, template_uuid:, request_options:, user: user_uuid } + end before { Settings.submission_templates = { template_name => template_uuid } } @@ -33,7 +37,9 @@ end describe '#extra_barcodes_trimmed' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api:, assets:, template_uuid:, request_options:, user: user_uuid } + end it 'removes any extra whitespaces' do obj = described_class.new(attributes.merge(extra_barcodes: [' 1234 ', ' 5678 ', ' ', ''])) @@ -42,7 +48,9 @@ end describe '#extra_plates' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api:, assets:, template_uuid:, request_options:, user: user_uuid } + end let(:plate) { create :v2_plate } let(:obj) { described_class.new(attributes.merge(extra_barcodes: %w[1234 5678])) } @@ -57,23 +65,25 @@ end describe '#extra_assets' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api:, assets:, template_uuid:, request_options:, user: user_uuid } + end let(:plate) { create(:passed_plate) } let(:plate2) { create(:passed_plate) } it 'returns the uuids of the labwares wells' do obj = described_class.new(attributes.merge(extra_barcodes: %w[1234 5678])) - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( - barcode: %w[1234 5678] - ).and_return([plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) + .with(barcode: %w[1234 5678]) + .and_return([plate, plate2]) # There are 4 non-empty wells in each labware expect(obj.extra_assets.count).to eq(8) end it 'removes duplicates uuids in the returned list' do - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( - barcode: %w[1234 1234 5678] - ).and_return([plate, plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) + .with(barcode: %w[1234 1234 5678]) + .and_return([plate, plate, plate2]) obj = described_class.new(attributes.merge(extra_barcodes: %w[1234 1234 5678])) expect(obj.extra_assets.count).to eq(8) expect(obj.extra_assets.uniq.count).to eq(8) @@ -81,7 +91,9 @@ end describe '#asset_groups_for_orders_creation' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api:, assets:, template_uuid:, request_options:, user: user_uuid } + end it 'returns normal asset groups when no extra barcodes provided' do obj = described_class.new(attributes) @@ -92,9 +104,9 @@ let(:plate2) { create(:passed_plate) } before do - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( - barcode: %w[1234 5678] - ).and_return([plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) + .with(barcode: %w[1234 5678]) + .and_return([plate, plate2]) end it 'returns the current assets plus the extra assets' do diff --git a/spec/sequencescape/api/v2/plate_spec.rb b/spec/sequencescape/api/v2/plate_spec.rb index b68382890..ad63ee1cb 100644 --- a/spec/sequencescape/api/v2/plate_spec.rb +++ b/spec/sequencescape/api/v2/plate_spec.rb @@ -83,30 +83,32 @@ describe '::find_by' do it 'finds a plate' do - stub_request(:get, 'http://example.com:3000/api/v2/plates').with( - query: { - fields: { - sample_metadata: 'sample_common_name,collected_by,sample_description', - submissions: 'lanes_of_sequencing' + stub_request(:get, 'http://example.com:3000/api/v2/plates') + .with( + query: { + fields: { + sample_metadata: 'sample_common_name,collected_by,sample_description', + submissions: 'lanes_of_sequencing' + }, + filter: { + uuid: '8681e102-b737-11ec-8ace-acde48001122' + }, + # This is a bit brittle, as it depends on the exact order. + include: + 'purpose,child_plates.purpose,wells.downstream_tubes.purpose,' \ + 'wells.requests_as_source.request_type,wells.requests_as_source.primer_panel,' \ + 'wells.requests_as_source.pre_capture_pool,wells.requests_as_source.submission,' \ + 'wells.aliquots.sample.sample_metadata,wells.aliquots.request.request_type,' \ + 'wells.aliquots.request.primer_panel,wells.aliquots.request.pre_capture_pool,' \ + 'wells.aliquots.request.submission,' \ + 'wells.transfer_requests_as_target.source_asset' }, - filter: { - uuid: '8681e102-b737-11ec-8ace-acde48001122' - }, - # This is a bit brittle, as it depends on the exact order. - include: - 'purpose,child_plates.purpose,wells.downstream_tubes.purpose,' \ - 'wells.requests_as_source.request_type,wells.requests_as_source.primer_panel,' \ - 'wells.requests_as_source.pre_capture_pool,wells.requests_as_source.submission,' \ - 'wells.aliquots.sample.sample_metadata,wells.aliquots.request.request_type,' \ - 'wells.aliquots.request.primer_panel,wells.aliquots.request.pre_capture_pool,' \ - 'wells.aliquots.request.submission,' \ - 'wells.transfer_requests_as_target.source_asset' - }, - headers: { - 'Accept' => 'application/vnd.api+json', - 'Content-Type' => 'application/vnd.api+json' - } - ).to_return(File.new('./spec/contracts/v2-plate-by-uuid-for-presenter.txt')) + headers: { + 'Accept' => 'application/vnd.api+json', + 'Content-Type' => 'application/vnd.api+json' + } + ) + .to_return(File.new('./spec/contracts/v2-plate-by-uuid-for-presenter.txt')) expect( Sequencescape::Api::V2::Plate.find_by(uuid: '8681e102-b737-11ec-8ace-acde48001122') ).to be_a Sequencescape::Api::V2::Plate diff --git a/spec/sequencescape/api/v2/shared_examples.rb b/spec/sequencescape/api/v2/shared_examples.rb index 2c8e67d47..f695a7147 100644 --- a/spec/sequencescape/api/v2/shared_examples.rb +++ b/spec/sequencescape/api/v2/shared_examples.rb @@ -60,12 +60,12 @@ let(:alternative_workline_name) { 'Some other plate with some stuff inside' } before do - allow(SearchHelper).to receive(:alternative_workline_reference_name).with(the_labware).and_return( - alternative_workline_name - ) - allow(ancestors_scope).to receive(:where).with(purpose_name: alternative_workline_name).and_return( - alternative_workline_reference_plates - ) + allow(SearchHelper).to receive(:alternative_workline_reference_name) + .with(the_labware) + .and_return(alternative_workline_name) + allow(ancestors_scope).to receive(:where) + .with(purpose_name: alternative_workline_name) + .and_return(alternative_workline_reference_plates) end it 'returns the last alternative workline reference' do diff --git a/spec/support/api_url_helper.rb b/spec/support/api_url_helper.rb index db511413a..bb0281796 100644 --- a/spec/support/api_url_helper.rb +++ b/spec/support/api_url_helper.rb @@ -28,13 +28,9 @@ def api_url_for(*components) # @param [Int] status: the response status, defaults to 200 # @return mocked_request def stub_api_get(*components, status: 200, body: '{}') - stub_request(:get, api_url_for(*components)).with(headers: { 'Accept' => 'application/json' }).to_return( - status:, - body:, - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:get, api_url_for(*components)) + .with(headers: { 'Accept' => 'application/json' }) + .to_return(status:, body:, headers: { 'content-type' => 'application/json' }) end # Generate an API stub for a post request. @@ -58,17 +54,18 @@ def stub_api_post(*components, status: 201, body: '{}', payload: {}) end def stub_api_modify(*components, body:, payload:, action: :post, status: 201) - Array(body).reduce( - stub_request(action, api_url_for(*components)).with( - headers: { - 'Accept' => 'application/json', - 'content-type' => 'application/json' - }, - body: payload - ) - ) do |request, response| - request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) - end + Array(body) + .reduce( + stub_request(action, api_url_for(*components)).with( + headers: { + 'Accept' => 'application/json', + 'content-type' => 'application/json' + }, + body: payload + ) + ) do |request, response| + request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) + end end def stub_api_put(*components, body:, payload:) @@ -135,10 +132,9 @@ def stub_v2_plate(plate, stub_search: true, custom_query: nil, custom_includes: if custom_query allow(Sequencescape::Api::V2).to receive(custom_query.first).with(*custom_query.last).and_return(plate) elsif custom_includes - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( - custom_includes, - { uuid: plate.uuid } - ).and_return(plate) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) + .with(custom_includes, { uuid: plate.uuid }) + .and_return(plate) else allow(Sequencescape::Api::V2).to receive(:plate_for_presenter).with(uuid: plate.uuid).and_return(plate) end diff --git a/spec/support/contract_helper.rb b/spec/support/contract_helper.rb index 9d740f39a..e11e00d99 100644 --- a/spec/support/contract_helper.rb +++ b/spec/support/contract_helper.rb @@ -16,8 +16,7 @@ def initialize(root_directory) # rubocop:todo Lint/MissingCopEnableDirective # rubocop:todo Layout/LineLength # rubocop:enable Lint/MissingCopEnableDirective - REQUEST_REGEXP = - %r{ # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes + REQUEST_REGEXP = %r{ # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:enable Layout/LineLength (? \r\n|\r|\n){0} (? GET|PUT|POST|DELETE){0} diff --git a/spec/support/factory_bot_extensions.rb b/spec/support/factory_bot_extensions.rb index 0a35ed26f..54c26c611 100644 --- a/spec/support/factory_bot_extensions.rb +++ b/spec/support/factory_bot_extensions.rb @@ -31,9 +31,8 @@ def with_has_many_associations(*names, actions: ['read']) send(association) do {}.tap do |h| h['size'] = send(:"#{association}_count") if send(:"#{association}_actions").include?('read') - h['actions'] = send(:"#{association}_actions").index_with do |_action_name| - "#{resource_url}/#{association}" - end + h['actions'] = + send(:"#{association}_actions").index_with { |_action_name| "#{resource_url}/#{association}" } end end end diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index 76409187d..e67dd8774 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -9,9 +9,9 @@ def stub_search_and_single_result(search, query, result = nil) stub_api_post(search_uuid, 'first', status: 301, payload: query, body: result) else search_url = "http://example.com:3000/#{search_uuid}" - stub_request(:post, "#{search_url}/first").with(body: query.to_json).to_raise( - Sequencescape::Api::ResourceNotFound - ) + stub_request(:post, "#{search_url}/first") + .with(body: query.to_json) + .to_raise(Sequencescape::Api::ResourceNotFound) end end diff --git a/spec/support/robot_helpers.rb b/spec/support/robot_helpers.rb index 1b86fd797..8f1f30abe 100644 --- a/spec/support/robot_helpers.rb +++ b/spec/support/robot_helpers.rb @@ -6,10 +6,9 @@ def bed_labware_lookup(labware, includes = %i[purpose parents]) end def bed_labware_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) - allow(Sequencescape::Api::V2::Labware).to receive(:find_all).with( - { barcode: Array(barcode) }, - includes: - ).and_return(result) + allow(Sequencescape::Api::V2::Labware).to receive(:find_all) + .with({ barcode: Array(barcode) }, includes:) + .and_return(result) end def bed_plate_lookup(plate, includes = %i[purpose parents]) @@ -17,8 +16,8 @@ def bed_plate_lookup(plate, includes = %i[purpose parents]) end def bed_plate_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) - allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with({ barcode: Array(barcode) }, includes:).and_return( - result - ) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all) + .with({ barcode: Array(barcode) }, includes:) + .and_return(result) end end diff --git a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb index 1163ee23b..720c76f9c 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb @@ -4,7 +4,7 @@ has_a_working_api let(:wells) do - (1..12).map do |index| # one-based index + (1..12).map do |index| # one-based index supplier_name = "vac-tube-barcode-#{index}" sample_metadata = create(:v2_sample_metadata, supplier_name:) sample = create(:v2_sample, sample_metadata:) @@ -35,7 +35,7 @@ ['Plate Barcode', 'Well Position', 'Vac Tube Barcode', 'Sample Name', 'Well Name'] ] body = - (5..12).map do |index| # one-based index + (5..12).map do |index| # one-based index well = plate.wells_in_columns[index - 1] sample = well.aliquots.first.sample [plate.labware_barcode.human, well.location, sample.sample_metadata.supplier_name, sample.name, well.name] From d3812d6ab3341e1d487fedc2bacfec9ba05e54d9 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 13:44:15 +0100 Subject: [PATCH 076/141] build: add bin directory to prettier ignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index a35fa9c2c..a1d0dba8d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -10,6 +10,7 @@ public/stylesheets/*.css .sass-cache/ *.orig *.sublime-workspace +/bin /public/packs /public/packs-test /node_modules From eef085333eec673bb0cf37dc3bbefabde6a76a54 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 13:47:01 +0100 Subject: [PATCH 077/141] style: prettier yarn prettier --write . bundle exec rubocop -a --- app/controllers/health_controller.rb | 3 +- app/controllers/labware_controller.rb | 5 +- app/controllers/robots_controller.rb | 6 +- app/controllers/search_controller.rb | 3 +- .../tubes/validate_paired_tubes_controller.rb | 3 +- .../entrypoints/pages/bed_verification.js | 10 +- .../entrypoints/pages/multi_plate_pooling.js | 2 +- .../entrypoints/pages/multi_tube_pooling.js | 8 +- .../entrypoints/pages/tagged-plate.js | 6 +- .../components/CustomTaggedPlate.vue | 2 +- .../custom-tagged-plate/tagClashFunctions.js | 6 +- .../tagClashFunctions.spec.js | 10 +- .../custom-tagged-plate/tagLayoutFunctions.js | 2 +- .../LabwareCustomMetadataAddForm.spec.js | 4 +- .../javascript/lib/global_message_system.js | 2 +- .../components/MultiStampLibrarySplitter.js | 2 +- .../components/PrimerPanelFilter.vue | 2 +- .../multi_stamp_instance.shared_spec.js | 2 +- .../javascript/pipeline-graph/index.js | 2 +- .../plain-javascript/tag-animations.js | 2 +- .../threshold-well-failing.js | 2 +- .../components/QcInformation.vue | 2 +- app/frontend/javascript/session_scripts.js | 2 +- .../components/AssetLookupByUuid.spec.js | 4 +- .../shared/components/LabwareScan.spec.js | 16 +-- .../components/mixins/devourSelect.spec.js | 2 +- .../shared/components/plateScanValidators.js | 4 +- .../javascript/shared/devourApiValidators.js | 2 +- .../javascript/shared/transfersLayouts.js | 4 +- .../javascript/shared/tubeTransferVolumes.js | 4 +- .../test_support/factories/json_factory.js | 6 +- .../factories/json_factory.spec.js | 2 +- .../test_support/factories/plate_factory.js | 2 +- .../javascript/test_support/mock_api.spec.js | 2 +- app/frontend/stylesheets/limber/spinner.scss | 86 +++++++++++--- .../concerns/presenters/creation_behaviour.rb | 10 +- .../concerns/presenters/extended_csv.rb | 9 +- app/models/labware_creators/base.rb | 4 +- .../labware_creators/final_tube_from_plate.rb | 6 +- .../labware_creators/multi_stamp_tubes.rb | 4 +- .../multi_stamp_tubes_using_tube_rack_scan.rb | 17 ++- .../csv_file_for_duplex_seq.rb | 10 +- .../plate_split_to_tube_racks.rb | 7 +- .../labware_creators/pooled_tubes_base.rb | 11 +- .../pooled_tubes_by_sample.rb | 11 +- .../pooled_tubes_by_submission_with_phi_x.rb | 7 +- .../labware_creators/quadrant_stamp_base.rb | 5 +- app/models/robots/bed/invalid.rb | 3 +- .../robots/bed/plate_to_tube_racks_bed.rb | 4 +- app/sequencescape/sequencescape/api/v2.rb | 10 +- .../sequencescape/api/v2/base.rb | 8 +- .../sequencescape/api/v2/receptacle.rb | 3 +- .../sequencescape/api/v2/well.rb | 3 +- lib/purpose_config.rb | 15 ++- lib/robot_configuration.rb | 8 +- lib/tasks/config.rake | 20 ++-- limber.sublime-project | 12 +- public/404.html | 2 +- public/422.html | 2 +- public/500.html | 2 +- public/502.html | 2 +- public/504.html | 2 +- spec/controllers/exports_controller_spec.rb | 27 +++-- spec/controllers/plates_controller_spec.rb | 14 +-- spec/controllers/qc_files_controller_spec.rb | 42 +++---- .../tube_creation_controller_spec.rb | 18 +-- .../tubes/tubes_exports_controller_spec.rb | 8 +- spec/factories/plate_factories.rb | 29 +++-- spec/factories/poly_metadata_factories.rb | 3 +- spec/factories/purpose_config_factories.rb | 15 +-- spec/factories/strategies/api_strategy.rb | 3 +- spec/factories/tube_factories.rb | 8 +- spec/factories/tube_rack_factories.rb | 4 +- spec/factories/well_factories.rb | 8 +- .../charge_and_pass_libraries_spec.rb | 13 +-- spec/features/creating_a_plate_spec.rb | 12 +- spec/features/creating_a_tag_plate_spec.rb | 10 +- spec/features/failing_quadrants_spec.rb | 7 +- ...ling_multiple_plates_into_one_tube_spec.rb | 7 +- ...oling_multiple_tubes_into_one_tube_spec.rb | 54 +++++---- spec/features/viewing_a_plate_spec.rb | 7 +- spec/helpers/barcode_labels_helper_spec.rb | 12 +- spec/helpers/plate_helpers_spec.rb | 4 +- .../concentration_binned_plate_spec.rb | 10 +- .../concentration_normalised_plate_spec.rb | 6 +- .../custom_pooled_tubes_spec.rb | 28 +++-- .../custom_tagged_plate_spec.rb | 12 +- .../labware_creators/donor_pooling_spec.rb | 34 +++--- .../final_tube_from_plate_spec.rb | 8 +- .../fixed_normalised_plate_spec.rb | 5 +- .../labware_creators/merged_plate_spec.rb | 51 ++++----- .../multi_stamp_tubes_spec.rb | 6 +- ...i_stamp_tubes_using_tube_rack_scan_spec.rb | 49 ++++---- .../normalised_binned_plate_spec.rb | 5 +- ...cycles_binned_plate_for_duplex_seq_spec.rb | 42 ++++--- ...cycles_binned_plate_for_t_nano_seq_spec.rb | 32 +++--- .../plate_split_to_tube_racks_spec.rb | 108 ++++++++---------- .../plate_with_template_spec.rb | 9 +- .../pooled_tubes_from_whole_plates_spec.rb | 11 +- .../pooled_tubes_from_whole_tubes_spec.rb | 19 +-- .../quadrant_split_plate_spec.rb | 7 +- .../quadrant_stamp_primer_panel_spec.rb | 7 +- .../labware_creators/shared_examples.rb | 6 +- ...d_plate_reordering_columns_to_rows_spec.rb | 8 +- .../labware_creators/stamped_plate_spec.rb | 18 +-- .../labware_creators/tagged_plate_spec.rb | 14 +-- .../labware_creators/tube_from_tube_spec.rb | 9 +- .../well_filter_allowing_partials_spec.rb | 4 +- .../labware_creators/well_filter_spec.rb | 4 +- spec/models/labware_metadata_spec.rb | 22 ++-- ...ncentration_binned_plate_presenter_spec.rb | 9 +- .../presenters/final_tube_presenter_spec.rb | 4 +- .../normalised_binned_plate_presenter_spec.rb | 9 +- .../models/presenters/plate_presenter_spec.rb | 10 +- .../presenters/standard_presenter_spec.rb | 8 +- .../submission_plate_presenter_spec.rb | 22 +--- .../presenters/tube_rack_presenter_spec.rb | 8 +- spec/models/robots/pooling_robot_spec.rb | 4 +- spec/models/robots/quadrant_robot_spec.rb | 4 +- spec/models/sequencescape_submission_spec.rb | 42 +++---- spec/sequencescape/api/v2/plate_spec.rb | 48 ++++---- spec/sequencescape/api/v2/shared_examples.rb | 12 +- spec/support/api_url_helper.rb | 40 ++++--- spec/support/contract_helper.rb | 3 +- spec/support/factory_bot_extensions.rb | 5 +- spec/support/feature_helpers.rb | 6 +- spec/support/robot_helpers.rb | 13 ++- ...frost_pbs_to_cellaca_count.csv.erb_spec.rb | 4 +- 128 files changed, 650 insertions(+), 859 deletions(-) diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 02b1ee3cf..1298857fc 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -2,5 +2,6 @@ # Controller to display a page stating that Limber is up, as a health check endpoint class HealthController < ApplicationController - def show; end + def show + end end diff --git a/app/controllers/labware_controller.rb b/app/controllers/labware_controller.rb index 36126b57e..eec1a449d 100644 --- a/app/controllers/labware_controller.rb +++ b/app/controllers/labware_controller.rb @@ -22,8 +22,9 @@ def show # rubocop:todo Metrics/AbcSize format.html { render @presenter.page } format.csv do render @presenter.csv - response.headers['Content-Disposition'] = - "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename + response.headers[ + 'Content-Disposition' + ] = "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename end format.json end diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb index 8559b5d7d..1b119511d 100644 --- a/app/controllers/robots_controller.rb +++ b/app/controllers/robots_controller.rb @@ -73,9 +73,9 @@ def update_bed_labware_metadata(bed, robot_barcode) # @raise [Sequencescape::Api::ResourceNotFound] if the labware cannot be found # def labware_created_with_robot(labware_barcode, robot_barcode) - LabwareMetadata - .new(user_uuid: current_user_uuid, barcode: labware_barcode) - .update!(created_with_robot: robot_barcode) + LabwareMetadata.new(user_uuid: current_user_uuid, barcode: labware_barcode).update!( + created_with_robot: robot_barcode + ) end def verify diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index f2d5e3345..e3ecce169 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -7,7 +7,8 @@ class InputError < StandardError before_action :check_for_login!, only: [:my_plates] # rubocop:todo Rails/LexicallyScopedActionFilter - def new; end + def new + end def ongoing_plates # rubocop:todo Metrics/AbcSize plate_search = api.search.find(Settings.searches.fetch('Find plates')) diff --git a/app/controllers/tubes/validate_paired_tubes_controller.rb b/app/controllers/tubes/validate_paired_tubes_controller.rb index ca929c7cd..db1c8980f 100644 --- a/app/controllers/tubes/validate_paired_tubes_controller.rb +++ b/app/controllers/tubes/validate_paired_tubes_controller.rb @@ -5,5 +5,6 @@ class Tubes::ValidatePairedTubesController < ApplicationController before_action :check_for_current_user! - def index; end + def index + end end diff --git a/app/frontend/entrypoints/pages/bed_verification.js b/app/frontend/entrypoints/pages/bed_verification.js index 79af43401..085885d0f 100644 --- a/app/frontend/entrypoints/pages/bed_verification.js +++ b/app/frontend/entrypoints/pages/bed_verification.js @@ -30,21 +30,21 @@ let newScanned = function (bed, labware) { .append( $(document.createElement('h3')) .attr('class', 'ui-li-heading') - .text('Bed: ' + bed) + .text('Bed: ' + bed), ) .append(closeIcon()) .append( $(document.createElement('p')) .attr('class', 'ui-li-desc') - .text('Labware: ' + labware) + .text('Labware: ' + labware), ) .append( $(document.createElement('input')) .attr('type', 'hidden') .attr('id', 'bed_labwares[' + bed + ']') .attr('name', 'bed_labwares[' + bed + '][]') - .val(labware) - ) + .val(labware), + ), ) SCAPE.robot_beds[bed] = SCAPE.robot_beds[bed] || [] SCAPE.robot_beds[bed].push(labware) @@ -162,7 +162,7 @@ $('#validate_layout').on('click', function () { }).fail(function (_data, _status) { SCAPE.message( 'The beds could not be validated. There may be network issues, or problems with Sequencescape.', - 'danger' + 'danger', ) fail() }) diff --git a/app/frontend/entrypoints/pages/multi_plate_pooling.js b/app/frontend/entrypoints/pages/multi_plate_pooling.js index 441a30133..af79ae588 100644 --- a/app/frontend/entrypoints/pages/multi_plate_pooling.js +++ b/app/frontend/entrypoints/pages/multi_plate_pooling.js @@ -284,7 +284,7 @@ SCAPE.renderSourceWells = function () { for (let wellName of wells) { well = $('.plate-id-' + plateIndex + ' .' + wellName) well.append( - SCAPE.newAliquot(capPoolOffset + poolNumber, WELLS_IN_COLUMN_MAJOR_ORDER[capPoolOffset + poolNumber]) + SCAPE.newAliquot(capPoolOffset + poolNumber, WELLS_IN_COLUMN_MAJOR_ORDER[capPoolOffset + poolNumber]), ) newInput = $(document.createElement('input')) diff --git a/app/frontend/entrypoints/pages/multi_tube_pooling.js b/app/frontend/entrypoints/pages/multi_tube_pooling.js index 1c55a96b5..95fc5c028 100644 --- a/app/frontend/entrypoints/pages/multi_tube_pooling.js +++ b/app/frontend/entrypoints/pages/multi_tube_pooling.js @@ -74,7 +74,7 @@ newScanned.prototype = { .append( $(document.createElement('h3')) .attr('class', 'ui-li-heading') - .text('Tube: ' + this.tubeBarcode) + .text('Tube: ' + this.tubeBarcode), ) .append($(document.createElement('div')).attr('class', 'tube_validation_report').text('Waiting...')) .append( @@ -82,8 +82,8 @@ newScanned.prototype = { .attr('type', 'hidden') .attr('id', 'tube[parents][' + this.tubeBarcode + ']') .attr('name', 'tube[parents][' + this.tubeBarcode + ']') - .val(1) - ) + .val(1), + ), ) return this.listElement }, @@ -140,7 +140,7 @@ tubeCollector = new statusCollector( }, function () { $('#tube_submit').prop('disabled', true) - } + }, ) $('.sibling-tube').each(function () { diff --git a/app/frontend/entrypoints/pages/tagged-plate.js b/app/frontend/entrypoints/pages/tagged-plate.js index f401b722f..83e1fe5ed 100644 --- a/app/frontend/entrypoints/pages/tagged-plate.js +++ b/app/frontend/entrypoints/pages/tagged-plate.js @@ -87,7 +87,7 @@ qcableLookup.prototype = { return function () { qc_lookup.message( 'The barcode could not be found. There may be network issues, or problems with Sequencescape.', - 'danger' + 'danger', ) } }, @@ -164,7 +164,7 @@ qcableLookup.prototype = { $(document.createElement('div')) .addClass('alert') .addClass('alert-' + status) - .text(message) + .text(message), ) }, dual: function () { @@ -182,7 +182,7 @@ let qcCollector = new tagStatusCollector( function (message) { $('#submit-summary').text(message) $('#plate_submit').prop('disabled', true) - } + }, ) new qcableLookup($('#plate_tag_plate_barcode'), qcCollector) diff --git a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue index 07220aff2..ec11ba7db 100644 --- a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue +++ b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue @@ -252,7 +252,7 @@ export default { this.parentWellSubmissionDetails, this.tagLayout, this.tagSubstitutions, - this.tagGroupOligoStrings + this.tagGroupOligoStrings, ) }, createButtonDisabled() { diff --git a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js index c4aa5a516..3548377a6 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js +++ b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js @@ -23,7 +23,7 @@ function extractParentWellSubmissionDetails(parentPlate) { // TODO Replace this with generic limber logging when available // See https://github.com/sanger/limber/issues/836 console.error( - 'Tag clash functions: extractParentWellSubmissionDetails: Error: Submission Id not found for well' + 'Tag clash functions: extractParentWellSubmissionDetails: Error: Submission Id not found for well', ) return } @@ -94,7 +94,7 @@ function extractChildUsedOligos(parentUsedOligos, parentWellSubmDetails, tagLayo parentWellSubmDetails, tagLayout, tagSubstitutions, - tagGroupOligos + tagGroupOligos, ) ) { return {} @@ -135,7 +135,7 @@ function isValidChildUsedOligoParameters( parentWellSubmDetails, tagLayout, tagSubstitutions, - tagGroupOligos + tagGroupOligos, ) { let isValid = true diff --git a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js index 40e1a90e7..b027dc95a 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js +++ b/app/frontend/javascript/custom-tagged-plate/tagClashFunctions.spec.js @@ -362,7 +362,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -399,7 +399,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -435,7 +435,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -473,7 +473,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) @@ -509,7 +509,7 @@ describe('extractChildUsedOligos', () => { parentWellSubmDetsForPools, tagLayout, tagSubs, - tagGroupOligos + tagGroupOligos, ) expect(response).toEqual(exptSubmUsedTags) diff --git a/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js b/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js index 580e8ec0a..341bd7ff0 100644 --- a/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js +++ b/app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js @@ -147,7 +147,7 @@ const calculateTagLayout = function (data) { data.tagsPerWell, (well, relIndex, absIndex) => { return walkingByFunctions[data.walkingBy](well, tags, relIndex, absIndex, offset, counters) - } + }, ) } diff --git a/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js b/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js index 4b70ceb96..251efe18d 100644 --- a/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js +++ b/app/frontend/javascript/labware-custom-metadata/components/LabwareCustomMetadataAddForm.spec.js @@ -28,7 +28,7 @@ describe('LabwareCustomMetadataAddForm', () => { global.fetch = vi.fn().mockReturnValue( Promise.resolve({ json: () => Promise.resolve(data), - }) + }), ) // This is a workaround for the following warning: @@ -80,7 +80,7 @@ describe('LabwareCustomMetadataAddForm', () => { // expect(wrapper.find('#RT DFD Syringe Lot Number').exists()).toBe(true) expect(wrapper.find('#labware_custom_metadata_submit_button').exists()).toBe(true) expect(wrapper.find('#labware_custom_metadata_submit_button').text()).toEqual( - 'Add Custom Metadata to Sequencescape' + 'Add Custom Metadata to Sequencescape', ) }) }) diff --git a/app/frontend/javascript/lib/global_message_system.js b/app/frontend/javascript/lib/global_message_system.js index 82fea0d7a..f8aa308e3 100644 --- a/app/frontend/javascript/lib/global_message_system.js +++ b/app/frontend/javascript/lib/global_message_system.js @@ -16,7 +16,7 @@ SCAPE.message = function (message, status) { $(document.createElement('div')) .addClass('alert') .addClass('alert-' + status) - .text(message) + .text(message), ) } diff --git a/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js b/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js index 29d0a256a..be6912133 100644 --- a/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js +++ b/app/frontend/javascript/multi-stamp/components/MultiStampLibrarySplitter.js @@ -95,7 +95,7 @@ export default Vue.extend({ headers: { 'X-Requested-With': 'XMLHttpRequest' }, data: payload, }) - }) + }), ) .then((responses) => { const response = responses[0] diff --git a/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue b/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue index fad3d94b4..005de6dbe 100644 --- a/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue +++ b/app/frontend/javascript/multi-stamp/components/PrimerPanelFilter.vue @@ -39,7 +39,7 @@ export default { return [] } const primerPanelsIterable = Array.from(primerPanelsByPlate.values()).reduce((accu, current) => - accu.filter((val) => current.includes(val)) + accu.filter((val) => current.includes(val)), ) return primerPanelsIterable }, diff --git a/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js b/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js index 660316d2f..058fab0bb 100644 --- a/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js +++ b/app/frontend/javascript/multi-stamp/components/shared_examples/multi_stamp_instance.shared_spec.js @@ -171,7 +171,7 @@ const sharedSpecs = (args) => { expect(wrapper.vm.duplicatedTransfers.length).toEqual(1) expect(wrapper.vm.transfersError).toEqual( - 'This would result in multiple transfers into the same well. Check if the source plates (DN1S) have more than one active submission.' + 'This would result in multiple transfers into the same well. Check if the source plates (DN1S) have more than one active submission.', ) }) diff --git a/app/frontend/javascript/pipeline-graph/index.js b/app/frontend/javascript/pipeline-graph/index.js index 658a6b454..9b3d477f8 100644 --- a/app/frontend/javascript/pipeline-graph/index.js +++ b/app/frontend/javascript/pipeline-graph/index.js @@ -204,7 +204,7 @@ const applyMouseEvents = function () {
${content}
- ` + `, ) return document.querySelector('.graph-tooltip') }, diff --git a/app/frontend/javascript/plain-javascript/tag-animations.js b/app/frontend/javascript/plain-javascript/tag-animations.js index 37abc6e77..2a96413fb 100644 --- a/app/frontend/javascript/plain-javascript/tag-animations.js +++ b/app/frontend/javascript/plain-javascript/tag-animations.js @@ -27,5 +27,5 @@ document.addEventListener( } } }, - false + false, ) diff --git a/app/frontend/javascript/plain-javascript/threshold-well-failing.js b/app/frontend/javascript/plain-javascript/threshold-well-failing.js index 9d3061587..9c161191f 100644 --- a/app/frontend/javascript/plain-javascript/threshold-well-failing.js +++ b/app/frontend/javascript/plain-javascript/threshold-well-failing.js @@ -51,7 +51,7 @@ document.addEventListener('DOMContentLoaded', () => { // The well must meet all thresholds. const wellInvalid = Object.entries(threshold).some( - ([qcKey, thresholdValue]) => parseFloat(well.dataset[qcKey]) < thresholdValue + ([qcKey, thresholdValue]) => parseFloat(well.dataset[qcKey]) < thresholdValue, ) well.checked = wellInvalid diff --git a/app/frontend/javascript/qc-information/components/QcInformation.vue b/app/frontend/javascript/qc-information/components/QcInformation.vue index fdcceb2a9..fcfd7d556 100644 --- a/app/frontend/javascript/qc-information/components/QcInformation.vue +++ b/app/frontend/javascript/qc-information/components/QcInformation.vue @@ -108,7 +108,7 @@ export default { }, () => { this.state = 'failure' - } + }, ) }, }, diff --git a/app/frontend/javascript/session_scripts.js b/app/frontend/javascript/session_scripts.js index e72d80654..925bfc5a6 100644 --- a/app/frontend/javascript/session_scripts.js +++ b/app/frontend/javascript/session_scripts.js @@ -20,7 +20,7 @@ logIn = function () { if (user_name !== wasLoggedIn) { updateUserName(user_name) warning( - 'The logged in user has changed since this page was last viewed. You are now logged in as ' + user_name + '.' + 'The logged in user has changed since this page was last viewed. You are now logged in as ' + user_name + '.', ) } } else { diff --git a/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js b/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js index a1990a362..32dafca05 100644 --- a/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js +++ b/app/frontend/javascript/shared/components/AssetLookupByUuid.spec.js @@ -34,7 +34,7 @@ describe('AssetLookupByUuid', () => { filter: { uuid: assetUuid }, fields: {}, }, - { data: [] } // no plates found + { data: [] }, // no plates found ) const wrapper = wrapperFactoryPlate(api) @@ -59,7 +59,7 @@ describe('AssetLookupByUuid', () => { filter: { uuid: assetUuid }, fields: {}, }, - goodPlate + goodPlate, ) const wrapper = wrapperFactoryPlate(api) diff --git a/app/frontend/javascript/shared/components/LabwareScan.spec.js b/app/frontend/javascript/shared/components/LabwareScan.spec.js index ddfb7fc39..7ec99fb41 100644 --- a/app/frontend/javascript/shared/components/LabwareScan.spec.js +++ b/app/frontend/javascript/shared/components/LabwareScan.spec.js @@ -138,7 +138,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - goodTube + goodTube, ) wrapper.find('input').setValue('DN12345') @@ -170,7 +170,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - nullTube + nullTube, ) const wrapper = wrapperFactoryTube(api) @@ -202,7 +202,7 @@ describe('LabwareScan', () => { receptacles: 'uuid', }, }, - pendingTube + pendingTube, ) wrapper.find('input').setValue('Good barcode') @@ -263,7 +263,7 @@ describe('LabwareScan', () => { status: 500, }, ], - } + }, ) const wrapper = wrapperFactoryTube(api) @@ -312,7 +312,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - goodPlate + goodPlate, ) wrapper.find('input').setValue('DN12345') @@ -343,7 +343,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - nullPlate + nullPlate, ) const wrapper = wrapperFactoryPlate(api) @@ -373,7 +373,7 @@ describe('LabwareScan', () => { plates: 'labware_barcode,uuid,number_of_rows,number_of_columns', }, }, - badPlate + badPlate, ) wrapper.find('input').setValue('Good barcode') @@ -428,7 +428,7 @@ describe('LabwareScan', () => { status: 500, }, ], - } + }, ) const wrapper = wrapperFactoryPlate(api) diff --git a/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js b/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js index 7ea4886fe..9e3c60d5a 100644 --- a/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js +++ b/app/frontend/javascript/shared/components/mixins/devourSelect.spec.js @@ -99,7 +99,7 @@ describe('DevourSelect mixin', () => { status: 500, }, ], - } + }, ) const wrapper = wrapperFactory(api) diff --git a/app/frontend/javascript/shared/components/plateScanValidators.js b/app/frontend/javascript/shared/components/plateScanValidators.js index 82e89792e..843fa0f8a 100644 --- a/app/frontend/javascript/shared/components/plateScanValidators.js +++ b/app/frontend/javascript/shared/components/plateScanValidators.js @@ -306,13 +306,13 @@ const checkAllLibraryRequestsWithSameReadySubmissions = () => { return (plate) => { const [firstWellSubmissionIds, ...remainingWellsSubmissionIds] = getAllLibrarySubmissionsWithMatchingStateForPlate( plate, - 'ready' + 'ready', ) // To compare lists we use _.isEqual because there is no equivalent function for lists in // plain Javascript if ( remainingWellsSubmissionIds.every((currentElemSubmissionIds) => - _.isEqual(firstWellSubmissionIds.sort(), currentElemSubmissionIds.sort()) + _.isEqual(firstWellSubmissionIds.sort(), currentElemSubmissionIds.sort()), ) ) { return validScanMessage() diff --git a/app/frontend/javascript/shared/devourApiValidators.js b/app/frontend/javascript/shared/devourApiValidators.js index ceb6ef19b..abece2c81 100644 --- a/app/frontend/javascript/shared/devourApiValidators.js +++ b/app/frontend/javascript/shared/devourApiValidators.js @@ -25,7 +25,7 @@ const hasExpectedProperties = (expectedProperties) => { for (const currTagGroup of results) { const hasAllProperties = expectedProperties.every((property) => - Object.prototype.hasOwnProperty.call(currTagGroup, property) + Object.prototype.hasOwnProperty.call(currTagGroup, property), ) if (!hasAllProperties) { diff --git a/app/frontend/javascript/shared/transfersLayouts.js b/app/frontend/javascript/shared/transfersLayouts.js index 43be7b1ef..e1500ff06 100644 --- a/app/frontend/javascript/shared/transfersLayouts.js +++ b/app/frontend/javascript/shared/transfersLayouts.js @@ -54,7 +54,7 @@ const quadrantTransfers = function (requestsWithPlates) { plateObj.index, well.position.name, quadrantOffsets.rowOffset, - quadrantOffsets.colOffset + quadrantOffsets.colOffset, ) const transfer = { request: request, @@ -189,7 +189,7 @@ const buildSequentialTransfersArray = function (transferRequests) { // const buildSequentialLibrarySplitTransfersArray = function ( transferRequests, - numberOfWellsForEachSourcePlateInColumnOrder = 24 + numberOfWellsForEachSourcePlateInColumnOrder = 24, ) { const libraryTypes = [] return transferRequests.map((requestWithPlate) => { diff --git a/app/frontend/javascript/shared/tubeTransferVolumes.js b/app/frontend/javascript/shared/tubeTransferVolumes.js index 342f1cb00..4ca595ecf 100644 --- a/app/frontend/javascript/shared/tubeTransferVolumes.js +++ b/app/frontend/javascript/shared/tubeTransferVolumes.js @@ -13,10 +13,10 @@ const tubeMostRecentMolarity = function (tube) { const qcResults = tube?.receptacle?.qc_results const molarityEntries = qcResults?.filter((result) => result.key === 'molarity' && result.units === 'nM') const sortedByCreatedAt = molarityEntries?.sort( - (resultA, resultB) => -1 * ('' + resultA.created_at).localeCompare(resultB.created_at) + (resultA, resultB) => -1 * ('' + resultA.created_at).localeCompare(resultB.created_at), ) const sortedByIds = sortedByCreatedAt?.sort((resultA, resultB) => - parseInt(resultA.id) > parseInt(resultB.id) ? -1 : 1 + parseInt(resultA.id) > parseInt(resultB.id) ? -1 : 1, ) const mostRecentMolarityResult = sortedByIds?.[0] return mostRecentMolarityResult ? parseFloat(mostRecentMolarityResult?.value) : undefined diff --git a/app/frontend/javascript/test_support/factories/json_factory.js b/app/frontend/javascript/test_support/factories/json_factory.js index 56e4400c9..4490c68ef 100644 --- a/app/frontend/javascript/test_support/factories/json_factory.js +++ b/app/frontend/javascript/test_support/factories/json_factory.js @@ -71,7 +71,7 @@ const extractAssociations = (resource_config, attributeValues, resourceUrl) => { return { relationships, included } }, - { relationships: {}, included: [] } + { relationships: {}, included: [] }, ) } @@ -94,7 +94,7 @@ const buildMany = (associationName, associationValue) => { includeData.push(...singleResource.includeData) return { relationData, includeData } }, - { relationData: { data: [] }, includeData: [] } + { relationData: { data: [] }, includeData: [] }, ) } @@ -168,7 +168,7 @@ const jsonCollectionFactory = (factoryName, collectionAttributes, options = {}) included.push(...json.included) return { data, included } }, - { data: [], included: [] } + { data: [], included: [] }, ) return { diff --git a/app/frontend/javascript/test_support/factories/json_factory.spec.js b/app/frontend/javascript/test_support/factories/json_factory.spec.js index 036869523..bf9cbc073 100644 --- a/app/frontend/javascript/test_support/factories/json_factory.spec.js +++ b/app/frontend/javascript/test_support/factories/json_factory.spec.js @@ -242,7 +242,7 @@ describe('jsonCollectionFactory', () => { ], { base: 'assets/123/comments', - } + }, ) expect(json).toEqual({ diff --git a/app/frontend/javascript/test_support/factories/plate_factory.js b/app/frontend/javascript/test_support/factories/plate_factory.js index 53a9ac1d3..fc7d0b880 100644 --- a/app/frontend/javascript/test_support/factories/plate_factory.js +++ b/app/frontend/javascript/test_support/factories/plate_factory.js @@ -26,7 +26,7 @@ const plateFactory = function (options = {}) { position: { name: indexToName(iteration, 8) }, }, ..._wellOptions, - }) + }), ), } return { ...plateDefaults, ...(plateOptions || {}) } diff --git a/app/frontend/javascript/test_support/mock_api.spec.js b/app/frontend/javascript/test_support/mock_api.spec.js index f33ac7d1e..b0b795a80 100644 --- a/app/frontend/javascript/test_support/mock_api.spec.js +++ b/app/frontend/javascript/test_support/mock_api.spec.js @@ -42,7 +42,7 @@ describe('mockApi', () => { status: 500, }, ], - } + }, ) let response = await api.devour diff --git a/app/frontend/stylesheets/limber/spinner.scss b/app/frontend/stylesheets/limber/spinner.scss index ab8e7ad23..d2430970e 100644 --- a/app/frontend/stylesheets/limber/spinner.scss +++ b/app/frontend/stylesheets/limber/spinner.scss @@ -36,57 +36,111 @@ 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.087em -0.825em 0 -0.42em, + -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, + -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.338em -0.758em 0 -0.42em, + -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, + -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, + box-shadow: + 0 -0.83em 0 -0.4em, + -0.377em -0.74em 0 -0.42em, + -0.645em -0.522em 0 -0.44em, + -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } } @keyframes load6 { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.087em -0.825em 0 -0.42em, + -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, + -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.338em -0.758em 0 -0.42em, + -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, + -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, + box-shadow: + 0 -0.83em 0 -0.4em, + -0.377em -0.74em 0 -0.42em, + -0.645em -0.522em 0 -0.44em, + -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } } diff --git a/app/models/concerns/presenters/creation_behaviour.rb b/app/models/concerns/presenters/creation_behaviour.rb index 73f6b638a..385ce117a 100644 --- a/app/models/concerns/presenters/creation_behaviour.rb +++ b/app/models/concerns/presenters/creation_behaviour.rb @@ -23,10 +23,9 @@ def purposes_of_type(type) end def construct_buttons(scope) - scope.map do |purpose_uuid, purpose_settings| - LabwareCreators - .class_for(purpose_uuid) - .creator_button( + scope + .map do |purpose_uuid, purpose_settings| + LabwareCreators.class_for(purpose_uuid).creator_button( creator: LabwareCreators.class_for(purpose_uuid), parent_uuid: uuid, parent: labware, @@ -35,7 +34,8 @@ def construct_buttons(scope) type: purpose_settings.asset_type, filters: purpose_settings.filters || {} ) - end.force + end + .force end def active_pipelines diff --git a/app/models/concerns/presenters/extended_csv.rb b/app/models/concerns/presenters/extended_csv.rb index 43792c343..687b81192 100644 --- a/app/models/concerns/presenters/extended_csv.rb +++ b/app/models/concerns/presenters/extended_csv.rb @@ -57,14 +57,7 @@ def transfers_for_csv # rubocop:todo Metrics/AbcSize destination_barcode = ct.destination.barcode.machine transfers = ct.transfers.reverse_merge(all_wells).sort { |a, b| split_location(a.first) <=> split_location(b.first) } - { - source_ean:, - source_barcode:, - source_stock:, - destination_ean:, - destination_barcode:, - transfers: - } + { source_ean:, source_barcode:, source_stock:, destination_ean:, destination_barcode:, transfers: } end end end diff --git a/app/models/labware_creators/base.rb b/app/models/labware_creators/base.rb index 92c1913cd..5a3278750 100644 --- a/app/models/labware_creators/base.rb +++ b/app/models/labware_creators/base.rb @@ -117,9 +117,7 @@ def create_plate_from_parent! end def transfer!(attributes) - Sequencescape::Api::V2::Transfer.create!( - attributes.merge(transfer_template_uuid:, user_uuid:) - ) + Sequencescape::Api::V2::Transfer.create!(attributes.merge(transfer_template_uuid:, user_uuid:)) end def transfer_material_from_parent!(child_uuid) diff --git a/app/models/labware_creators/final_tube_from_plate.rb b/app/models/labware_creators/final_tube_from_plate.rb index 1537864e2..7fca03be6 100644 --- a/app/models/labware_creators/final_tube_from_plate.rb +++ b/app/models/labware_creators/final_tube_from_plate.rb @@ -48,11 +48,7 @@ def pass_tubes! raise StandardError, 'Tubes cannot be passed before transfer' if @create_transfer.nil? tubes_from_transfer.each do |tube_uuid| - Sequencescape::Api::V2::StateChange.create!( - target_state: 'passed', - target_uuid: tube_uuid, - user_uuid: - ) + Sequencescape::Api::V2::StateChange.create!(target_state: 'passed', target_uuid: tube_uuid, user_uuid:) end end diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 7c067a18d..51608f418 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -160,9 +160,7 @@ def create_submission_from_parent_tubes sequencescape_submission_parameters = { template_name: configured_params[:template_name], request_options: configured_params[:request_options], - asset_groups: [ - { assets: asset_uuids, autodetect_studies:, autodetect_projects: } - ], + asset_groups: [{ assets: asset_uuids, autodetect_studies:, autodetect_projects: }], api:, user: user_uuid } diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index d1aab1bd2..d640a3ca6 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -246,15 +246,14 @@ def transfer_material_from_parent!(child_plate) # @return [Array] An array of hashes representing the transfer requests. def transfer_request_attributes(child_plate) parent_tubes.each_with_object([]) do |(foreign_barcode, parent_tube), tube_transfers| - tube_transfers << - request_hash( - parent_tube.uuid, - child_plate - .wells - .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } - &.uuid, - { outer_request: source_tube_outer_request_uuid(parent_tube) } - ) + tube_transfers << request_hash( + parent_tube.uuid, + child_plate + .wells + .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } + &.uuid, + { outer_request: source_tube_outer_request_uuid(parent_tube) } + ) end end diff --git a/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb b/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb index c6b95285e..b7ff6d86f 100644 --- a/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb +++ b/app/models/labware_creators/pcr_cycles_binned_plate/csv_file_for_duplex_seq.rb @@ -14,8 +14,14 @@ module PcrCyclesBinnedPlate class CsvFileForDuplexSeq < CsvFileBase delegate :submit_for_sequencing_column, :sub_pool_column, :coverage_column, to: :well_details_header_row - FIELDS_FOR_WELL_DETAILS = %w[diluent_volume pcr_cycles submit_for_sequencing sub_pool coverage sample_volume] - .freeze + FIELDS_FOR_WELL_DETAILS = %w[ + diluent_volume + pcr_cycles + submit_for_sequencing + sub_pool + coverage + sample_volume + ].freeze # Returns the contents of the header row for the well detail columns def well_details_header_row diff --git a/app/models/labware_creators/plate_split_to_tube_racks.rb b/app/models/labware_creators/plate_split_to_tube_racks.rb index c9bd26883..e476eb7d5 100644 --- a/app/models/labware_creators/plate_split_to_tube_racks.rb +++ b/app/models/labware_creators/plate_split_to_tube_racks.rb @@ -654,9 +654,10 @@ def add_contingency_tube_metadata # @param tube_details [Hash] The tube details hash from the tube rack scan file. # @return [void] def add_tube_metadata(child_tube, tube_posn, tube_details) - LabwareMetadata - .new(user_uuid:, barcode: child_tube.barcode.machine) - .update!(tube_rack_barcode: tube_details['tube_rack_barcode'], tube_rack_position: tube_posn) + LabwareMetadata.new(user_uuid:, barcode: child_tube.barcode.machine).update!( + tube_rack_barcode: tube_details['tube_rack_barcode'], + tube_rack_position: tube_posn + ) end # Generates a transfer request hash for the given source well UUID, target tube UUID, and additional parameters. diff --git a/app/models/labware_creators/pooled_tubes_base.rb b/app/models/labware_creators/pooled_tubes_base.rb index 0ba193629..90f6e5965 100644 --- a/app/models/labware_creators/pooled_tubes_base.rb +++ b/app/models/labware_creators/pooled_tubes_base.rb @@ -41,12 +41,11 @@ def transfer_request_attributes # this currently assumes that pool_identifier will be the submission_uuid # (it would have always been, historically) pool.each do |location| - transfer_requests << - request_hash( - well_locations.fetch(location).uuid, - child_stock_tubes.fetch(name_for(pool)).uuid, - pool_identifier - ) + transfer_requests << request_hash( + well_locations.fetch(location).uuid, + child_stock_tubes.fetch(name_for(pool)).uuid, + pool_identifier + ) end end end diff --git a/app/models/labware_creators/pooled_tubes_by_sample.rb b/app/models/labware_creators/pooled_tubes_by_sample.rb index 8039a40ba..6b9e84a5e 100644 --- a/app/models/labware_creators/pooled_tubes_by_sample.rb +++ b/app/models/labware_creators/pooled_tubes_by_sample.rb @@ -69,12 +69,11 @@ def name_for_details(pool_identifier) def transfer_request_attributes pools.each_with_object([]) do |(pool_identifier, pool), transfer_requests| pool.each do |location| - transfer_requests << - request_hash( - well_locations.fetch(location).uuid, - child_stock_tubes.fetch(name_for(name_for_details(pool_identifier))).uuid, - pool_identifier - ) + transfer_requests << request_hash( + well_locations.fetch(location).uuid, + child_stock_tubes.fetch(name_for(name_for_details(pool_identifier))).uuid, + pool_identifier + ) end end end diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index 76745ae75..a2aedacce 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -17,12 +17,7 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission def create_child_stock_tubes api .specific_tube_creation - .create!( - user: user_uuid, - parents:, - child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: - ) + .create!(user: user_uuid, parents:, child_purposes: [purpose_uuid] * pool_uuids.length, tube_attributes:) .children .index_by(&:name) end diff --git a/app/models/labware_creators/quadrant_stamp_base.rb b/app/models/labware_creators/quadrant_stamp_base.rb index 1757dadc7..2cf134dc8 100644 --- a/app/models/labware_creators/quadrant_stamp_base.rb +++ b/app/models/labware_creators/quadrant_stamp_base.rb @@ -46,8 +46,9 @@ def source_plates_by_quadrant transfers.each do |transfer| target_well_location = transfer.dig(:new_target, :location) target_well_quadrant = WellHelpers.well_quadrant(target_well_location) - source_plates_uuids[target_well_quadrant] = transfer[:source_plate] if source_plates_uuids[target_well_quadrant] - .nil? + source_plates_uuids[target_well_quadrant] = transfer[:source_plate] if source_plates_uuids[ + target_well_quadrant + ].nil? end source_plates_uuids end diff --git a/app/models/robots/bed/invalid.rb b/app/models/robots/bed/invalid.rb index f707b1606..d881210d2 100644 --- a/app/models/robots/bed/invalid.rb +++ b/app/models/robots/bed/invalid.rb @@ -7,7 +7,8 @@ def initialize(barcode) @barcode = barcode end - def load(_plate_barcodes); end + def load(_plate_barcodes) + end def plate nil diff --git a/app/models/robots/bed/plate_to_tube_racks_bed.rb b/app/models/robots/bed/plate_to_tube_racks_bed.rb index 47fa24aa2..aa3d3c928 100644 --- a/app/models/robots/bed/plate_to_tube_racks_bed.rb +++ b/app/models/robots/bed/plate_to_tube_racks_bed.rb @@ -17,9 +17,7 @@ class PlateToTubeRacksBed < Robots::Bed::Base def labware_created_with_robot(robot_barcode) # RobotController uses machine barcode for initialising LabwareMetadata labware.tubes.each do |tube| - LabwareMetadata - .new(user_uuid:, barcode: tube.barcode.machine) - .update!(created_with_robot: robot_barcode) + LabwareMetadata.new(user_uuid:, barcode: tube.barcode.machine).update!(created_with_robot: robot_barcode) end end diff --git a/app/sequencescape/sequencescape/api/v2.rb b/app/sequencescape/sequencescape/api/v2.rb index 7891ecaa9..5b06efc3e 100644 --- a/app/sequencescape/sequencescape/api/v2.rb +++ b/app/sequencescape/sequencescape/api/v2.rb @@ -30,10 +30,7 @@ module Sequencescape::Api::V2 # @return [Sequencescape::V2::Api::Labware] Found labware object # def self.minimal_labware_by_barcode(barcode, select: :uuid) - Sequencescape::Api::V2::Labware - .where(barcode:) - .select(tube_racks: select, plates: select, tubes: select) - .first + Sequencescape::Api::V2::Labware.where(barcode:).select(tube_racks: select, plates: select, tubes: select).first end # sample_description added into includes here for use in bioscan plate label creation @@ -71,10 +68,7 @@ def self.plate_for_completion(uuid) end def self.tube_for_completion(uuid) - Tube - .includes('receptacle.aliquots.request.submission,receptacle.aliquots.request.request_type') - .find(uuid:) - .first + Tube.includes('receptacle.aliquots.request.submission,receptacle.aliquots.request.request_type').find(uuid:).first end def self.plate_with_custom_includes(include_params, search_params) diff --git a/app/sequencescape/sequencescape/api/v2/base.rb b/app/sequencescape/sequencescape/api/v2/base.rb index 2cb7a15e8..933fb5686 100644 --- a/app/sequencescape/sequencescape/api/v2/base.rb +++ b/app/sequencescape/sequencescape/api/v2/base.rb @@ -12,8 +12,12 @@ class SequencescapePaginator < JsonApiClient::Paginating::NestedParamPaginator # set the api base url in an abstract base class self.site = Limber::Application.config.api.v2.connection_options.url - connection.faraday.headers['X-Sequencescape-Client-Id'] = - Limber::Application.config.api.v2.connection_options.authorisation + connection.faraday.headers['X-Sequencescape-Client-Id'] = Limber::Application + .config + .api + .v2 + .connection_options + .authorisation self.plate = false self.tube = false self.paginator = SequencescapePaginator diff --git a/app/sequencescape/sequencescape/api/v2/receptacle.rb b/app/sequencescape/sequencescape/api/v2/receptacle.rb index b940df168..deb61afbc 100644 --- a/app/sequencescape/sequencescape/api/v2/receptacle.rb +++ b/app/sequencescape/sequencescape/api/v2/receptacle.rb @@ -11,7 +11,8 @@ def latest_molarity end def latest_qc(key:, units:) - qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work. + qc_results + .to_a # Convert to array to resolve any api queries. Otherwise select fails to work. .select { |qc| qc.key.casecmp(key).zero? } .select { |qc| qc.units.casecmp(units).zero? } .max_by(&:created_at) diff --git a/app/sequencescape/sequencescape/api/v2/well.rb b/app/sequencescape/sequencescape/api/v2/well.rb index 5b5a8b047..0cd141e8f 100644 --- a/app/sequencescape/sequencescape/api/v2/well.rb +++ b/app/sequencescape/sequencescape/api/v2/well.rb @@ -40,7 +40,8 @@ def latest_cell_viability end def latest_qc(key:, units:) - qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work. + qc_results + .to_a # Convert to array to resolve any api queries. Otherwise select fails to work. .select { |qc| qc.key.casecmp(key).zero? } .select { |qc| qc.units.casecmp(units).zero? } .max_by(&:created_at) diff --git a/lib/purpose_config.rb b/lib/purpose_config.rb index 7c94766b4..f08522d3f 100644 --- a/lib/purpose_config.rb +++ b/lib/purpose_config.rb @@ -109,14 +109,13 @@ def register! # maintains the behaviour of version 1, but includes an addditional # asset_shape option if configured. It raises an error if the purpose # cannot be created. - options_for_creation = - { - name:, - stock_plate: config.fetch(:stock_plate, false), - cherrypickable_target: config.fetch(:cherrypickable_target, false), - input_plate: config.fetch(:input_plate, false), - size: config.fetch(:size, 96) - }.merge(config.slice(:asset_shape)) + options_for_creation = { + name:, + stock_plate: config.fetch(:stock_plate, false), + cherrypickable_target: config.fetch(:cherrypickable_target, false), + input_plate: config.fetch(:input_plate, false), + size: config.fetch(:size, 96) + }.merge(config.slice(:asset_shape)) Sequencescape::Api::V2::PlatePurpose.create!(options_for_creation) end end diff --git a/lib/robot_configuration.rb b/lib/robot_configuration.rb index daabc102c..d17f7f711 100644 --- a/lib/robot_configuration.rb +++ b/lib/robot_configuration.rb @@ -32,13 +32,7 @@ def custom_robot(key, hash) end def bravo_robot(transition_to: 'passed', verify_robot: false, require_robot: false, &) - simple_robot( - 'bravo', - transition_to:, - verify_robot:, - require_robot:, - & - ) + simple_robot('bravo', transition_to:, verify_robot:, require_robot:, &) end def simple_robot(type, transition_to: 'passed', verify_robot: false, require_robot: false, &) diff --git a/lib/tasks/config.rake b/lib/tasks/config.rake index 75630953a..cbfafcba1 100644 --- a/lib/tasks/config.rake +++ b/lib/tasks/config.rake @@ -48,8 +48,10 @@ namespace :config do # TODO: Y24-190 - Remove this once we have moved everything else over to V2; # also the config entries for :searches puts 'Preparing searches ...' - configuration[:searches] = - api.search.all.each_with_object({}) { |search, searches| searches[search.name] = search.uuid } + configuration[:searches] = api + .search + .all + .each_with_object({}) { |search, searches| searches[search.name] = search.uuid } puts 'Preparing transfer templates ...' query = Sequencescape::Api::V2::TransferTemplate.select(:uuid, :name).paginate(per_page: 100) @@ -65,14 +67,14 @@ namespace :config do default_count: 2 } - configuration[:purposes] = - {}.tap do |labware_purposes| - puts 'Preparing purpose configs...' - purpose_config.each { |purpose| labware_purposes[purpose.uuid] = purpose.config } - end + configuration[:purposes] = {}.tap do |labware_purposes| + puts 'Preparing purpose configs...' + purpose_config.each { |purpose| labware_purposes[purpose.uuid] = purpose.config } + end - configuration[:purpose_uuids] = - tracked_purposes.each_with_object({}) { |purpose, store| store[purpose.name] = purpose.uuid } + configuration[:purpose_uuids] = tracked_purposes.each_with_object({}) do |purpose, store| + store[purpose.name] = purpose.uuid + end configuration[:robots] = ROBOT_CONFIG diff --git a/limber.sublime-project b/limber.sublime-project index ff819a7c3..4f8e6d07c 100644 --- a/limber.sublime-project +++ b/limber.sublime-project @@ -22,12 +22,12 @@ "*.swf", "*.jar", "*.zip", - "*.xls" - ] + "*.xls", + ], }, { - "path": "coverage" - } + "path": "coverage", + }, ], // These settings will be applied to anyone working // on the project. They are intended to set up the accepted @@ -35,6 +35,6 @@ "settings": { "tab_size": 2, "translate_tabs_to_spaces": true, - "trim_trailing_white_space_on_save": true - } + "trim_trailing_white_space_on_save": true, + }, } diff --git a/public/404.html b/public/404.html index c5194504f..68d177fa2 100644 --- a/public/404.html +++ b/public/404.html @@ -1,4 +1,4 @@ - + The page you were looking for doesn't exist (404) diff --git a/public/422.html b/public/422.html index d16dd7f62..9e9cf0df2 100644 --- a/public/422.html +++ b/public/422.html @@ -1,4 +1,4 @@ - + The change you wanted was rejected (422) diff --git a/public/500.html b/public/500.html index 5a03944b5..0fc2fcef7 100644 --- a/public/500.html +++ b/public/500.html @@ -1,4 +1,4 @@ - + We're sorry, but something went wrong (500) diff --git a/public/502.html b/public/502.html index b5082d265..6f09738ed 100644 --- a/public/502.html +++ b/public/502.html @@ -1,4 +1,4 @@ - + We're sorry, but something went wrong (502) diff --git a/public/504.html b/public/504.html index 95e94d118..c8927e613 100644 --- a/public/504.html +++ b/public/504.html @@ -1,4 +1,4 @@ - + We're sorry, but something took too long (504) diff --git a/spec/controllers/exports_controller_spec.rb b/spec/controllers/exports_controller_spec.rb index 2492d5a68..bd2013c92 100644 --- a/spec/controllers/exports_controller_spec.rb +++ b/spec/controllers/exports_controller_spec.rb @@ -63,9 +63,10 @@ context 'on generating a csv' do before do - expect(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(includes, barcode: plate_barcode) - .and_return(plate) + expect(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + includes, + barcode: plate_barcode + ).and_return(plate) end context 'where csv id requested is concentrations_ngul.csv' do @@ -318,9 +319,10 @@ before do # Make the controller to receive the plate. # NB. Uses plate_includes if specified in the export configuration. - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(export.plate_includes, barcode: plate_barcode) - .and_return(plate) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + export.plate_includes, + barcode: plate_barcode + ).and_return(plate) # Make the controller to use the export loaded from fixture config. allow(subject).to receive(:export).and_return(export) @@ -334,16 +336,17 @@ asset_ancestors = ancestor_plates.map { |ancestor_plate| double('Sequencescape::Api::V2::Asset', id: ancestor_plate.id) } - allow(plate).to receive_message_chain(:ancestors, :where) - .with(purpose_name: export.ancestor_purpose) - .and_return(asset_ancestors) + allow(plate).to receive_message_chain(:ancestors, :where).with(purpose_name: export.ancestor_purpose).and_return( + asset_ancestors + ) # Stub the plate_with_custom_includes query to return the first ancestor plate. # NB. This stub is required to make the other methods in the show controller # action not to fail when they try to receive the first ancestor plate. - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(export.plate_includes, id: asset_ancestors.first.id) - .and_return(ancestor_plates.first) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + export.plate_includes, + id: asset_ancestors.first.id + ).and_return(ancestor_plates.first) # Stub the plate query to return ancestor plates. builder = double('JsonApiClient::Query::Builder') diff --git a/spec/controllers/plates_controller_spec.rb b/spec/controllers/plates_controller_spec.rb index c109524ee..27a3e5c02 100644 --- a/spec/controllers/plates_controller_spec.rb +++ b/spec/controllers/plates_controller_spec.rb @@ -83,19 +83,7 @@ def expect_state_change_create(attributes) reason: 'Individual Well Failure' ) - post :fail_wells, - params: { - id: plate_uuid, - plate: { - wells: { - 'A1' => 1, - 'B1' => 0 - } - } - }, - session: { - user_uuid: - } + post :fail_wells, params: { id: plate_uuid, plate: { wells: { 'A1' => 1, 'B1' => 0 } } }, session: { user_uuid: } expect(response).to redirect_to(limber_plate_path(plate_uuid)) end diff --git a/spec/controllers/qc_files_controller_spec.rb b/spec/controllers/qc_files_controller_spec.rb index d2a97f533..08a27646c 100644 --- a/spec/controllers/qc_files_controller_spec.rb +++ b/spec/controllers/qc_files_controller_spec.rb @@ -12,14 +12,12 @@ before do stub_api_get(file_uuid, body: json(:qc_file, uuid: file_uuid, filename:)) - stub_request(:get, api_url_for(file_uuid)) - .with(headers: { 'Accept' => 'sequencescape/qc_file' }) - .to_return( - body: 'example file content', - headers: { - 'Content-Disposition' => "attachment; filename=\"#{filename}\"" - } - ) + stub_request(:get, api_url_for(file_uuid)).with(headers: { 'Accept' => 'sequencescape/qc_file' }).to_return( + body: 'example file content', + headers: { + 'Content-Disposition' => "attachment; filename=\"#{filename}\"" + } + ) end it 'returns a file' do @@ -39,21 +37,19 @@ let(:plate_uuid) { 'plate-uuid' } let(:stub_post) do - stub_request(:post, api_url_for(plate_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="test_file.txt"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'test_file.txt'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(plate_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="test_file.txt"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'test_file.txt'), + headers: { + 'content-type' => 'application/json' + } + ) end before do diff --git a/spec/controllers/tube_creation_controller_spec.rb b/spec/controllers/tube_creation_controller_spec.rb index 7e486018b..049073624 100644 --- a/spec/controllers/tube_creation_controller_spec.rb +++ b/spec/controllers/tube_creation_controller_spec.rb @@ -23,14 +23,7 @@ describe '#new' do it 'creates a tube from a tube parent' do - get :new, - params: { - limber_tube_id: parent_uuid, - purpose_uuid: child_purpose_uuid - }, - session: { - user_uuid: - } + get :new, params: { limber_tube_id: parent_uuid, purpose_uuid: child_purpose_uuid }, session: { user_uuid: } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) expect(assigns(:labware_creator).user_uuid).to eq(user_uuid) @@ -38,14 +31,7 @@ end it 'creates a tube from a plate parent' do - get :new, - params: { - limber_plate_id: parent_uuid, - purpose_uuid: child_purpose_uuid - }, - session: { - user_uuid: - } + get :new, params: { limber_plate_id: parent_uuid, purpose_uuid: child_purpose_uuid }, session: { user_uuid: } expect(response).to render_template('new') expect(assigns(:labware_creator).parent_uuid).to eq(parent_uuid) expect(assigns(:labware_creator).user_uuid).to eq(user_uuid) diff --git a/spec/controllers/tubes/tubes_exports_controller_spec.rb b/spec/controllers/tubes/tubes_exports_controller_spec.rb index 365f41e70..e32037013 100644 --- a/spec/controllers/tubes/tubes_exports_controller_spec.rb +++ b/spec/controllers/tubes/tubes_exports_controller_spec.rb @@ -29,9 +29,11 @@ context 'on generating a csv' do before do - expect(Sequencescape::Api::V2).to receive(:tube_with_custom_includes) - .with(includes, selects, barcode: tube_barcode) - .and_return(tube) + expect(Sequencescape::Api::V2).to receive(:tube_with_custom_includes).with( + includes, + selects, + barcode: tube_barcode + ).and_return(tube) end context 'where tsv id requested is bioscan_mbrave.tsv' do diff --git a/spec/factories/plate_factories.rb b/spec/factories/plate_factories.rb index ce72cbfe1..b4cd3cc6c 100644 --- a/spec/factories/plate_factories.rb +++ b/spec/factories/plate_factories.rb @@ -355,21 +355,20 @@ pooled_wells = wells.reject { |w| empty_wells.include?(w) } pool_hash = {} pool_sizes.each_with_index do |pool_size, index| - pool_hash["pool-#{index + 1}-uuid"] = - { - 'wells' => pooled_wells.shift(pool_size).sort_by { |well| WellHelpers.row_order(size).index(well) }, - 'insert_size' => { - from: 100, - to: 300 - }, - 'library_type' => { - name: library_type - }, - 'request_type' => request_type, - 'pcr_cycles' => pool_prc_cycles[index], - 'for_multiplexing' => pool_for_multiplexing[index], - 'pool_complete' => pool_complete - }.merge(extra_pool_info) + pool_hash["pool-#{index + 1}-uuid"] = { + 'wells' => pooled_wells.shift(pool_size).sort_by { |well| WellHelpers.row_order(size).index(well) }, + 'insert_size' => { + from: 100, + to: 300 + }, + 'library_type' => { + name: library_type + }, + 'request_type' => request_type, + 'pcr_cycles' => pool_prc_cycles[index], + 'for_multiplexing' => pool_for_multiplexing[index], + 'pool_complete' => pool_complete + }.merge(extra_pool_info) end pool_hash end diff --git a/spec/factories/poly_metadata_factories.rb b/spec/factories/poly_metadata_factories.rb index 754d5bc01..f92dd7ab4 100644 --- a/spec/factories/poly_metadata_factories.rb +++ b/spec/factories/poly_metadata_factories.rb @@ -12,7 +12,8 @@ after(:build) do |poly_metadatum, evaluator| poly_metadatum.relationships.metadatable = { - 'links' => {}, + 'links' => { + }, 'data' => { 'type' => 'Request', 'id' => evaluator.metadatable.id diff --git a/spec/factories/purpose_config_factories.rb b/spec/factories/purpose_config_factories.rb index 943eafab3..35f9e2147 100644 --- a/spec/factories/purpose_config_factories.rb +++ b/spec/factories/purpose_config_factories.rb @@ -238,11 +238,13 @@ { 'Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => {} + 'request_options' => { + } }, 'Another Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => {} + 'request_options' => { + } } } end @@ -267,14 +269,7 @@ # Configuration to set number_of_source_wells argument factory :pooled_wells_by_sample_in_groups_purpose_config do transient { number_of_source_wells { 2 } } - creator_class do - { - name: 'LabwareCreators::PooledWellsBySampleInGroups', - args: { - number_of_source_wells: - } - } - end + creator_class { { name: 'LabwareCreators::PooledWellsBySampleInGroups', args: { number_of_source_wells: } } } end factory :multi_stamp_tubes_using_tube_rack_scan_purpose_config do diff --git a/spec/factories/strategies/api_strategy.rb b/spec/factories/strategies/api_strategy.rb index 588c984fb..79432b1d6 100644 --- a/spec/factories/strategies/api_strategy.rb +++ b/spec/factories/strategies/api_strategy.rb @@ -11,7 +11,8 @@ def initialize delegate :association, to: :@strategy - def result(evaluation); end + def result(evaluation) + end end FactoryBot.register_strategy(:api_object, ApiStrategy) diff --git a/spec/factories/tube_factories.rb b/spec/factories/tube_factories.rb index ec5589e4b..78909e056 100644 --- a/spec/factories/tube_factories.rb +++ b/spec/factories/tube_factories.rb @@ -112,9 +112,7 @@ request_factory { :library_request } aliquot_count { 2 } aliquot_factory { :v2_tagged_aliquot } - aliquots do - create_list aliquot_factory, aliquot_count, library_state:, outer_request: - end + aliquots { create_list aliquot_factory, aliquot_count, library_state:, outer_request: } parents { [] } purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } @@ -180,9 +178,7 @@ tube_factory { :multiplexed_library_tube } study_count { 1 } end - children do - Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } - end + children { Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } } end factory :tube_collection_with_barcodes_specified do diff --git a/spec/factories/tube_rack_factories.rb b/spec/factories/tube_rack_factories.rb index ef18b454b..cabb37717 100644 --- a/spec/factories/tube_rack_factories.rb +++ b/spec/factories/tube_rack_factories.rb @@ -20,9 +20,7 @@ purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } tubes { {} } - racked_tubes do - tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } - end + racked_tubes { tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } } end id diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 8066a81ae..2d4e50aed 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -196,13 +196,7 @@ associated(:empty_well, location:, uuid: "example-well-uuid-#{i}") else state = custom_state[location] || default_state - associated( - :well, - location:, - uuid: "example-well-uuid-#{i}", - state:, - aliquot_factory: - ) + associated(:well, location:, uuid: "example-well-uuid-#{i}", state:, aliquot_factory:) end end end diff --git a/spec/features/charge_and_pass_libraries_spec.rb b/spec/features/charge_and_pass_libraries_spec.rb index 997902ce5..1ad692cf3 100644 --- a/spec/features/charge_and_pass_libraries_spec.rb +++ b/spec/features/charge_and_pass_libraries_spec.rb @@ -10,9 +10,7 @@ let(:user_swipecard) { 'abcdef' } let(:labware_barcode) { SBCF::SangerBarcode.new(prefix: 'DN', number: 1).machine_barcode.to_s } let(:labware_uuid) { SecureRandom.uuid } - let(:work_completion_request) do - { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } - end + let(:work_completion_request) { { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } } let(:work_completion) { json :work_completion } let(:template_uuid) { SecureRandom.uuid } @@ -52,14 +50,7 @@ end context 'tube with submissions to be made' do - before do - create :passable_tube, - submission: { - request_options:, - template_uuid: - }, - uuid: 'example-purpose-uuid' - end + before { create :passable_tube, submission: { request_options:, template_uuid: }, uuid: 'example-purpose-uuid' } let(:submissions) { [] } let(:request_options) { { read_length: '150' } } let(:labware_barcode) { example_tube_v2.labware_barcode.machine } diff --git a/spec/features/creating_a_plate_spec.rb b/spec/features/creating_a_plate_spec.rb index 6e9bf6084..a3eeec60f 100644 --- a/spec/features/creating_a_plate_spec.rb +++ b/spec/features/creating_a_plate_spec.rb @@ -33,11 +33,7 @@ end let(:another_plate) do - create :v2_stock_plate, - barcode_number: 106, - uuid: another_plate_uuid, - wells:, - purpose_name: 'Limber Cherrypicked' + create :v2_stock_plate, barcode_number: 106, uuid: another_plate_uuid, wells:, purpose_name: 'Limber Cherrypicked' end let(:alternative_plate) do @@ -125,9 +121,9 @@ allow(child_plate).to receive(:stock_plates).and_return(stock_plates) allow(child_plate).to receive(:stock_plate).and_return(stock_plates.last) allow(child_plate).to receive(:ancestors).and_return(ancestors_scope) - allow(ancestors_scope).to receive(:where) - .with(purpose_name: alternative_purpose_name) - .and_return([alternative_plate]) + allow(ancestors_scope).to receive(:where).with(purpose_name: alternative_purpose_name).and_return( + [alternative_plate] + ) allow(job).to receive(:save).and_return(true) allow(PMB::PrintJob).to receive(:new) do |args| diff --git a/spec/features/creating_a_tag_plate_spec.rb b/spec/features/creating_a_tag_plate_spec.rb index 2ca63e57e..79aa1b37d 100644 --- a/spec/features/creating_a_tag_plate_spec.rb +++ b/spec/features/creating_a_tag_plate_spec.rb @@ -49,10 +49,12 @@ background do # Set-up the plate config create :purpose_config, uuid: 'stock-plate-purpose-uuid', name: 'Limber Cherrypicked' - create(:tagged_purpose_config, - tag_layout_templates: acceptable_templates, - uuid: child_purpose_uuid, - enforce_same_template_within_pool:) + create( + :tagged_purpose_config, + tag_layout_templates: acceptable_templates, + uuid: child_purpose_uuid, + enforce_same_template_within_pool: + ) create :pipeline, relationships: { 'Limber Cherrypicked' => 'Tag Purpose' } # We look up the user diff --git a/spec/features/failing_quadrants_spec.rb b/spec/features/failing_quadrants_spec.rb index d063e42e2..dbd1fe632 100644 --- a/spec/features/failing_quadrants_spec.rb +++ b/spec/features/failing_quadrants_spec.rb @@ -20,12 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, - uuid: plate_uuid, - purpose_uuid: 'stock-plate-purpose-uuid', - state: 'passed', - wells:, - size: 384 + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells:, size: 384 end let(:state_change_attributes) do diff --git a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb index 04cb0e4cb..f697ec3b6 100644 --- a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb @@ -135,12 +135,7 @@ expect_api_v2_posts( 'Transfer', [plate_uuid, plate_uuid_2].map do |source_uuid| - { - user_uuid:, - source_uuid:, - destination_uuid: 'tube-0', - transfer_template_uuid: 'whole-plate-to-tube' - } + { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } end ) diff --git a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb index ce4e25992..40a593e30 100644 --- a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb @@ -145,22 +145,21 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with( - include_used: false, - purpose_name: ['example-purpose'], - includes: 'purpose', - paginate: { - size: 30, - number: 1 - } - ) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + include_used: false, + purpose_name: ['example-purpose'], + includes: 'purpose', + paginate: { + size: 30, + number: 1 + } + ).and_return([example_v2_tube, example_v2_tube2]) # Parent lookup - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with(barcode: [tube_barcode_1, tube_barcode_2], includes: []) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + barcode: [tube_barcode_1, tube_barcode_2], + includes: [] + ).and_return([example_v2_tube, example_v2_tube2]) # Allow parent plates to be found in API v2 stub_v2_plate(parent_1, stub_search: false) @@ -186,22 +185,21 @@ stub_v2_tube(example_v2_tube2) # Available tubes search - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with( - include_used: false, - purpose_name: ['example-purpose'], - includes: 'purpose', - paginate: { - size: 30, - number: 1 - } - ) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + include_used: false, + purpose_name: ['example-purpose'], + includes: 'purpose', + paginate: { + size: 30, + number: 1 + } + ).and_return([example_v2_tube, example_v2_tube2]) # Parent lookup - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with(barcode: [tube_barcode_1, tube_barcode_2], includes: []) - .and_return([example_v2_tube, example_v2_tube2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with( + barcode: [tube_barcode_1, tube_barcode_2], + includes: [] + ).and_return([example_v2_tube, example_v2_tube2]) # Old API still used when loading parent stub_api_get(tube_uuid, body: example_tube) diff --git a/spec/features/viewing_a_plate_spec.rb b/spec/features/viewing_a_plate_spec.rb index 222acfb29..db1a0ccf9 100644 --- a/spec/features/viewing_a_plate_spec.rb +++ b/spec/features/viewing_a_plate_spec.rb @@ -12,12 +12,7 @@ let(:state) { 'pending' } let(:purpose_uuid) { 'stock-plate-purpose-uuid' } let(:example_plate) do - create :v2_stock_plate, - uuid: plate_uuid, - barcode_number: 1, - state:, - wells: wells_collection, - purpose_uuid: + create :v2_stock_plate, uuid: plate_uuid, barcode_number: 1, state:, wells: wells_collection, purpose_uuid: end let(:wells_collection) { %w[A1 B1].map { |loc| create(:v2_well, state:, position: { 'name' => loc }) } } let(:printer_list) { create_list(:v2_tube_barcode_printer, 2) + create_list(:v2_plate_barcode_printer, 2) } diff --git a/spec/helpers/barcode_labels_helper_spec.rb b/spec/helpers/barcode_labels_helper_spec.rb index 4fabe3f3d..be355d26e 100644 --- a/spec/helpers/barcode_labels_helper_spec.rb +++ b/spec/helpers/barcode_labels_helper_spec.rb @@ -22,20 +22,12 @@ end it 'renders a partial' do - barcode_printing_form( - labels:, - redirection_url:, - default_printer_name: - ) + barcode_printing_form(labels:, redirection_url:, default_printer_name:) expect(rendered).to be_truthy end it 'has the right locals set' do - barcode_printing_form( - labels:, - redirection_url:, - default_printer_name: - ) + barcode_printing_form(labels:, redirection_url:, default_printer_name:) printer_types = labels.map(&:printer_type) printers = @printers.select { |printer| printer_types.include?(printer.barcode_type) } diff --git a/spec/helpers/plate_helpers_spec.rb b/spec/helpers/plate_helpers_spec.rb index df6be63cc..d39590660 100644 --- a/spec/helpers/plate_helpers_spec.rb +++ b/spec/helpers/plate_helpers_spec.rb @@ -66,9 +66,7 @@ ] end - let(:plate_for_precap) do - build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: - end + let(:plate_for_precap) { build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: } let(:expected_result) do [ diff --git a/spec/models/labware_creators/concentration_binned_plate_spec.rb b/spec/models/labware_creators/concentration_binned_plate_spec.rb index faba3bdef..0528e6604 100644 --- a/spec/models/labware_creators/concentration_binned_plate_spec.rb +++ b/spec/models/labware_creators/concentration_binned_plate_spec.rb @@ -85,10 +85,12 @@ let(:user_uuid) { 'user-uuid' } before do - create(:concentration_binning_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create( + :concentration_binning_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name: + ) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/concentration_normalised_plate_spec.rb b/spec/models/labware_creators/concentration_normalised_plate_spec.rb index dfb7dcd44..8ae7238fe 100644 --- a/spec/models/labware_creators/concentration_normalised_plate_spec.rb +++ b/spec/models/labware_creators/concentration_normalised_plate_spec.rb @@ -115,9 +115,9 @@ it 'makes the expected requests' do # NB. qc assay post is done using v2 Api, whereas plate creation and transfers posts are using v1 Api - expect(Sequencescape::Api::V2::QcAssay).to receive(:create) - .with(qc_results: dest_well_qc_attributes) - .and_return(true) + expect(Sequencescape::Api::V2::QcAssay).to receive(:create).with( + qc_results: dest_well_qc_attributes + ).and_return(true) expect(subject.save!).to eq true expect(plate_creation_request).to have_been_made expect(transfer_creation_request).to have_been_made diff --git a/spec/models/labware_creators/custom_pooled_tubes_spec.rb b/spec/models/labware_creators/custom_pooled_tubes_spec.rb index 5545c6188..2f6b027f9 100644 --- a/spec/models/labware_creators/custom_pooled_tubes_spec.rb +++ b/spec/models/labware_creators/custom_pooled_tubes_spec.rb @@ -56,21 +56,19 @@ let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, file: } } let(:stub_qc_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="robot_pooling_file.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'pooling_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="robot_pooling_file.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'pooling_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:tube_creation_request_uuid) { SecureRandom.uuid } diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 4db2cfda0..db926109c 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -132,14 +132,7 @@ def expect_transfer_creation def expect_state_change_creation expect_api_v2_posts( 'StateChange', - [ - { - reason: 'Used in Library creation', - target_uuid: tag_plate_uuid, - target_state: 'exhausted', - user_uuid: - } - ] + [{ reason: 'Used in Library creation', target_uuid: tag_plate_uuid, target_state: 'exhausted', user_uuid: }] ) end @@ -163,7 +156,8 @@ def expect_state_change_creation direction: 'column', walking_by: 'manual by plate', initial_tag: '1', - substitutions: {}, + substitutions: { + }, tags_per_well: 1 } } diff --git a/spec/models/labware_creators/donor_pooling_spec.rb b/spec/models/labware_creators/donor_pooling_spec.rb index f1cea5e51..e44afaf62 100644 --- a/spec/models/labware_creators/donor_pooling_spec.rb +++ b/spec/models/labware_creators/donor_pooling_spec.rb @@ -67,16 +67,13 @@ create(:donor_pooling_config) # Create the plate purpose config and add to Settings. - create( - :donor_pooling_plate_purpose_config, - uuid: child_purpose_uuid, - default_number_of_pools: - ) + create(:donor_pooling_plate_purpose_config, uuid: child_purpose_uuid, default_number_of_pools:) # Allow the API call to return two plates by default. - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return(source_plates) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return(source_plates) end describe '.attributes' do @@ -590,9 +587,10 @@ describe '#source_barcodes_must_be_different' do before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] * 2 } it 'reports the error' do @@ -611,9 +609,10 @@ [well] end before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] } it 'allows plate creation' do @@ -626,9 +625,10 @@ describe '#source_plates_must_exist' do let(:barcodes) { [parent_1_plate.human_barcode, 'NOT-A-PLATE-BARCODE'] } before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end it 'reports the error' do expect(subject).not_to be_valid diff --git a/spec/models/labware_creators/final_tube_from_plate_spec.rb b/spec/models/labware_creators/final_tube_from_plate_spec.rb index bea569281..bee607d05 100644 --- a/spec/models/labware_creators/final_tube_from_plate_spec.rb +++ b/spec/models/labware_creators/final_tube_from_plate_spec.rb @@ -35,13 +35,7 @@ it 'pools by submission' do expect_api_v2_posts( 'Transfer', - [ - { - user_uuid:, - source_uuid: parent_uuid, - transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' - } - ], + [{ user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' }], [transfer] ) diff --git a/spec/models/labware_creators/fixed_normalised_plate_spec.rb b/spec/models/labware_creators/fixed_normalised_plate_spec.rb index 521c84180..c0cdfd840 100644 --- a/spec/models/labware_creators/fixed_normalised_plate_spec.rb +++ b/spec/models/labware_creators/fixed_normalised_plate_spec.rb @@ -85,10 +85,7 @@ let(:user_uuid) { 'user-uuid' } before do - create(:fixed_normalisation_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create(:fixed_normalisation_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( diff --git a/spec/models/labware_creators/merged_plate_spec.rb b/spec/models/labware_creators/merged_plate_spec.rb index f80d4481c..eaedb49fa 100644 --- a/spec/models/labware_creators/merged_plate_spec.rb +++ b/spec/models/labware_creators/merged_plate_spec.rb @@ -81,12 +81,10 @@ describe '#save!' do before do allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with( - { barcode: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] }, - includes: plate_includes - ) - .and_return([source_plate_1, source_plate_2]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_2]) ) end @@ -209,9 +207,10 @@ ) stub_v2_plate(source_plate_3, stub_search: false) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1, source_plate_3]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_3]) ) end @@ -251,9 +250,10 @@ ) stub_v2_plate(source_plate_3, stub_search: false) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1, source_plate_3]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_3]) ) end @@ -262,12 +262,7 @@ context 'with a missing barcode' do let(:form_attributes) do - { - purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, - barcodes: [source_plate_1.barcode.machine, ''] - } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, barcodes: [source_plate_1.barcode.machine, ''] } end before do @@ -279,9 +274,9 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1]) + receive(:find_all).with({ barcode: [source_plate_1.barcode.machine] }, includes: plate_includes).and_return( + [source_plate_1] + ) ) end @@ -309,9 +304,10 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1]) ) end @@ -349,9 +345,10 @@ source_purposes: ['Source 1 Purpose', 'Source 2 Purpose'] ) allow(Sequencescape::Api::V2::Plate).to( - receive(:find_all) - .with({ barcode: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] }, includes: plate_includes) - .and_return([source_plate_1, source_plate_4]) + receive(:find_all).with( + { barcode: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] }, + includes: plate_includes + ).and_return([source_plate_1, source_plate_4]) ) end diff --git a/spec/models/labware_creators/multi_stamp_tubes_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_spec.rb index a32ee3206..aefd4d001 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_spec.rb @@ -207,9 +207,9 @@ body: json(:v1_custom_metadatum_collection) ) - expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells) - .with(child_uuid) - .and_return(child_plate_v2) + expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells).with(child_uuid).and_return( + child_plate_v2 + ) expect(subject).to receive(:source_tube_outer_request_uuid).with(parent1).and_return('outer-request-1') expect(subject).to receive(:source_tube_outer_request_uuid).with(parent2).and_return('outer-request-2') end diff --git a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb index 00e0975b1..1984cbd17 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb @@ -132,21 +132,19 @@ end let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:child_plate_v1) do @@ -155,12 +153,14 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: 'AB10000001', includes: tube_includes) - .and_return(parent_tube_1) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: 'AB10000002', includes: tube_includes) - .and_return(parent_tube_2) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( + barcode: 'AB10000001', + includes: tube_includes + ).and_return(parent_tube_1) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( + barcode: 'AB10000002', + includes: tube_includes + ).and_return(parent_tube_2) stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) @@ -284,9 +284,10 @@ subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: 'AB10000003', includes: tube_includes) - .and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with( + barcode: 'AB10000003', + includes: tube_includes + ).and_return(nil) subject.validate end diff --git a/spec/models/labware_creators/normalised_binned_plate_spec.rb b/spec/models/labware_creators/normalised_binned_plate_spec.rb index 158dcee46..bd3ce6b87 100644 --- a/spec/models/labware_creators/normalised_binned_plate_spec.rb +++ b/spec/models/labware_creators/normalised_binned_plate_spec.rb @@ -85,10 +85,7 @@ let(:user_uuid) { 'user-uuid' } before do - create(:normalised_binning_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create(:normalised_binning_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb index b702bcba3..6ffabb72e 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb @@ -272,26 +272,22 @@ content end - let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } - end + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="duplex_seq_customer_file.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'duplex_seq_dil_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="duplex_seq_customer_file.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'duplex_seq_dil_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:stub_parent_request) { stub_api_get(parent_uuid, body: parent_plate_v1) } @@ -299,10 +295,12 @@ before do stub_parent_request - create(:duplex_seq_customer_csv_file_upload_purpose_config, - uuid: child_purpose_uuid, - name: child_purpose_name, - library_type_name:) + create( + :duplex_seq_customer_csv_file_upload_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name: + ) stub_v2_plate( parent_plate, diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb index 15cfa9180..610bd8195 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb @@ -308,26 +308,22 @@ content end - let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } - end + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="targeted_nano_seq_customer_file.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'targeted_nano_seq_dil_file.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="targeted_nano_seq_customer_file.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'targeted_nano_seq_dil_file.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end let(:stub_parent_request) { stub_api_get(parent_uuid, body: parent_plate_v1) } diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 6dfe9e4d5..cedabd678 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -112,9 +112,7 @@ let(:parent_v1) { json :plate_with_metadata, uuid: parent_uuid, barcode_number: 6, qc_files_actions: %w[read create] } # form attributes - required parameters for the labware creator - let(:form_attributes) do - { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } - end + let(:form_attributes) { { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } } # child tubes for lookup after creation let(:child_tube_1_uuid) { SecureRandom.uuid } @@ -267,12 +265,7 @@ context 'when require_sequencing_tubes_only? is true' do let(:form_attributes) do - { - user_uuid:, - purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, - sequencing_file: - } + { user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, parent_uuid:, sequencing_file: } end before do @@ -611,9 +604,9 @@ context 'when the tube barcode already exists in the LIMS' do before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_by) - .with(barcode: foreign_barcode) - .and_return(existing_tube) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: foreign_barcode).and_return( + existing_tube + ) end it 'adds an error to the errors collection' do @@ -720,21 +713,19 @@ # stub the contingency file upload let!(:stub_contingency_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: contingency_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_contingency_tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_contingency_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: contingency_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_contingency_tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_contingency_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # body for stubbing the sequencing file upload @@ -746,21 +737,19 @@ # stub the sequencing file upload let!(:stub_sequencing_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: sequencing_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: sequencing_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # stub the sequencing tube creation @@ -1014,12 +1003,7 @@ context 'with just a sequencing file' do let(:form_attributes) do - { - user_uuid:, - purpose_uuid: child_sequencing_tube_purpose_uuid, - parent_uuid:, - sequencing_file: - } + { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid:, sequencing_file: } end # body for stubbing the sequencing file upload @@ -1031,21 +1015,19 @@ # stub the sequencing file upload let!(:stub_sequencing_file_upload) do - stub_request(:post, api_url_for(parent_uuid, 'qc_files')) - .with( - body: sequencing_file_content, - headers: { - 'Content-Type' => 'sequencescape/qc_file', - 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' - } - ) - .to_return( - status: 201, - body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), - headers: { - 'content-type' => 'application/json' - } - ) + stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( + body: sequencing_file_content, + headers: { + 'Content-Type' => 'sequencescape/qc_file', + 'Content-Disposition' => 'form-data; filename="scrna_core_sequencing_tube_rack_scan.csv"' + } + ).to_return( + status: 201, + body: json(:qc_file, filename: 'scrna_core_sequencing_tube_rack_scan.csv'), + headers: { + 'content-type' => 'application/json' + } + ) end # stub the sequencing tube creation diff --git a/spec/models/labware_creators/plate_with_template_spec.rb b/spec/models/labware_creators/plate_with_template_spec.rb index 4cf1c9595..69605de82 100644 --- a/spec/models/labware_creators/plate_with_template_spec.rb +++ b/spec/models/labware_creators/plate_with_template_spec.rb @@ -60,14 +60,7 @@ it 'makes the expected requests' do expect_api_v2_posts( 'Transfer', - [ - { - user_uuid:, - source_uuid: parent_uuid, - destination_uuid: 'child-uuid', - transfer_template_uuid: - } - ] + [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: 'child-uuid', transfer_template_uuid: }] ) expect(subject.save!).to eq true diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb index ac223c108..bb2ee40a4 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb @@ -49,9 +49,7 @@ describe '#save!' do has_a_working_api - let(:form_attributes) do - { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } - end + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } } let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -90,12 +88,7 @@ expect_api_v2_posts( 'Transfer', [parent_uuid, parent2_uuid, parent3_uuid, parent4_uuid].map do |source_uuid| - { - user_uuid:, - source_uuid:, - destination_uuid: 'tube-0', - transfer_template_uuid: 'whole-plate-to-tube' - } + { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } end ) diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb index 67117c8f1..ee8183163 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb @@ -32,14 +32,7 @@ end before do - create :purpose_config, - submission: { - template_uuid:, - request_options: { - read_length: 150 - } - }, - uuid: purpose_uuid + create :purpose_config, submission: { template_uuid:, request_options: { read_length: 150 } }, uuid: purpose_uuid end describe '#new' do @@ -52,9 +45,7 @@ describe '#save!' do has_a_working_api - let(:form_attributes) do - { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } - end + let(:form_attributes) { { user_uuid:, purpose_uuid:, parent_uuid:, barcodes: } } let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -99,9 +90,9 @@ end before do - allow(Sequencescape::Api::V2::Tube).to receive(:find_all) - .with(barcode: barcodes, includes: []) - .and_return([parent, parent2]) + allow(Sequencescape::Api::V2::Tube).to receive(:find_all).with(barcode: barcodes, includes: []).and_return( + [parent, parent2] + ) tube_creation_request tube_creation_children_request diff --git a/spec/models/labware_creators/quadrant_split_plate_spec.rb b/spec/models/labware_creators/quadrant_split_plate_spec.rb index 3db6aa215..c96a1026e 100644 --- a/spec/models/labware_creators/quadrant_split_plate_spec.rb +++ b/spec/models/labware_creators/quadrant_split_plate_spec.rb @@ -130,9 +130,10 @@ before do create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid) - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ uuid: %w[child-a-uuid child-b-uuid child-c-uuid child-d-uuid] }, includes: ['wells']) - .and_return([child_plate_a, child_plate_b, child_plate_c, child_plate_d]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { uuid: %w[child-a-uuid child-b-uuid child-c-uuid child-d-uuid] }, + includes: ['wells'] + ).and_return([child_plate_a, child_plate_b, child_plate_c, child_plate_d]) stub_v2_plate(plate, stub_search: false) end diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index 34a41d541..4ed83099e 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -310,9 +310,10 @@ stub_api_get('asset-uuid', body: child_plate_v1) metadata = - attributes_for(:v1_custom_metadatum_collection) - .fetch(:metadata, {}) - .merge(stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human) + attributes_for(:v1_custom_metadatum_collection).fetch(:metadata, {}).merge( + stock_barcode_q0: stock_plate1.barcode.human, + stock_barcode_q1: stock_plate2.barcode.human + ) stub_api_put( 'custom_metadatum_collection-uuid', diff --git a/spec/models/labware_creators/shared_examples.rb b/spec/models/labware_creators/shared_examples.rb index 26d4e814b..6de6977a3 100644 --- a/spec/models/labware_creators/shared_examples.rb +++ b/spec/models/labware_creators/shared_examples.rb @@ -266,9 +266,9 @@ it 'makes the expected requests' do # NB. qc assay post is done using v2 Api, whereas plate creation and transfers posts are using v1 Api - expect(Sequencescape::Api::V2::QcAssay).to receive(:create) - .with(qc_results: dest_well_qc_attributes) - .and_return(true) + expect(Sequencescape::Api::V2::QcAssay).to receive(:create).with(qc_results: dest_well_qc_attributes).and_return( + true + ) expect(subject.save!).to eq true expect(plate_creation_request).to have_been_made expect(transfer_creation_request).to have_been_made diff --git a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb index 4e60fcc14..d2cdf7206 100644 --- a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb +++ b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb @@ -43,9 +43,11 @@ allow(Sequencescape::Api::V2::Plate).to receive(:find_by).with(uuid: parent_uuid).and_return(parent) - allow(api).to receive_message_chain(:plate_creation, :create!) - .with(parent: parent_uuid, child_purpose: child_purpose_uuid, user: user_uuid) - .and_return(double(child: child_plate)) + allow(api).to receive_message_chain(:plate_creation, :create!).with( + parent: parent_uuid, + child_purpose: child_purpose_uuid, + user: user_uuid + ).and_return(double(child: child_plate)) allow(Sequencescape::Api::V2::Plate).to receive(:find_by).with(uuid: child_uuid).and_return(child_plate) end diff --git a/spec/models/labware_creators/stamped_plate_spec.rb b/spec/models/labware_creators/stamped_plate_spec.rb index 29e0fd586..22b16157e 100644 --- a/spec/models/labware_creators/stamped_plate_spec.rb +++ b/spec/models/labware_creators/stamped_plate_spec.rb @@ -188,14 +188,7 @@ context 'when a library type is supplied' do let(:form_attributes) do - { - purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, - filters: { - library_type: [lib_type_a] - } - } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: [lib_type_a] } } end it_behaves_like 'a stamped plate creator' @@ -219,14 +212,7 @@ context 'when a library type is supplied that does not match any request' do let(:form_attributes) do - { - purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, - filters: { - library_type: ['LibTypeB'] - } - } + { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: ['LibTypeB'] } } end it 'raises an exception' do diff --git a/spec/models/labware_creators/tagged_plate_spec.rb b/spec/models/labware_creators/tagged_plate_spec.rb index b45b52bd4..58fdeb2c5 100644 --- a/spec/models/labware_creators/tagged_plate_spec.rb +++ b/spec/models/labware_creators/tagged_plate_spec.rb @@ -30,10 +30,7 @@ let(:disable_cross_plate_pool_detection) { false } before do - create(:purpose_config, - name: child_purpose_name, - uuid: child_purpose_uuid, - disable_cross_plate_pool_detection:) + create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, disable_cross_plate_pool_detection:) plate_request wells_request end @@ -223,14 +220,7 @@ expect_api_v2_posts( 'StateChange', - [ - { - reason: 'Used in Library creation', - target_state: 'exhausted', - target_uuid: tag_plate_uuid, - user_uuid: - } - ] + [{ reason: 'Used in Library creation', target_state: 'exhausted', target_uuid: tag_plate_uuid, user_uuid: }] ) expect(subject.save).to be true diff --git a/spec/models/labware_creators/tube_from_tube_spec.rb b/spec/models/labware_creators/tube_from_tube_spec.rb index 23279244a..112f1b4c7 100644 --- a/spec/models/labware_creators/tube_from_tube_spec.rb +++ b/spec/models/labware_creators/tube_from_tube_spec.rb @@ -60,14 +60,7 @@ it 'creates the child' do expect_api_v2_posts( 'Transfer', - [ - { - user_uuid:, - source_uuid: parent_uuid, - destination_uuid: child_uuid, - transfer_template_uuid: - } - ] + [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: child_uuid, transfer_template_uuid: }] ) subject.save! diff --git a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb index 6e8a7dcd5..136fc50e9 100644 --- a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb +++ b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb @@ -32,9 +32,7 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) do - LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) - end + let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/labware_creators/well_filter_spec.rb b/spec/models/labware_creators/well_filter_spec.rb index 28c79369c..55d02afef 100644 --- a/spec/models/labware_creators/well_filter_spec.rb +++ b/spec/models/labware_creators/well_filter_spec.rb @@ -32,9 +32,7 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) do - LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) - end + let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/labware_metadata_spec.rb b/spec/models/labware_metadata_spec.rb index 49ac36edf..bb82795cd 100644 --- a/spec/models/labware_metadata_spec.rb +++ b/spec/models/labware_metadata_spec.rb @@ -43,9 +43,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) LabwareMetadata.new(labware: plate_with_metadata, user_uuid: user.uuid).update!(updated_metadata) end @@ -63,13 +61,11 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(plate_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) - LabwareMetadata - .new(barcode: plate_with_metadata.barcode.machine, user_uuid: user.uuid) - .update!(updated_metadata) + LabwareMetadata.new(barcode: plate_with_metadata.barcode.machine, user_uuid: user.uuid).update!( + updated_metadata + ) end end end @@ -95,9 +91,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) LabwareMetadata.new(labware: tube_with_metadata, user_uuid: user.uuid).update!(updated_metadata) end @@ -115,9 +109,7 @@ it 'updates metadata' do metadata = attributes_for(:custom_metadatum_collection).fetch(:metadata, {}).merge(updated_metadata) - expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!) - .with(metadata:) - .and_return(true) + expect(tube_with_metadata.custom_metadatum_collection).to receive(:update!).with(metadata:).and_return(true) LabwareMetadata.new(barcode: tube_with_metadata.barcode.machine, user_uuid: user.uuid).update!(updated_metadata) end diff --git a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb index ff74c8b99..99e9baaf9 100644 --- a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb @@ -65,14 +65,7 @@ end context 'when binning configuration is present' do - before do - create( - :concentration_binning_purpose_config, - uuid: labware.purpose.uuid, - warnings:, - label_class: - ) - end + before { create(:concentration_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/final_tube_presenter_spec.rb b/spec/models/presenters/final_tube_presenter_spec.rb index 5fba07000..b6d7b4347 100644 --- a/spec/models/presenters/final_tube_presenter_spec.rb +++ b/spec/models/presenters/final_tube_presenter_spec.rb @@ -5,9 +5,7 @@ require_relative 'shared_labware_presenter_examples' RSpec.describe Presenters::FinalTubePresenter do - let(:labware) do - build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' - end + let(:labware) { build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' } before { create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') } diff --git a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb index fb4860cac..44c5d52b9 100644 --- a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb @@ -66,14 +66,7 @@ end context 'when binning configuration is present' do - before do - create( - :normalised_binning_purpose_config, - uuid: labware.purpose.uuid, - warnings:, - label_class: - ) - end + before { create(:normalised_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/plate_presenter_spec.rb b/spec/models/presenters/plate_presenter_spec.rb index 60b6f29c5..378f4a611 100644 --- a/spec/models/presenters/plate_presenter_spec.rb +++ b/spec/models/presenters/plate_presenter_spec.rb @@ -337,15 +337,7 @@ end context 'with a plate that has no links' do - before do - create( - :purpose_config, - uuid: labware.purpose.uuid, - warnings:, - label_class:, - file_links: [] - ) - end + before { create(:purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links: []) } it 'returns an empty array' do expect(presenter.csv_file_links).to eq([]) diff --git a/spec/models/presenters/standard_presenter_spec.rb b/spec/models/presenters/standard_presenter_spec.rb index 14290d37c..6376b2ff3 100644 --- a/spec/models/presenters/standard_presenter_spec.rb +++ b/spec/models/presenters/standard_presenter_spec.rb @@ -5,13 +5,7 @@ let(:aliquot_type) { :v2_aliquot } let(:state) { 'pending' } let(:labware) do - create :v2_plate, - barcode_number: 1, - state:, - purpose_name:, - purpose_uuid: 'test-purpose', - uuid: 'plate-uuid', - wells: + create :v2_plate, barcode_number: 1, state:, purpose_name:, purpose_uuid: 'test-purpose', uuid: 'plate-uuid', wells: end let(:wells) do [ diff --git a/spec/models/presenters/submission_plate_presenter_spec.rb b/spec/models/presenters/submission_plate_presenter_spec.rb index 5e358992b..aab4a7072 100644 --- a/spec/models/presenters/submission_plate_presenter_spec.rb +++ b/spec/models/presenters/submission_plate_presenter_spec.rb @@ -114,9 +114,7 @@ it_behaves_like 'a labware presenter' it_behaves_like 'a stock presenter' - let(:labware) do - create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions - end + let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } let(:submissions) { create_list :v2_submission, 1, state: 'pending' } let(:barcode_string) { 'DN2T' } @@ -156,9 +154,7 @@ end end - let(:labware) do - create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions - end + let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } let(:now) { Time.zone.parse('2020-11-24 16:13:43 +0000') } let(:submissions) { create_list :v2_submission, 1, state: 'ready', updated_at: now - 5.seconds } let(:barcode_string) { 'DN2T' } @@ -213,12 +209,7 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, - purpose_name:, - barcode_number: 2, - pool_sizes: [2], - direct_submissions: submissions, - state: + create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } @@ -255,12 +246,7 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, - purpose_name:, - barcode_number: 2, - pool_sizes: [2], - direct_submissions: submissions, - state: + create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } diff --git a/spec/models/presenters/tube_rack_presenter_spec.rb b/spec/models/presenters/tube_rack_presenter_spec.rb index bebb8e088..7a4df7cf0 100644 --- a/spec/models/presenters/tube_rack_presenter_spec.rb +++ b/spec/models/presenters/tube_rack_presenter_spec.rb @@ -37,13 +37,7 @@ let(:label_class) { 'Labels::PlateLabel' } before do - create( - :tube_rack_config, - uuid: labware.purpose.uuid, - warnings:, - label_class:, - file_links: - ) + create(:tube_rack_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links:) create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') end diff --git a/spec/models/robots/pooling_robot_spec.rb b/spec/models/robots/pooling_robot_spec.rb index a2bf527ae..bc4dea351 100644 --- a/spec/models/robots/pooling_robot_spec.rb +++ b/spec/models/robots/pooling_robot_spec.rb @@ -104,9 +104,7 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } - end + let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name diff --git a/spec/models/robots/quadrant_robot_spec.rb b/spec/models/robots/quadrant_robot_spec.rb index 58ac0d7d7..97bb3939c 100644 --- a/spec/models/robots/quadrant_robot_spec.rb +++ b/spec/models/robots/quadrant_robot_spec.rb @@ -102,9 +102,7 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } - end + let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name diff --git a/spec/models/sequencescape_submission_spec.rb b/spec/models/sequencescape_submission_spec.rb index 5341d8cf1..b2f1942b9 100644 --- a/spec/models/sequencescape_submission_spec.rb +++ b/spec/models/sequencescape_submission_spec.rb @@ -11,9 +11,7 @@ let(:template_uuid) { 'template-uuid' } let(:request_options) { { read_length: 150 } } let(:user_uuid) { 'user-uuid' } - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } describe '#template_uuid' do context 'when set directly' do @@ -24,9 +22,7 @@ context 'when set via template_name' do let(:template_name) { 'Submission template' } - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } before { Settings.submission_templates = { template_name => template_uuid } } @@ -37,9 +33,7 @@ end describe '#extra_barcodes_trimmed' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } it 'removes any extra whitespaces' do obj = described_class.new(attributes.merge(extra_barcodes: [' 1234 ', ' 5678 ', ' ', ''])) @@ -48,9 +42,7 @@ end describe '#extra_plates' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } let(:plate) { create :v2_plate } let(:obj) { described_class.new(attributes.merge(extra_barcodes: %w[1234 5678])) } @@ -65,25 +57,23 @@ end describe '#extra_assets' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } let(:plate) { create(:passed_plate) } let(:plate2) { create(:passed_plate) } it 'returns the uuids of the labwares wells' do obj = described_class.new(attributes.merge(extra_barcodes: %w[1234 5678])) - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) - .with(barcode: %w[1234 5678]) - .and_return([plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( + barcode: %w[1234 5678] + ).and_return([plate, plate2]) # There are 4 non-empty wells in each labware expect(obj.extra_assets.count).to eq(8) end it 'removes duplicates uuids in the returned list' do - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) - .with(barcode: %w[1234 1234 5678]) - .and_return([plate, plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( + barcode: %w[1234 1234 5678] + ).and_return([plate, plate, plate2]) obj = described_class.new(attributes.merge(extra_barcodes: %w[1234 1234 5678])) expect(obj.extra_assets.count).to eq(8) expect(obj.extra_assets.uniq.count).to eq(8) @@ -91,9 +81,7 @@ end describe '#asset_groups_for_orders_creation' do - let(:attributes) do - { api:, assets:, template_uuid:, request_options:, user: user_uuid } - end + let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } it 'returns normal asset groups when no extra barcodes provided' do obj = described_class.new(attributes) @@ -104,9 +92,9 @@ let(:plate2) { create(:passed_plate) } before do - allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter) - .with(barcode: %w[1234 5678]) - .and_return([plate, plate2]) + allow(Sequencescape::Api::V2).to receive(:additional_plates_for_presenter).with( + barcode: %w[1234 5678] + ).and_return([plate, plate2]) end it 'returns the current assets plus the extra assets' do diff --git a/spec/sequencescape/api/v2/plate_spec.rb b/spec/sequencescape/api/v2/plate_spec.rb index ad63ee1cb..b68382890 100644 --- a/spec/sequencescape/api/v2/plate_spec.rb +++ b/spec/sequencescape/api/v2/plate_spec.rb @@ -83,32 +83,30 @@ describe '::find_by' do it 'finds a plate' do - stub_request(:get, 'http://example.com:3000/api/v2/plates') - .with( - query: { - fields: { - sample_metadata: 'sample_common_name,collected_by,sample_description', - submissions: 'lanes_of_sequencing' - }, - filter: { - uuid: '8681e102-b737-11ec-8ace-acde48001122' - }, - # This is a bit brittle, as it depends on the exact order. - include: - 'purpose,child_plates.purpose,wells.downstream_tubes.purpose,' \ - 'wells.requests_as_source.request_type,wells.requests_as_source.primer_panel,' \ - 'wells.requests_as_source.pre_capture_pool,wells.requests_as_source.submission,' \ - 'wells.aliquots.sample.sample_metadata,wells.aliquots.request.request_type,' \ - 'wells.aliquots.request.primer_panel,wells.aliquots.request.pre_capture_pool,' \ - 'wells.aliquots.request.submission,' \ - 'wells.transfer_requests_as_target.source_asset' + stub_request(:get, 'http://example.com:3000/api/v2/plates').with( + query: { + fields: { + sample_metadata: 'sample_common_name,collected_by,sample_description', + submissions: 'lanes_of_sequencing' }, - headers: { - 'Accept' => 'application/vnd.api+json', - 'Content-Type' => 'application/vnd.api+json' - } - ) - .to_return(File.new('./spec/contracts/v2-plate-by-uuid-for-presenter.txt')) + filter: { + uuid: '8681e102-b737-11ec-8ace-acde48001122' + }, + # This is a bit brittle, as it depends on the exact order. + include: + 'purpose,child_plates.purpose,wells.downstream_tubes.purpose,' \ + 'wells.requests_as_source.request_type,wells.requests_as_source.primer_panel,' \ + 'wells.requests_as_source.pre_capture_pool,wells.requests_as_source.submission,' \ + 'wells.aliquots.sample.sample_metadata,wells.aliquots.request.request_type,' \ + 'wells.aliquots.request.primer_panel,wells.aliquots.request.pre_capture_pool,' \ + 'wells.aliquots.request.submission,' \ + 'wells.transfer_requests_as_target.source_asset' + }, + headers: { + 'Accept' => 'application/vnd.api+json', + 'Content-Type' => 'application/vnd.api+json' + } + ).to_return(File.new('./spec/contracts/v2-plate-by-uuid-for-presenter.txt')) expect( Sequencescape::Api::V2::Plate.find_by(uuid: '8681e102-b737-11ec-8ace-acde48001122') ).to be_a Sequencescape::Api::V2::Plate diff --git a/spec/sequencescape/api/v2/shared_examples.rb b/spec/sequencescape/api/v2/shared_examples.rb index f695a7147..2c8e67d47 100644 --- a/spec/sequencescape/api/v2/shared_examples.rb +++ b/spec/sequencescape/api/v2/shared_examples.rb @@ -60,12 +60,12 @@ let(:alternative_workline_name) { 'Some other plate with some stuff inside' } before do - allow(SearchHelper).to receive(:alternative_workline_reference_name) - .with(the_labware) - .and_return(alternative_workline_name) - allow(ancestors_scope).to receive(:where) - .with(purpose_name: alternative_workline_name) - .and_return(alternative_workline_reference_plates) + allow(SearchHelper).to receive(:alternative_workline_reference_name).with(the_labware).and_return( + alternative_workline_name + ) + allow(ancestors_scope).to receive(:where).with(purpose_name: alternative_workline_name).and_return( + alternative_workline_reference_plates + ) end it 'returns the last alternative workline reference' do diff --git a/spec/support/api_url_helper.rb b/spec/support/api_url_helper.rb index bb0281796..db511413a 100644 --- a/spec/support/api_url_helper.rb +++ b/spec/support/api_url_helper.rb @@ -28,9 +28,13 @@ def api_url_for(*components) # @param [Int] status: the response status, defaults to 200 # @return mocked_request def stub_api_get(*components, status: 200, body: '{}') - stub_request(:get, api_url_for(*components)) - .with(headers: { 'Accept' => 'application/json' }) - .to_return(status:, body:, headers: { 'content-type' => 'application/json' }) + stub_request(:get, api_url_for(*components)).with(headers: { 'Accept' => 'application/json' }).to_return( + status:, + body:, + headers: { + 'content-type' => 'application/json' + } + ) end # Generate an API stub for a post request. @@ -54,18 +58,17 @@ def stub_api_post(*components, status: 201, body: '{}', payload: {}) end def stub_api_modify(*components, body:, payload:, action: :post, status: 201) - Array(body) - .reduce( - stub_request(action, api_url_for(*components)).with( - headers: { - 'Accept' => 'application/json', - 'content-type' => 'application/json' - }, - body: payload - ) - ) do |request, response| - request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) - end + Array(body).reduce( + stub_request(action, api_url_for(*components)).with( + headers: { + 'Accept' => 'application/json', + 'content-type' => 'application/json' + }, + body: payload + ) + ) do |request, response| + request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) + end end def stub_api_put(*components, body:, payload:) @@ -132,9 +135,10 @@ def stub_v2_plate(plate, stub_search: true, custom_query: nil, custom_includes: if custom_query allow(Sequencescape::Api::V2).to receive(custom_query.first).with(*custom_query.last).and_return(plate) elsif custom_includes - allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes) - .with(custom_includes, { uuid: plate.uuid }) - .and_return(plate) + allow(Sequencescape::Api::V2).to receive(:plate_with_custom_includes).with( + custom_includes, + { uuid: plate.uuid } + ).and_return(plate) else allow(Sequencescape::Api::V2).to receive(:plate_for_presenter).with(uuid: plate.uuid).and_return(plate) end diff --git a/spec/support/contract_helper.rb b/spec/support/contract_helper.rb index e11e00d99..9d740f39a 100644 --- a/spec/support/contract_helper.rb +++ b/spec/support/contract_helper.rb @@ -16,7 +16,8 @@ def initialize(root_directory) # rubocop:todo Lint/MissingCopEnableDirective # rubocop:todo Layout/LineLength # rubocop:enable Lint/MissingCopEnableDirective - REQUEST_REGEXP = %r{ # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes + REQUEST_REGEXP = + %r{ # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:todo Lint/MixedRegexpCaptureTypes # rubocop:enable Layout/LineLength (? \r\n|\r|\n){0} (? GET|PUT|POST|DELETE){0} diff --git a/spec/support/factory_bot_extensions.rb b/spec/support/factory_bot_extensions.rb index 54c26c611..0a35ed26f 100644 --- a/spec/support/factory_bot_extensions.rb +++ b/spec/support/factory_bot_extensions.rb @@ -31,8 +31,9 @@ def with_has_many_associations(*names, actions: ['read']) send(association) do {}.tap do |h| h['size'] = send(:"#{association}_count") if send(:"#{association}_actions").include?('read') - h['actions'] = - send(:"#{association}_actions").index_with { |_action_name| "#{resource_url}/#{association}" } + h['actions'] = send(:"#{association}_actions").index_with do |_action_name| + "#{resource_url}/#{association}" + end end end end diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index e67dd8774..76409187d 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -9,9 +9,9 @@ def stub_search_and_single_result(search, query, result = nil) stub_api_post(search_uuid, 'first', status: 301, payload: query, body: result) else search_url = "http://example.com:3000/#{search_uuid}" - stub_request(:post, "#{search_url}/first") - .with(body: query.to_json) - .to_raise(Sequencescape::Api::ResourceNotFound) + stub_request(:post, "#{search_url}/first").with(body: query.to_json).to_raise( + Sequencescape::Api::ResourceNotFound + ) end end diff --git a/spec/support/robot_helpers.rb b/spec/support/robot_helpers.rb index 8f1f30abe..1b86fd797 100644 --- a/spec/support/robot_helpers.rb +++ b/spec/support/robot_helpers.rb @@ -6,9 +6,10 @@ def bed_labware_lookup(labware, includes = %i[purpose parents]) end def bed_labware_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) - allow(Sequencescape::Api::V2::Labware).to receive(:find_all) - .with({ barcode: Array(barcode) }, includes:) - .and_return(result) + allow(Sequencescape::Api::V2::Labware).to receive(:find_all).with( + { barcode: Array(barcode) }, + includes: + ).and_return(result) end def bed_plate_lookup(plate, includes = %i[purpose parents]) @@ -16,8 +17,8 @@ def bed_plate_lookup(plate, includes = %i[purpose parents]) end def bed_plate_lookup_with_barcode(barcode, result, includes = %i[purpose parents]) - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: Array(barcode) }, includes:) - .and_return(result) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with({ barcode: Array(barcode) }, includes:).and_return( + result + ) end end diff --git a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb index 720c76f9c..1163ee23b 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca_count.csv.erb_spec.rb @@ -4,7 +4,7 @@ has_a_working_api let(:wells) do - (1..12).map do |index| # one-based index + (1..12).map do |index| # one-based index supplier_name = "vac-tube-barcode-#{index}" sample_metadata = create(:v2_sample_metadata, supplier_name:) sample = create(:v2_sample, sample_metadata:) @@ -35,7 +35,7 @@ ['Plate Barcode', 'Well Position', 'Vac Tube Barcode', 'Sample Name', 'Well Name'] ] body = - (5..12).map do |index| # one-based index + (5..12).map do |index| # one-based index well = plate.wells_in_columns[index - 1] sample = well.aliquots.first.sample [plate.labware_barcode.human, well.location, sample.sample_metadata.supplier_name, sample.name, well.name] From 4081cba49dcbe1bbb0378ef37aaac8089c5ebdc4 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 13:55:08 +0100 Subject: [PATCH 078/141] build: add note on dependency origins --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index d2272e5fc..4fbf055d1 100644 --- a/Gemfile +++ b/Gemfile @@ -68,6 +68,8 @@ group :lint do gem 'rubocop-performance', require: false gem 'rubocop-rails', require: false + # Ruby dependencies specifically requested by prettier/plugin-ruby v4 + # https://github.com/prettier/plugin-ruby gem 'prettier_print', require: false gem 'syntax_tree', require: false gem 'syntax_tree-haml', require: false From 959a43f9865874225e7c55b68cc04a7e3a29611e Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 14:28:00 +0100 Subject: [PATCH 079/141] style: rubocop bundle exec rubocop -a --- app/controllers/labware_controller.rb | 4 ++-- spec/factories/purpose_config_factories.rb | 8 ++++---- .../labware_creators/donor_pooling_plate_spec.rb | 2 +- ...c_pbmc_pools_to_cellaca_count.csv.erb_spec.rb | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/controllers/labware_controller.rb b/app/controllers/labware_controller.rb index dccbe7d45..0e5273e4d 100644 --- a/app/controllers/labware_controller.rb +++ b/app/controllers/labware_controller.rb @@ -35,7 +35,7 @@ def update # rubocop:todo Metrics/AbcSize notice = +"Labware: #{params[:labware_barcode]} has been changed to a state of #{params[:state].titleize}." notice << ' The customer will still be charged.' if update_params[2] - respond_to { |format| format.html { redirect_to(search_path, notice: notice) } } + respond_to { |format| format.html { redirect_to(search_path, notice:) } } rescue StateChangers::StateChangeError => e respond_to do |format| format.html { redirect_to(search_path, alert: e.message) } @@ -89,7 +89,7 @@ def state_changer_for(purpose_uuid, labware_uuid) end def presenter_for(labware) - presenter = Presenters.lookup_for(labware).new(labware: labware) + presenter = Presenters.lookup_for(labware).new(labware:) # TODO: {Y24-190} - Remove this line when the API v1 is removed from Presenters::ExtendedCsv presenter.api = api if presenter.respond_to?(:api=) diff --git a/spec/factories/purpose_config_factories.rb b/spec/factories/purpose_config_factories.rb index a5014f1aa..4ec42d976 100644 --- a/spec/factories/purpose_config_factories.rb +++ b/spec/factories/purpose_config_factories.rb @@ -181,7 +181,7 @@ transient { acceptable_purposes { %w[Purpose1 Purpose2] } } state_changer_class { 'StateChangers::AutomaticPlateStateChanger' } - creator_class { { name: 'LabwareCreators::TenStamp', args: { acceptable_purposes: acceptable_purposes } } } + creator_class { { name: 'LabwareCreators::TenStamp', args: { acceptable_purposes: } } } work_completion_request_type { 'limber_bespoke_aggregation' } end @@ -272,7 +272,7 @@ { name: 'LabwareCreators::PooledWellsBySampleInGroups', args: { - number_of_source_wells: number_of_source_wells + number_of_source_wells: } } end @@ -298,8 +298,8 @@ { name: 'LabwareCreators::DonorPoolingPlate', args: { - max_number_of_source_plates: max_number_of_source_plates, - pooling: pooling + max_number_of_source_plates:, + pooling: } } end diff --git a/spec/models/labware_creators/donor_pooling_plate_spec.rb b/spec/models/labware_creators/donor_pooling_plate_spec.rb index 843f690ff..5902c886c 100644 --- a/spec/models/labware_creators/donor_pooling_plate_spec.rb +++ b/spec/models/labware_creators/donor_pooling_plate_spec.rb @@ -64,7 +64,7 @@ # This is the form that includes plate barcodes, submitted by user. let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid: parent_1_plate_uuid, barcodes: barcodes, user_uuid: user_uuid } + { purpose_uuid: child_purpose_uuid, parent_uuid: parent_1_plate_uuid, barcodes:, user_uuid: } end let(:barcodes) { source_plates.map(&:human_barcode) } diff --git a/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb index ec8bb3fd4..0c0bcba7c 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb @@ -13,12 +13,12 @@ # Initiate 10 aliquots per each well (1..10).each do |_i| supplier_name = "vac-tube-barcode-#{index}" - sample_metadata = create(:v2_sample_metadata, supplier_name: supplier_name) - sample = create(:v2_sample, sample_metadata: sample_metadata) - aliquots << create(:v2_aliquot, sample: sample) + sample_metadata = create(:v2_sample_metadata, supplier_name:) + sample = create(:v2_sample, sample_metadata:) + aliquots << create(:v2_aliquot, sample:) end location = WellHelpers.well_at_column_index(index - 1) - create(:v2_well, aliquots: aliquots, location: location) + create(:v2_well, aliquots:, location:) end end @@ -31,7 +31,7 @@ wells[2].state = 'failed' wells[3].state = 'failed' - create(:v2_plate, wells: wells) + create(:v2_plate, wells:) end let(:required_number_of_cells) { 30_000 } @@ -43,9 +43,9 @@ plate.purpose.uuid => { presenter_class: { args: { - required_number_of_cells: required_number_of_cells, - wastage_factor: wastage_factor, - desired_chip_loading_concentration: desired_chip_loading_concentration + required_number_of_cells:, + wastage_factor:, + desired_chip_loading_concentration: } } } From c43edf835a63a1e188ae918402d217c0c39aef6d Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 14:28:51 +0100 Subject: [PATCH 080/141] style: prettier yarn prettier --write . --- app/controllers/labware_controller.rb | 5 ++-- spec/factories/purpose_config_factories.rb | 25 ++++------------- .../donor_pooling_plate_spec.rb | 28 +++++++++++-------- ...bmc_pools_to_cellaca_count.csv.erb_spec.rb | 4 +-- 4 files changed, 27 insertions(+), 35 deletions(-) diff --git a/app/controllers/labware_controller.rb b/app/controllers/labware_controller.rb index 0e5273e4d..43bd0fd60 100644 --- a/app/controllers/labware_controller.rb +++ b/app/controllers/labware_controller.rb @@ -22,8 +22,9 @@ def show # rubocop:todo Metrics/AbcSize format.html { render @presenter.page } format.csv do render @presenter.csv - response.headers['Content-Disposition'] = - "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename + response.headers[ + 'Content-Disposition' + ] = "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename end format.json end diff --git a/spec/factories/purpose_config_factories.rb b/spec/factories/purpose_config_factories.rb index 4ec42d976..430cbafc3 100644 --- a/spec/factories/purpose_config_factories.rb +++ b/spec/factories/purpose_config_factories.rb @@ -239,11 +239,13 @@ { 'Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => {} + 'request_options' => { + } }, 'Another Cardinal library prep' => { 'template_name' => 'example', - 'request_options' => {} + 'request_options' => { + } } } end @@ -268,14 +270,7 @@ # Configuration to set number_of_source_wells argument factory :pooled_wells_by_sample_in_groups_purpose_config do transient { number_of_source_wells { 2 } } - creator_class do - { - name: 'LabwareCreators::PooledWellsBySampleInGroups', - args: { - number_of_source_wells: - } - } - end + creator_class { { name: 'LabwareCreators::PooledWellsBySampleInGroups', args: { number_of_source_wells: } } } end factory :multi_stamp_tubes_using_tube_rack_scan_purpose_config do @@ -294,15 +289,7 @@ factory :donor_pooling_plate_purpose_config do transient { max_number_of_source_plates { 2 } } transient { pooling { 'donor_pooling' } } - creator_class do - { - name: 'LabwareCreators::DonorPoolingPlate', - args: { - max_number_of_source_plates:, - pooling: - } - } - end + creator_class { { name: 'LabwareCreators::DonorPoolingPlate', args: { max_number_of_source_plates:, pooling: } } } end factory :banking_plate_purpose_config do diff --git a/spec/models/labware_creators/donor_pooling_plate_spec.rb b/spec/models/labware_creators/donor_pooling_plate_spec.rb index 5902c886c..6006fd42a 100644 --- a/spec/models/labware_creators/donor_pooling_plate_spec.rb +++ b/spec/models/labware_creators/donor_pooling_plate_spec.rb @@ -76,9 +76,10 @@ create(:donor_pooling_plate_purpose_config, uuid: child_purpose_uuid) # Allow the API call to return two plates by default. - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return(source_plates) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return(source_plates) end describe '.attributes' do @@ -695,9 +696,10 @@ describe '#source_barcodes_must_be_different' do before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] * 2 } it 'reports the error' do @@ -720,9 +722,10 @@ [well] end before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end let(:barcodes) { [parent_1_plate.human_barcode] } it 'allows plate creation' do @@ -735,9 +738,10 @@ describe '#source_plates_must_exist' do let(:barcodes) { [parent_1_plate.human_barcode, 'NOT-A-PLATE-BARCODE'] } before do - allow(Sequencescape::Api::V2::Plate).to receive(:find_all) - .with({ barcode: barcodes }, includes: described_class::SOURCE_PLATE_INCLUDES) - .and_return([parent_1_plate]) + allow(Sequencescape::Api::V2::Plate).to receive(:find_all).with( + { barcode: barcodes }, + includes: described_class::SOURCE_PLATE_INCLUDES + ).and_return([parent_1_plate]) end it 'reports the error' do expect(subject).not_to be_valid diff --git a/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb index 0c0bcba7c..c9a3544ba 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb @@ -7,7 +7,7 @@ let(:wells) do # 8 because of the Pools plate. - (1..8).map do |index| # one-based index + (1..8).map do |index| # one-based index aliquots = [] # Initiate 10 aliquots per each well @@ -58,7 +58,7 @@ header = [['Workflow', workflow], [], ['Plate Barcode', 'Well Position', 'Well Name', 'Source Well Volume']] body = # 8 wells - first two wells (empty + failed) - (5..8).map do |index| # one-based index + (5..8).map do |index| # one-based index well = plate.wells_in_columns[index - 1] [ plate.labware_barcode.human, From aa0d6ba498c0cdf96e9bda774674620d28762c46 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Sep 2024 16:47:53 +0100 Subject: [PATCH 081/141] trigger: From 606fdd108a666feaac089b9c7b0f7dad5dbc5fa5 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 00:41:47 +0100 Subject: [PATCH 082/141] Add Bravo Verify Initial Setup --- config/robots.rb | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index 940dba882..bfcbb6786 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3769,4 +3769,51 @@ } } ) + + # LCM Triomics EMSeq Bravo BenchCel bed verification + # Verify initial setup + custom_robot( + 'bravo-verify-initial-setup', + name: 'Bravo Verify Initial Setup', + beds: { + bed(4).barcode => { + purpose: 'LCMT Lysate', + states: ['passed'], + label: 'Bed 4' + }, + car('1,4').barcode => { + purpose: 'DNA Frag', + states: ['pending'], + label: 'Carousel 1,4', + parent: bed(4).barcode + }, + car('2,4').barcode => { + purpose: 'LCMT DNA End Prep', + states: ['pending'], + label: 'Carousel 2,4', + parent: bed(4).barcode + }, + car('3,5').barcode => { + purpose: 'LCMT DNA Adp Lig', + states: ['pending'], + label: 'Carousel 3,5', + parent: bed(4).barcode + }, + car('4,4').barcode => { + purpose: 'LCMT EM TET2 Ox', + states: ['pending'], + label: 'Carousel 4,4', + parent: bed(4).barcode + }, + car('4,3').barcode => { + purpose: 'LCMT EM TET2 Stop', + states: ['pending'], + label: 'Carousel 4,3', + parent: bed(4).barcode + }, + } + ) + + + end From 802cdf161c1a1d8454bfc64a982b558c7ebe4652 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 00:42:23 +0100 Subject: [PATCH 083/141] Add Bravo LCMT DNA Frag Verification --- config/robots.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index bfcbb6786..a2c66bcd3 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3814,6 +3814,22 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Bravo LCMT DNA Frag Verification + custom_robot( + 'bravo-lcmt-dna-frag-verification', + name: 'Bravo LCMT DNA Frag Verification', + verify_robot: true, + beds: { + bed(5).barcode => { + purpose: 'LCMT DNA Frag', + states: ['pending'], + label: 'Bed 5', + target_state: 'passed' + } + } + ) + end From 60f12097f619a15e534ea14870cf7a29fee7da99 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 00:43:00 +0100 Subject: [PATCH 084/141] Bravo LCMT DNA End Prep Verification --- config/robots.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/config/robots.rb b/config/robots.rb index a2c66bcd3..861cfa4a5 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3830,6 +3830,20 @@ } ) - + # LCM Triomics EMSeq Bravo bed verification + # Bravo LCMT DNA End Prep Verification + custom_robot( + 'bravo-lcmt-dna-end-prep-verification', + name: 'Bravo LCMT DNA End Prep Verification', + verify_robot: true, + beds: { + bed(5).barcode => { + purpose: 'LCMT DNA End Prep', + states: ['pending'], + label: 'Bed 5', + target_state: 'passed' + } + } + ) end From 6ebbb083fe2e756769534de116a0cc7800478151 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 00:47:14 +0100 Subject: [PATCH 085/141] Bravo LCMT DNA Adp Lig to LCMT DNA Lib PCR --- config/robots.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index 861cfa4a5..bf4f05385 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3846,4 +3846,26 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Bravo LCMT DNA Adp Lig to LCMT DNA Lib PCR + custom_robot( + 'bravo-lcmt-dna-adp-lig-to-lcmt-dna-lib-pcr', + name: 'Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR', + verify_robot: true, + beds: { + bed(6).barcode => { + purpose: 'LCMT DNA Adp Lig', + states: ['passed'], + label: 'Bed 6' + }, + bed(7).barcode => { + purpose: 'LRC GEM-X 5p cDNA PCR', + states: ['pending'], + label: 'Bed 5', + parent: bed(6).barcode, + target_state: 'passed' + } + } + ) + end From 02d31f3378728d158a058a4cecbf5ec8ceb22435 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:12:21 +0100 Subject: [PATCH 086/141] Add Bravo LCMT EM TET2 Ox Verification --- config/robots.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index bf4f05385..806f32526 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3868,4 +3868,20 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Bravo LCMT EM TET2 Ox Verification + custom_robot( + 'bravo-lcmt-em-tet2-ox-verification', + name: 'Bravo LCMT EM TET2 Ox Verification', + verify_robot: true, + beds: { + bed(5).barcode => { + purpose: 'LCMT EM TET2 Ox', + states: ['pending'], + label: 'Bed 5', + target_state: 'passed' + } + } + ) + end From 8987f78626f701fbbfe4d3cebb1fad481ce3d5a0 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:14:04 +0100 Subject: [PATCH 087/141] Fix Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR --- config/robots.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index 806f32526..cb465765e 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3859,9 +3859,9 @@ label: 'Bed 6' }, bed(7).barcode => { - purpose: 'LRC GEM-X 5p cDNA PCR', + purpose: 'LCMT DNA Lib PCR', states: ['pending'], - label: 'Bed 5', + label: 'Bed 7', parent: bed(6).barcode, target_state: 'passed' } From 782d56ddf945dc755d882b9f89982e01d2d9fb49 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:21:17 +0100 Subject: [PATCH 088/141] Add Bravo LCMT EM TET2 Stop to Denat and Deam Setup --- config/robots.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index cb465765e..2e2fee37b 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3884,4 +3884,33 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Bravo LCMT EM TET2 Stop to Denat and Deam Setup + custom_robot( + 'bravo-lcmt-em-tet2-stop-to-denat-and-deam-setup', + name: 'Bravo LCMT EM TET2 Stop to Denat and Deam Setup', + verify_robot: true, + beds: { + bed(4).barcode => { + purpose: 'LCMT EM TET2 Stop', + states: ['passed'], + label: 'Bed 4' + }, + car('3,3').barcode => { + purpose: 'LCMT EM NaOH Denat', + states: ['pending'], + label: 'Carousel 4,4', + parent: bed(4).barcode, + target_state: 'passed' + }, + car('4,3').barcode => { + purpose: 'LCMT EM APOBEC Deam', + states: ['pending'], + label: 'Carousel 3,4', + parent: bed(4).barcode, + target_state: 'passed' + } + } + ) + end From dc649eedb44308ff780370908428586a74aabd39 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:22:49 +0100 Subject: [PATCH 089/141] Add Bravo LCMT EM NaOH Denat Verification --- config/robots.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index 2e2fee37b..1f5bdecd8 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3913,4 +3913,20 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Bravo LCMT EM NaOH Denat Verification + custom_robot( + 'bravo-lcmt-em-naoh-denat-verification', + name: 'Bravo LCMT EM NaOH Denat Verification', + verify_robot: true, + beds: { + bed(5).barcode => { + purpose: 'LCMT EM NaOH Denat', + states: ['pending'], + label: 'Bed 5', + target_state: 'passed' + } + } + ) + end From 25be106b86519d14c21d3891af6a093edd7ae494 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:25:16 +0100 Subject: [PATCH 090/141] Add Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR --- config/robots.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index 1f5bdecd8..d08104e0c 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3929,4 +3929,26 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR + custom_robot( + 'bravo-lcmt-em-apobec-deam-to-lcmt-em-lib-pcr', + name: 'Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR', + verify_robot: true, + beds: { + bed(5).barcode => { + purpose: 'LCMT DNA Adp Lig', + states: ['passed'], + label: 'Bed 5' + }, + bed(6).barcode => { + purpose: 'LCMT DNA Lib PCR', + states: ['pending'], + label: 'Bed 6', + parent: bed(5).barcode, + target_state: 'passed' + } + } + ) + end From f42cd76fc1d338443084e2e6b1f86d62d4716aea Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:31:46 +0100 Subject: [PATCH 091/141] Add Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP --- config/robots.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index d08104e0c..a95230e23 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3951,4 +3951,38 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP + custom_robot( + 'hamilton-lcmt-dna-lib-pcr-to-lcmt-dna-pcr-xp', + name: 'Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP', + verify_robot: false, + beds: { + bed(7).barcode => { + purpose: 'LCMT DNA Lib PCR', + states: ['passed'], + label: 'Bed 7' + }, + bed(9).barcode => { + purpose: 'LCMT DNA PCR XP', + states: ['pending'], + label: 'Bed 9', + parent: bed(7).barcode, + target_state: 'passed' + }, + bed(12).barcode => { + purpose: 'LCMT DNA Lib PCR', + states: ['passed'], + label: 'Bed 12' + }, + bed(14).barcode => { + purpose: 'LCMT DNA PCR XP', + states: ['pending'], + label: 'Bed 14', + parent: bed(12).barcode, + target_state: 'passed' + } + } + ) + end From b632943898a25f842169fc0632e69df50a27e30c Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:35:15 +0100 Subject: [PATCH 092/141] Add Hamilton LCMT EM Lib PCR => LCMT EM PCR XP --- config/robots.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index a95230e23..3d025e3a8 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3985,4 +3985,38 @@ } ) + # LCM Triomics EMSeq Bravo bed verification + # Hamilton LCMT EM Lib PCR => LCMT EM PCR XP + custom_robot( + 'hamilton-lcmt-em-lib-pcr-to-lcmt-em-pcr-xp', + name: 'Hamilton LCMT EM Lib PCR => LCMT EM PCR XP', + verify_robot: false, + beds: { + bed(7).barcode => { + purpose: 'LCMT EM Lib PCR', + states: ['passed'], + label: 'Bed 7' + }, + bed(9).barcode => { + purpose: 'LCMT EM PCR XP', + states: ['pending'], + label: 'Bed 9', + parent: bed(7).barcode, + target_state: 'passed' + }, + bed(12).barcode => { + purpose: 'LCMT EM Lib PCR', + states: ['passed'], + label: 'Bed 12' + }, + bed(14).barcode => { + purpose: 'LCMT EM PCR XP', + states: ['pending'], + label: 'Bed 14', + parent: bed(12).barcode, + target_state: 'passed' + } + } + ) + end From 5593ecd45bf154fd478f92128f275015c0fa5820 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 01:38:38 +0100 Subject: [PATCH 093/141] Prettier --- config/robots.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index 3d025e3a8..a2201b142 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3776,12 +3776,12 @@ 'bravo-verify-initial-setup', name: 'Bravo Verify Initial Setup', beds: { - bed(4).barcode => { + bed(4).barcode => { purpose: 'LCMT Lysate', states: ['passed'], label: 'Bed 4' }, - car('1,4').barcode => { + car('1,4').barcode => { purpose: 'DNA Frag', states: ['pending'], label: 'Carousel 1,4', @@ -3810,7 +3810,7 @@ states: ['pending'], label: 'Carousel 4,3', parent: bed(4).barcode - }, + } } ) @@ -4018,5 +4018,4 @@ } } ) - end From 012012a8762d033915e27fbe54c00bffb52c5c29 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 26 Sep 2024 10:56:51 +0100 Subject: [PATCH 094/141] fix: inline cell_is_blank method --- .../common_file_handling/csv_file/row_base.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/models/labware_creators/common_file_handling/csv_file/row_base.rb b/app/models/labware_creators/common_file_handling/csv_file/row_base.rb index f29870ec2..a0cc9ce96 100644 --- a/app/models/labware_creators/common_file_handling/csv_file/row_base.rb +++ b/app/models/labware_creators/common_file_handling/csv_file/row_base.rb @@ -76,7 +76,7 @@ def check_for_invalid_characters return if empty? @row_data.each_with_index do |cell, i| - next if cell_is_blank?(cell) + next if cell.nil? next if cell_is_valid_utf8?(cell) add_invalid_character_error(i) @@ -85,10 +85,6 @@ def check_for_invalid_characters private - def cell_is_blank?(cell) - cell.nil? - end - def cell_is_valid_utf8?(cell) cell.bytes.all? { |byte| byte < 128 } && cell.dup.force_encoding('UTF-8').valid_encoding? end From 2bf799b963305c78a02707ffdcaca42af0045fda Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 26 Sep 2024 15:07:42 +0100 Subject: [PATCH 095/141] style: set Style/HashSyntax EnforcedShorthandSyntax to consistent --- .rubocop.yml | 5 ++ .../sequencescape_submission_behaviour.rb | 2 +- .../concerns/work_completion_behaviour.rb | 2 +- .../pipeline_work_in_progress_controller.rb | 2 +- app/controllers/qc_files_controller.rb | 2 +- app/controllers/robots_controller.rb | 2 +- app/helpers/barcode_labels_helper.rb | 2 +- app/helpers/page_helper.rb | 4 +- app/helpers/plate_helper.rb | 2 +- .../tagged_plate_behaviour.rb | 2 +- .../concerns/presenters/creation_behaviour.rb | 2 +- .../concerns/presenters/extended_csv.rb | 4 +- app/models/labels/tube_label.rb | 4 +- .../labels/tube_label_traction_compatible.rb | 4 +- .../labware_creators/final_tube_from_plate.rb | 6 +- .../labware_creators/multi_plate_pool.rb | 2 +- .../labware_creators/multi_stamp_tubes.rb | 6 +- .../plate_split_to_tube_racks.rb | 4 +- .../labware_creators/pooled_tubes_base.rb | 2 +- .../pooled_tubes_by_sample.rb | 2 +- .../pooled_tubes_by_submission_with_phi_x.rb | 7 +- .../labware_creators/quadrant_split_plate.rb | 2 +- .../labware_creators/quadrant_stamp_base.rb | 2 +- app/models/limber/qc_file.rb | 2 +- app/models/ongoing_plate.rb | 2 +- app/models/ongoing_tube.rb | 2 +- app/models/print_job.rb | 2 +- .../robots/bed/plate_to_tube_racks_bed.rb | 4 +- app/models/sequencescape_submission.rb | 2 +- app/models/state_changers.rb | 6 +- lib/purpose_config.rb | 6 +- lib/robot_configuration.rb | 12 +-- spec/controllers/exports_controller_spec.rb | 2 +- spec/controllers/plates_controller_spec.rb | 2 +- .../controllers/print_jobs_controller_spec.rb | 2 +- spec/controllers/qc_files_controller_spec.rb | 2 +- ...quencescape_submissions_controller_spec.rb | 4 +- spec/controllers/tubes_controller_spec.rb | 2 +- spec/factories/plate_factories.rb | 14 ++-- .../tag_layout_template_factories.rb | 2 +- spec/factories/transfer_factories.rb | 2 +- spec/factories/tube_factories.rb | 14 ++-- spec/factories/tube_rack_factories.rb | 4 +- spec/factories/well_factories.rb | 12 ++- spec/factory_outputs/plate_factory_spec.rb | 4 +- .../features/cancelling_a_whole_plate_spec.rb | 4 +- .../charge_and_pass_libraries_spec.rb | 6 +- spec/features/creating_a_plate_spec.rb | 14 ++-- ..._quadrant_stamp_primer_panel_plate_spec.rb | 2 +- spec/features/creating_a_tag_plate_spec.rb | 6 +- .../features/creating_plate_with_bait_spec.rb | 2 +- spec/features/failing_a_whole_plate_spec.rb | 4 +- spec/features/failing_quadrants_spec.rb | 9 +- spec/features/failing_thresholds_spec.rb | 4 +- spec/features/failing_wells_spec.rb | 4 +- spec/features/plate_transfer_spec.rb | 4 +- .../pool_tubes_at_end_of_pipeline_spec.rb | 4 +- ...ling_multiple_plates_into_one_tube_spec.rb | 7 +- ...oling_multiple_tubes_into_one_tube_spec.rb | 10 +-- spec/features/viewing_a_plate_spec.rb | 11 ++- spec/helpers/plate_helpers_spec.rb | 4 +- .../labware_creators/baited_plate_spec.rb | 2 +- .../cardinal_pools_plate_spec.rb | 2 +- .../concentration_binned_plate_spec.rb | 4 +- .../concentration_normalised_plate_spec.rb | 4 +- .../custom_tagged_plate_spec.rb | 17 ++-- .../donor_pooling_plate_spec.rb | 2 +- .../final_tube_from_plate_spec.rb | 12 ++- .../labware_creators/final_tube_spec.rb | 12 +-- .../fixed_normalised_plate_spec.rb | 9 +- .../labware_creators/merged_plate_spec.rb | 31 ++++--- .../labware_creators/multi_stamp_spec.rb | 2 +- .../multi_stamp_tubes_spec.rb | 2 +- ...i_stamp_tubes_using_tube_rack_scan_spec.rb | 16 ++-- .../normalised_binned_plate_spec.rb | 9 +- ...ial_stamped_plate_without_dilution_spec.rb | 4 +- ...cycles_binned_plate_for_duplex_seq_spec.rb | 10 ++- ...cycles_binned_plate_for_t_nano_seq_spec.rb | 14 ++-- .../plate_split_to_tube_racks_spec.rb | 84 +++++++++++-------- .../plate_with_primer_panel_spec.rb | 2 +- .../plate_with_template_spec.rb | 11 ++- .../pooled_tubes_by_submission_spec.rb | 2 +- .../pooled_tubes_from_whole_plates_spec.rb | 7 +- .../pooled_tubes_from_whole_tubes_spec.rb | 9 +- .../pooled_wells_by_sample_in_groups_spec.rb | 2 +- .../quadrant_split_plate_spec.rb | 4 +- .../quadrant_stamp_primer_panel_spec.rb | 2 +- .../labware_creators/shared_examples.rb | 2 +- ...d_plate_adding_randomised_controls_spec.rb | 12 +-- .../stamped_plate_compressed_spec.rb | 4 +- ...d_plate_reordering_columns_to_rows_spec.rb | 10 +-- .../labware_creators/stamped_plate_spec.rb | 44 ++++++---- .../labware_creators/tagged_plate_spec.rb | 24 ++++-- .../labware_creators/tube_from_tube_spec.rb | 11 ++- .../well_filter_allowing_partials_spec.rb | 4 +- .../labware_creators/well_filter_spec.rb | 4 +- spec/models/pipeline_list_spec.rb | 24 +++--- spec/models/pipeline_spec.rb | 4 +- ...ncentration_binned_plate_presenter_spec.rb | 13 ++- .../presenters/final_tube_presenter_spec.rb | 4 +- .../minimal_pcr_plate_presenter_spec.rb | 4 +- .../minimal_plate_presenter_spec.rb | 4 +- .../minimal_stock_plate_presenter_spec.rb | 4 +- .../normalised_binned_plate_presenter_spec.rb | 13 ++- ...e_using_request_metadata_presenter_spec.rb | 4 +- ...late_using_well_metadata_presenter_spec.rb | 4 +- .../presenters/permissive_presenter_spec.rb | 2 +- .../models/presenters/plate_presenter_spec.rb | 26 ++++-- .../presenters/rvi_cnda_xp_presenter_spec.rb | 2 +- .../single_child_permissive_presenter_spec.rb | 2 +- .../presenters/standard_presenter_spec.rb | 8 +- .../submission_plate_presenter_spec.rb | 28 +++++-- .../tag_plate_384_presenter_spec.rb | 2 +- spec/models/presenters/tube_presenter_spec.rb | 8 +- .../presenters/tube_rack_presenter_spec.rb | 10 ++- spec/models/print_job_spec.rb | 18 ++-- .../robots/plate_to_tube_racks_robot_spec.rb | 2 +- .../pooling_and_splitting_robot_spec.rb | 12 +-- spec/models/robots/pooling_robot_spec.rb | 12 +-- spec/models/robots/quadrant_robot_spec.rb | 16 ++-- spec/models/robots/robot_spec.rb | 4 +- spec/models/robots/splitting_robot_spec.rb | 6 +- spec/models/robots_spec.rb | 2 +- spec/models/sequencescape_submission_spec.rb | 42 ++++++---- spec/models/state_changers_spec.rb | 8 +- spec/spec_helper.rb | 2 +- spec/support/api_url_helper.rb | 10 +-- spec/support/feature_helpers.rb | 6 +- spec/support/shared_tagging_examples.rb | 2 +- spec/support/with_pmb_stubbed.rb | 4 +- .../exports/bioscan_mbrave.tsv.erb_spec.rb | 8 +- ..._bank_tubes_content_report.csv.erb_spec.rb | 24 +++--- 132 files changed, 611 insertions(+), 394 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 599363460..ace6b1f7c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -22,6 +22,11 @@ Rails/FindBy: Enabled: false Style/ClassAndModuleChildren: Enabled: false + +# Only use shorthand hash syntax when all keys match the variables for better readability +Style/HashSyntax: + EnforcedShorthandSyntax: consistent + # Filter out all the DSLs Metrics/BlockLength: CountAsOne: diff --git a/app/controllers/concerns/sequencescape_submission_behaviour.rb b/app/controllers/concerns/sequencescape_submission_behaviour.rb index 6a9087457..7c02af9bb 100644 --- a/app/controllers/concerns/sequencescape_submission_behaviour.rb +++ b/app/controllers/concerns/sequencescape_submission_behaviour.rb @@ -21,6 +21,6 @@ def sequencescape_submission_parameters params .require(:sequencescape_submission) .permit(:template_uuid, :labware_barcode, request_options: {}, assets: [], asset_groups: {}, extra_barcodes: []) - .merge(api:, user: current_user_uuid) + .merge(api: api, user: current_user_uuid) end end diff --git a/app/controllers/concerns/work_completion_behaviour.rb b/app/controllers/concerns/work_completion_behaviour.rb index d45a151e6..8f2774b9e 100644 --- a/app/controllers/concerns/work_completion_behaviour.rb +++ b/app/controllers/concerns/work_completion_behaviour.rb @@ -35,6 +35,6 @@ def sequencescape_submission_parameters params .require(:sequencescape_submission) .permit(:template_uuid, request_options: {}, assets: []) - .merge(api:, user: current_user_uuid) + .merge(api: api, user: current_user_uuid) end end diff --git a/app/controllers/pipeline_work_in_progress_controller.rb b/app/controllers/pipeline_work_in_progress_controller.rb index c7624734f..3bf405aa5 100644 --- a/app/controllers/pipeline_work_in_progress_controller.rb +++ b/app/controllers/pipeline_work_in_progress_controller.rb @@ -84,7 +84,7 @@ def mould_data_for_view(purposes, labware_records) state = decide_state(rec) next if state == 'cancelled' - output[rec.purpose.name] << { record: rec, state: } + output[rec.purpose.name] << { record: rec, state: state } end end end diff --git a/app/controllers/qc_files_controller.rb b/app/controllers/qc_files_controller.rb index 390820d54..79d65f752 100644 --- a/app/controllers/qc_files_controller.rb +++ b/app/controllers/qc_files_controller.rb @@ -17,7 +17,7 @@ def index def show response = api.qc_file.find(params[:id]).retrieve filename = /filename="([^"]*)"/.match(response['Content-Disposition'])[1] || 'unnamed_file' - send_data(response.body, filename:, type: 'sequencescape/qc_file') + send_data(response.body, filename: filename, type: 'sequencescape/qc_file') end def create diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb index 1b119511d..79fdbbf8a 100644 --- a/app/controllers/robots_controller.rb +++ b/app/controllers/robots_controller.rb @@ -92,7 +92,7 @@ def robot_params end def find_robot - @robot = Robots.find(id: params[:id], api:, user_uuid: current_user_uuid) + @robot = Robots.find(id: params[:id], api: api, user_uuid: current_user_uuid) end def stripped_beds diff --git a/app/helpers/barcode_labels_helper.rb b/app/helpers/barcode_labels_helper.rb index 11e0eb850..7446ace27 100644 --- a/app/helpers/barcode_labels_helper.rb +++ b/app/helpers/barcode_labels_helper.rb @@ -20,7 +20,7 @@ def barcode_printing_form( # Is redirection_url needed? locals = { print_job:, printers:, labels:, redirection_url: } - render(partial: 'labware/barcode_printing_form', locals:) + render(partial: 'labware/barcode_printing_form', locals: locals) end def printers_of_type(printer_types) diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index 2303d8717..49f774667 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -13,7 +13,7 @@ def grouping(_data_role, options = {}, &) # Renders the content in the block in the # standard page template, including heading flash and sidebar def page(id, css_class = nil, prevent_row: false, &block) - grouping(:page, id:, class: "container-fluid #{css_class}") do + grouping(:page, id: id, class: "container-fluid #{css_class}") do if prevent_row concat yield else @@ -33,7 +33,7 @@ def sidebar(&) end def card(title: nil, css_class: '', without_block: false, id: nil, &block) - tag.div(class: "card #{css_class}", id:) do + tag.div(class: "card #{css_class}", id: id) do concat tag.h3(title, class: 'card-header') if title if without_block yield diff --git a/app/helpers/plate_helper.rb b/app/helpers/plate_helper.rb index f5699e2d4..6f0f78fd3 100644 --- a/app/helpers/plate_helper.rb +++ b/app/helpers/plate_helper.rb @@ -60,7 +60,7 @@ def sorted_pre_cap_pool_json(current_plate) # rubocop:todo Metrics/AbcSize next unless request.pre_capture_pool pool_id = request.pre_capture_pool.id - pool_store[pool_id] ||= { pool_id:, order_id: request.order_id, wells: [] } + pool_store[pool_id] ||= { pool_id: pool_id, order_id: request.order_id, wells: [] } pool_store[pool_id][:wells] << well.location end end diff --git a/app/models/concerns/labware_creators/tagged_plate_behaviour.rb b/app/models/concerns/labware_creators/tagged_plate_behaviour.rb index 1ef6116c4..0356e6c58 100644 --- a/app/models/concerns/labware_creators/tagged_plate_behaviour.rb +++ b/app/models/concerns/labware_creators/tagged_plate_behaviour.rb @@ -21,7 +21,7 @@ def flag_tag_plate_as_exhausted reason: 'Used in Library creation', target_state: 'exhausted', target_uuid: tag_plate.asset_uuid, - user_uuid: + user_uuid: user_uuid ) end diff --git a/app/models/concerns/presenters/creation_behaviour.rb b/app/models/concerns/presenters/creation_behaviour.rb index 385ce117a..2e0ba7204 100644 --- a/app/models/concerns/presenters/creation_behaviour.rb +++ b/app/models/concerns/presenters/creation_behaviour.rb @@ -29,7 +29,7 @@ def construct_buttons(scope) creator: LabwareCreators.class_for(purpose_uuid), parent_uuid: uuid, parent: labware, - purpose_uuid:, + purpose_uuid: purpose_uuid, name: purpose_settings.name, type: purpose_settings.asset_type, filters: purpose_settings.filters || {} diff --git a/app/models/concerns/presenters/extended_csv.rb b/app/models/concerns/presenters/extended_csv.rb index 208920d3f..bf634d05a 100644 --- a/app/models/concerns/presenters/extended_csv.rb +++ b/app/models/concerns/presenters/extended_csv.rb @@ -20,8 +20,8 @@ def each_well_transfer(offset = 0) # rubocop:todo Metrics/AbcSize { index: (index += 1), name: "#{bed_prefix}#{(offset * 4) + bed_index + 1}", - source_well:, - destination_well: + source_well: source_well, + destination_well: destination_well }.merge(transfers_list) ) end diff --git a/app/models/labels/tube_label.rb b/app/models/labels/tube_label.rb index 4f18c3015..6a992d43b 100644 --- a/app/models/labels/tube_label.rb +++ b/app/models/labels/tube_label.rb @@ -6,8 +6,8 @@ def attributes # because otherwise we will lose important information about wells # if each well takes 3 (not 2) characters, like E10:H10, for example { - first_line:, - second_line:, + first_line: first_line, + second_line: second_line, third_line: labware.purpose_name, fourth_line: date_today, round_label_top_line: labware.barcode.prefix, diff --git a/app/models/labels/tube_label_traction_compatible.rb b/app/models/labels/tube_label_traction_compatible.rb index 93687391e..8499aa823 100644 --- a/app/models/labels/tube_label_traction_compatible.rb +++ b/app/models/labels/tube_label_traction_compatible.rb @@ -27,8 +27,8 @@ class Labels::TubeLabelTractionCompatible < Labels::TubeLabel def attributes { - first_line:, - second_line:, + first_line: first_line, + second_line: second_line, third_line: labware.purpose_name, fourth_line: date_today, round_label_top_line: labware.barcode.prefix, diff --git a/app/models/labware_creators/final_tube_from_plate.rb b/app/models/labware_creators/final_tube_from_plate.rb index 7fca03be6..7c0949aaf 100644 --- a/app/models/labware_creators/final_tube_from_plate.rb +++ b/app/models/labware_creators/final_tube_from_plate.rb @@ -48,7 +48,11 @@ def pass_tubes! raise StandardError, 'Tubes cannot be passed before transfer' if @create_transfer.nil? tubes_from_transfer.each do |tube_uuid| - Sequencescape::Api::V2::StateChange.create!(target_state: 'passed', target_uuid: tube_uuid, user_uuid:) + Sequencescape::Api::V2::StateChange.create!( + target_state: 'passed', + target_uuid: tube_uuid, + user_uuid: user_uuid + ) end end diff --git a/app/models/labware_creators/multi_plate_pool.rb b/app/models/labware_creators/multi_plate_pool.rb index 05ed24229..6beeaacc5 100644 --- a/app/models/labware_creators/multi_plate_pool.rb +++ b/app/models/labware_creators/multi_plate_pool.rb @@ -22,7 +22,7 @@ def create_labware! @child = plate_creation.child - api.bulk_transfer.create!(user: user_uuid, well_transfers:) + api.bulk_transfer.create!(user: user_uuid, well_transfers: well_transfers) yield(@child) if block_given? true diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 51608f418..aa3b153d0 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -160,8 +160,10 @@ def create_submission_from_parent_tubes sequencescape_submission_parameters = { template_name: configured_params[:template_name], request_options: configured_params[:request_options], - asset_groups: [{ assets: asset_uuids, autodetect_studies:, autodetect_projects: }], - api:, + asset_groups: [ + { assets: asset_uuids, autodetect_studies: autodetect_studies, autodetect_projects: autodetect_projects } + ], + api: api, user: user_uuid } diff --git a/app/models/labware_creators/plate_split_to_tube_racks.rb b/app/models/labware_creators/plate_split_to_tube_racks.rb index e476eb7d5..c69c8300e 100644 --- a/app/models/labware_creators/plate_split_to_tube_racks.rb +++ b/app/models/labware_creators/plate_split_to_tube_racks.rb @@ -414,7 +414,7 @@ def create_tubes(tube_purpose_uuid, number_of_tubes, tube_attributes) user: user_uuid, parent: parent_uuid, child_purposes: [tube_purpose_uuid] * number_of_tubes, - tube_attributes: + tube_attributes: tube_attributes ) .children .index_by(&:name) @@ -654,7 +654,7 @@ def add_contingency_tube_metadata # @param tube_details [Hash] The tube details hash from the tube rack scan file. # @return [void] def add_tube_metadata(child_tube, tube_posn, tube_details) - LabwareMetadata.new(user_uuid:, barcode: child_tube.barcode.machine).update!( + LabwareMetadata.new(user_uuid: user_uuid, barcode: child_tube.barcode.machine).update!( tube_rack_barcode: tube_details['tube_rack_barcode'], tube_rack_position: tube_posn ) diff --git a/app/models/labware_creators/pooled_tubes_base.rb b/app/models/labware_creators/pooled_tubes_base.rb index 90f6e5965..f7dbe4bfb 100644 --- a/app/models/labware_creators/pooled_tubes_base.rb +++ b/app/models/labware_creators/pooled_tubes_base.rb @@ -26,7 +26,7 @@ def create_child_stock_tubes user: user_uuid, parent: parent_uuid, child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: + tube_attributes: tube_attributes ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_by_sample.rb b/app/models/labware_creators/pooled_tubes_by_sample.rb index 6b9e84a5e..3eafcf7dc 100644 --- a/app/models/labware_creators/pooled_tubes_by_sample.rb +++ b/app/models/labware_creators/pooled_tubes_by_sample.rb @@ -53,7 +53,7 @@ def create_child_stock_tubes user: user_uuid, parent: parent_uuid, child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: + tube_attributes: tube_attributes ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index a2aedacce..f0d6103f0 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -17,7 +17,12 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission def create_child_stock_tubes api .specific_tube_creation - .create!(user: user_uuid, parents:, child_purposes: [purpose_uuid] * pool_uuids.length, tube_attributes:) + .create!( + user: user_uuid, + parents: parents, + child_purposes: [purpose_uuid] * pool_uuids.length, + tube_attributes: tube_attributes + ) .children .index_by(&:name) end diff --git a/app/models/labware_creators/quadrant_split_plate.rb b/app/models/labware_creators/quadrant_split_plate.rb index d2fae00ff..befb86a62 100644 --- a/app/models/labware_creators/quadrant_split_plate.rb +++ b/app/models/labware_creators/quadrant_split_plate.rb @@ -45,7 +45,7 @@ def add_stock_barcode_metadata(plates) # rubocop:todo Metrics/AbcSize metadata = LabwareMetadata.new(barcode: merger_plate.barcode.machine).metadata plates.each_with_index do |plate, index| stock_barcode = stock_barcode_from_quadrant(index, metadata) || "* #{plate.barcode.human}" - LabwareMetadata.new(user_uuid:, barcode: plate.barcode.machine).update!(stock_barcode:) + LabwareMetadata.new(user_uuid: user_uuid, barcode: plate.barcode.machine).update!(stock_barcode:) end end diff --git a/app/models/labware_creators/quadrant_stamp_base.rb b/app/models/labware_creators/quadrant_stamp_base.rb index 2cf134dc8..87c0d3b99 100644 --- a/app/models/labware_creators/quadrant_stamp_base.rb +++ b/app/models/labware_creators/quadrant_stamp_base.rb @@ -36,7 +36,7 @@ class QuadrantStampBase < MultiStamp def create_labware! super do |child| - LabwareMetadata.new(user_uuid:, labware: child).update!(stock_barcodes_by_quadrant) + LabwareMetadata.new(user_uuid: user_uuid, labware: child).update!(stock_barcodes_by_quadrant) yield(child) if block_given? end end diff --git a/app/models/limber/qc_file.rb b/app/models/limber/qc_file.rb index 90bd1b228..6e3094a8f 100644 --- a/app/models/limber/qc_file.rb +++ b/app/models/limber/qc_file.rb @@ -4,6 +4,6 @@ class Limber::QcFile < Sequencescape::QcFile # rubocop:todo Style/Documentation # Done this here for the moment, could look at using # ActiveModel::Serializers in future. def as_json(_args) - { filename:, size:, uuid:, created: created_at.to_fs(:long) } + { filename: filename, size: size, uuid: uuid, created: created_at.to_fs(:long) } end end diff --git a/app/models/ongoing_plate.rb b/app/models/ongoing_plate.rb index a470769c1..b47397afe 100644 --- a/app/models/ongoing_plate.rb +++ b/app/models/ongoing_plate.rb @@ -10,7 +10,7 @@ def search_parameters plate_purpose_uuids: purpose_uuids, show_my_plates_only: show_my_plates_only == '1', include_used: include_used == '1', - page: + page: page } end diff --git a/app/models/ongoing_tube.rb b/app/models/ongoing_tube.rb index c304564c5..578a9934c 100644 --- a/app/models/ongoing_tube.rb +++ b/app/models/ongoing_tube.rb @@ -9,7 +9,7 @@ def search_parameters states: states || %w[pending started passed qc_complete failed cancelled], tube_purpose_uuids: purpose_uuids, include_used: include_used == '1', - page: + page: page } end diff --git a/app/models/print_job.rb b/app/models/print_job.rb index d383ffc18..f1a7eeae3 100644 --- a/app/models/print_job.rb +++ b/app/models/print_job.rb @@ -26,7 +26,7 @@ def execute def print_to_pmb job = PMB::PrintJob.new( - printer_name:, + printer_name: printer_name, label_template_id: pmb_label_template_id, labels: { body: (labels * number_of_copies) diff --git a/app/models/robots/bed/plate_to_tube_racks_bed.rb b/app/models/robots/bed/plate_to_tube_racks_bed.rb index aa3d3c928..02e360c84 100644 --- a/app/models/robots/bed/plate_to_tube_racks_bed.rb +++ b/app/models/robots/bed/plate_to_tube_racks_bed.rb @@ -17,7 +17,9 @@ class PlateToTubeRacksBed < Robots::Bed::Base def labware_created_with_robot(robot_barcode) # RobotController uses machine barcode for initialising LabwareMetadata labware.tubes.each do |tube| - LabwareMetadata.new(user_uuid:, barcode: tube.barcode.machine).update!(created_with_robot: robot_barcode) + LabwareMetadata.new(user_uuid: user_uuid, barcode: tube.barcode.machine).update!( + created_with_robot: robot_barcode + ) end end diff --git a/app/models/sequencescape_submission.rb b/app/models/sequencescape_submission.rb index 3ffd1e713..911130a55 100644 --- a/app/models/sequencescape_submission.rb +++ b/app/models/sequencescape_submission.rb @@ -125,7 +125,7 @@ def generate_orders # rubocop:disable Metrics/AbcSize def generate_submissions orders = generate_orders - submission = api.submission.create!(orders: orders.map(&:uuid), user:) + submission = api.submission.create!(orders: orders.map(&:uuid), user: user) @submission_uuid = submission.uuid submission.submit! true diff --git a/app/models/state_changers.rb b/app/models/state_changers.rb index f2c22741f..b0e33c72e 100644 --- a/app/models/state_changers.rb +++ b/app/models/state_changers.rb @@ -26,11 +26,11 @@ def initialize(api, labware_uuid, user_uuid) def move_to!(state, reason = nil, customer_accepts_responsibility = false) Sequencescape::Api::V2::StateChange.create!( contents: contents_for(state), - customer_accepts_responsibility:, - reason:, + customer_accepts_responsibility: customer_accepts_responsibility, + reason: reason, target_state: state, target_uuid: labware_uuid, - user_uuid: + user_uuid: user_uuid ) end diff --git a/lib/purpose_config.rb b/lib/purpose_config.rb index f08522d3f..15761045b 100644 --- a/lib/purpose_config.rb +++ b/lib/purpose_config.rb @@ -44,7 +44,7 @@ def initialize(name, options, store, submission_templates, label_template_config def config { - name:, + name: name, **default_options, state_changer_class: default_state_changer, submission: submission_options, @@ -82,7 +82,7 @@ class Tube < PurposeConfig # rubocop:todo Style/Documentation def register! puts "Creating #{name}" - options_for_creation = { name:, target_type: @options.fetch(:target), purpose_type: @options.fetch(:type) } + options_for_creation = { name: name, target_type: @options.fetch(:target), purpose_type: @options.fetch(:type) } Sequencescape::Api::V2::TubePurpose.create!(options_for_creation) end end @@ -110,7 +110,7 @@ def register! # asset_shape option if configured. It raises an error if the purpose # cannot be created. options_for_creation = { - name:, + name: name, stock_plate: config.fetch(:stock_plate, false), cherrypickable_target: config.fetch(:cherrypickable_target, false), input_plate: config.fetch(:input_plate, false), diff --git a/lib/robot_configuration.rb b/lib/robot_configuration.rb index d17f7f711..a9a09903b 100644 --- a/lib/robot_configuration.rb +++ b/lib/robot_configuration.rb @@ -6,14 +6,14 @@ module RobotConfiguration module BedHelpers # rubocop:todo Style/Documentation def bed(number) - barcode = SBCF::SangerBarcode.new(prefix: 'BD', number:) + barcode = SBCF::SangerBarcode.new(prefix: 'BD', number: number) ean13 = barcode.machine_barcode.to_s BedOrCar.new(ean13, "Bed #{number}") end def car(position) number = position.tr(',', '').to_i - barcode = SBCF::SangerBarcode.new(prefix: 'BD', number:) + barcode = SBCF::SangerBarcode.new(prefix: 'BD', number: number) ean13 = barcode.machine_barcode.to_s BedOrCar.new(ean13, "Carousel #{position}") end @@ -112,9 +112,9 @@ def key def configuration { - name:, - verify_robot:, - require_robot:, + name: name, + verify_robot: verify_robot, + require_robot: require_robot, beds: { source_bed_barcode => { purpose: source_purpose, @@ -127,7 +127,7 @@ def configuration states: [target_bed_state], label: target_bed_name, parent: source_bed_barcode, - target_state: + target_state: target_state } } } diff --git a/spec/controllers/exports_controller_spec.rb b/spec/controllers/exports_controller_spec.rb index bd2013c92..ea19c1de2 100644 --- a/spec/controllers/exports_controller_spec.rb +++ b/spec/controllers/exports_controller_spec.rb @@ -272,7 +272,7 @@ it 'sets the correct filename' do page = 0 - get :show, params: { id: csv_id, limber_plate_id: plate_barcode, page: }, as: :csv + get :show, params: { id: csv_id, limber_plate_id: plate_barcode, page: page }, as: :csv expect( @response.headers['Content-Disposition'].include?( "filename=\"cellaca_input_file_#{plate_barcode}_#{page + 1}.csv\"" diff --git a/spec/controllers/plates_controller_spec.rb b/spec/controllers/plates_controller_spec.rb index 27a3e5c02..a574ae102 100644 --- a/spec/controllers/plates_controller_spec.rb +++ b/spec/controllers/plates_controller_spec.rb @@ -16,7 +16,7 @@ def expect_state_change_create(attributes) expect_api_v2_posts( 'StateChange', - [{ target_state: 'failed', target_uuid: plate_uuid, user_uuid: }.merge(attributes)] + [{ target_state: 'failed', target_uuid: plate_uuid, user_uuid: user_uuid }.merge(attributes)] ) end diff --git a/spec/controllers/print_jobs_controller_spec.rb b/spec/controllers/print_jobs_controller_spec.rb index 14a3c50c2..f295256f7 100644 --- a/spec/controllers/print_jobs_controller_spec.rb +++ b/spec/controllers/print_jobs_controller_spec.rb @@ -29,7 +29,7 @@ allow(PrintJob).to receive(:new).and_return(print_job_mock) allow(print_job_mock).to receive(:execute).and_return(true) - post :create, params:, format: :json + post :create, params: params, format: :json assert assigns(:print_job) assert_equal 'Your label(s) have been sent to tube printer 1', flash.notice diff --git a/spec/controllers/qc_files_controller_spec.rb b/spec/controllers/qc_files_controller_spec.rb index 08a27646c..22ba6cf95 100644 --- a/spec/controllers/qc_files_controller_spec.rb +++ b/spec/controllers/qc_files_controller_spec.rb @@ -11,7 +11,7 @@ let(:filename) { 'my_holiday.jpg' } before do - stub_api_get(file_uuid, body: json(:qc_file, uuid: file_uuid, filename:)) + stub_api_get(file_uuid, body: json(:qc_file, uuid: file_uuid, filename: filename)) stub_request(:get, api_url_for(file_uuid)).with(headers: { 'Accept' => 'sequencescape/qc_file' }).to_return( body: 'example file content', headers: { diff --git a/spec/controllers/sequencescape_submissions_controller_spec.rb b/spec/controllers/sequencescape_submissions_controller_spec.rb index 7f87f151a..763dfae01 100644 --- a/spec/controllers/sequencescape_submissions_controller_spec.rb +++ b/spec/controllers/sequencescape_submissions_controller_spec.rb @@ -40,8 +40,8 @@ 'orders', payload: { order: { - assets:, - request_options:, + assets: assets, + request_options: request_options, user: user_uuid } }, diff --git a/spec/controllers/tubes_controller_spec.rb b/spec/controllers/tubes_controller_spec.rb index bda03db83..eb8adcf78 100644 --- a/spec/controllers/tubes_controller_spec.rb +++ b/spec/controllers/tubes_controller_spec.rb @@ -44,7 +44,7 @@ reason: 'Because testing', target_state: 'cancelled', target_uuid: tube_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/factories/plate_factories.rb b/spec/factories/plate_factories.rb index b4cd3cc6c..0b0aefe38 100644 --- a/spec/factories/plate_factories.rb +++ b/spec/factories/plate_factories.rb @@ -49,7 +49,7 @@ pcr_cycles: pool_prc_cycles[index], state: library_state[index], submission_id: index, - include_submissions:, + include_submissions: include_submissions, order_id: index * 2, uuid: "request-#{request_index += 1}" end @@ -71,14 +71,14 @@ Array.new(well_count) do |i| location = WellHelpers.well_at_column_index(i, size) create well_factory, - location:, + location: location, state: well_states[i] || state, outer_request: outer_requests[i], downstream_tubes: transfer_targets[location], uuid: well_uuid_result % location, aliquot_count: outer_requests[i] ? 1 : aliquots_without_requests, - study:, - project: + study: study, + project: project end end @@ -248,14 +248,14 @@ Array.new(well_count) do |i| location = WellHelpers.well_at_column_index(i, size) create well_factory, - location:, + location: location, state: well_states[i] || state, outer_request: nil, downstream_tubes: nil, uuid: well_uuid_result % location, aliquot_count: 0, - study:, - project: + study: study, + project: project end end end diff --git a/spec/factories/tag_layout_template_factories.rb b/spec/factories/tag_layout_template_factories.rb index 01754411a..678ec581e 100644 --- a/spec/factories/tag_layout_template_factories.rb +++ b/spec/factories/tag_layout_template_factories.rb @@ -109,7 +109,7 @@ tag_layout_templates do Array.new(size) do |i| - associated(template_factory, uuid: "tag-layout-template-#{i}", name: "Tag2 layout #{i}", direction:) + associated(template_factory, uuid: "tag-layout-template-#{i}", name: "Tag2 layout #{i}", direction: direction) end end diff --git a/spec/factories/transfer_factories.rb b/spec/factories/transfer_factories.rb index 8c9510bdc..b7b451be5 100644 --- a/spec/factories/transfer_factories.rb +++ b/spec/factories/transfer_factories.rb @@ -157,7 +157,7 @@ transfer_factory { :creation_transfer } end - transfers { sources.map { |source| associated(transfer_factory, source:, destination: plate) } } + transfers { sources.map { |source| associated(transfer_factory, source: source, destination: plate) } } end end end diff --git a/spec/factories/tube_factories.rb b/spec/factories/tube_factories.rb index 78909e056..34575815d 100644 --- a/spec/factories/tube_factories.rb +++ b/spec/factories/tube_factories.rb @@ -53,7 +53,7 @@ factory :tube_without_siblings do json_root { 'tube' } - sibling_tubes { [{ name:, uuid:, ean13_barcode: ean13, state: }] } + sibling_tubes { [{ name: name, uuid: uuid, ean13_barcode: ean13, state: state }] } end factory :tube_with_siblings do @@ -73,7 +73,7 @@ end end - sibling_tubes { [{ name:, uuid:, ean13_barcode: ean13, state: }] + other_siblings } + sibling_tubes { [{ name: name, uuid: uuid, ean13_barcode: ean13, state: state }] + other_siblings } end end @@ -98,7 +98,7 @@ state { 'passed' } purpose_name { 'example-purpose' } purpose_uuid { 'example-purpose-uuid' } - receptacle { create(:v2_receptacle, qc_results: [], aliquots:) } + receptacle { create(:v2_receptacle, qc_results: [], aliquots: aliquots) } created_at { '2017-06-29T09:31:59.000+01:00' } updated_at { '2017-06-29T09:31:59.000+01:00' } @@ -108,7 +108,7 @@ barcode_prefix { 'NT' } library_state { 'pending' } priority { 0 } - outer_request { create request_factory, state: library_state, priority: } + outer_request { create request_factory, state: library_state, priority: priority } request_factory { :library_request } aliquot_count { 2 } aliquot_factory { :v2_tagged_aliquot } @@ -178,7 +178,9 @@ tube_factory { :multiplexed_library_tube } study_count { 1 } end - children { Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count:) } } + children do + Array.new(size) { |i| associated(tube_factory, uuid: "tube-#{i}", name: names[i], study_count: study_count) } + end end factory :tube_collection_with_barcodes_specified do @@ -192,7 +194,7 @@ associated( tube_factory, uuid: "tube-#{uuid_index_offset + i}", - barcode_prefix:, + barcode_prefix: barcode_prefix, barcode_number: barcode_numbers[i], name: names[i] ) diff --git a/spec/factories/tube_rack_factories.rb b/spec/factories/tube_rack_factories.rb index cabb37717..807f3a847 100644 --- a/spec/factories/tube_rack_factories.rb +++ b/spec/factories/tube_rack_factories.rb @@ -20,7 +20,9 @@ purpose { create :v2_purpose, name: purpose_name, uuid: purpose_uuid } tubes { {} } - racked_tubes { tubes.map { |coordinate, tube| create :racked_tube, coordinate:, tube:, tube_rack: instance } } + racked_tubes do + tubes.map { |coordinate, tube| create :racked_tube, coordinate: coordinate, tube: tube, tube_rack: instance } + end end id diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 2d4e50aed..2d96e7373 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -193,10 +193,16 @@ wells do locations.each_with_index.map do |location, i| if empty_wells.include?(location) - associated(:empty_well, location:, uuid: "example-well-uuid-#{i}") + associated(:empty_well, location: location, uuid: "example-well-uuid-#{i}") else state = custom_state[location] || default_state - associated(:well, location:, uuid: "example-well-uuid-#{i}", state:, aliquot_factory:) + associated( + :well, + location: location, + uuid: "example-well-uuid-#{i}", + state: state, + aliquot_factory: aliquot_factory + ) end end end @@ -210,7 +216,7 @@ tag2 { {} } suboptimal { false } - sample { associated(:sample, name: sample_name, sample_id:, uuid: sample_uuid) } + sample { associated(:sample, name: sample_name, sample_id: sample_id, uuid: sample_uuid) } transient do sample_name { 'sample' } diff --git a/spec/factory_outputs/plate_factory_spec.rb b/spec/factory_outputs/plate_factory_spec.rb index 99e6f1a64..d165b1baf 100644 --- a/spec/factory_outputs/plate_factory_spec.rb +++ b/spec/factory_outputs/plate_factory_spec.rb @@ -180,7 +180,7 @@ RSpec.describe 'v2_plate' do context 'with specified study and project at plate level' do - subject { create(:v2_plate, aliquots_without_requests: 1, study:, project:) } + subject { create(:v2_plate, aliquots_without_requests: 1, study: study, project: project) } # study let(:study_uuid) { SecureRandom.uuid } @@ -222,7 +222,7 @@ RSpec.describe 'v2_plate_for_submission' do context 'with specified study and project at plate level' do - subject { create(:v2_plate_for_submission, aliquots_without_requests: 1, study:, project:) } + subject { create(:v2_plate_for_submission, aliquots_without_requests: 1, study: study, project: project) } # study let(:study_uuid) { SecureRandom.uuid } diff --git a/spec/features/cancelling_a_whole_plate_spec.rb b/spec/features/cancelling_a_whole_plate_spec.rb index 4837eb771..b5907df0a 100644 --- a/spec/features/cancelling_a_whole_plate_spec.rb +++ b/spec/features/cancelling_a_whole_plate_spec.rb @@ -20,7 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells end let(:old_api_example_plate) do json :plate, barcode_number: example_plate.labware_barcode.number, uuid: plate_uuid, state: 'passed' @@ -132,7 +132,7 @@ def expect_state_change_create reason: 'Not required', target_state: 'cancelled', target_uuid: plate_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/features/charge_and_pass_libraries_spec.rb b/spec/features/charge_and_pass_libraries_spec.rb index 1ad692cf3..f9d2f998f 100644 --- a/spec/features/charge_and_pass_libraries_spec.rb +++ b/spec/features/charge_and_pass_libraries_spec.rb @@ -10,7 +10,9 @@ let(:user_swipecard) { 'abcdef' } let(:labware_barcode) { SBCF::SangerBarcode.new(prefix: 'DN', number: 1).machine_barcode.to_s } let(:labware_uuid) { SecureRandom.uuid } - let(:work_completion_request) { { 'work_completion' => { target: labware_uuid, submissions:, user: user_uuid } } } + let(:work_completion_request) do + { 'work_completion' => { target: labware_uuid, submissions: submissions, user: user_uuid } } + end let(:work_completion) { json :work_completion } let(:template_uuid) { SecureRandom.uuid } @@ -65,7 +67,7 @@ payload: { order: { assets: [labware_uuid], - request_options:, + request_options: request_options, user: user_uuid } }, diff --git a/spec/features/creating_a_plate_spec.rb b/spec/features/creating_a_plate_spec.rb index a3eeec60f..be4bbe800 100644 --- a/spec/features/creating_a_plate_spec.rb +++ b/spec/features/creating_a_plate_spec.rb @@ -29,18 +29,22 @@ end let(:example_plate) do - create :v2_stock_plate, barcode_number: 6, uuid: plate_uuid, wells:, purpose_name: 'Limber Cherrypicked' + create :v2_stock_plate, barcode_number: 6, uuid: plate_uuid, wells: wells, purpose_name: 'Limber Cherrypicked' end let(:another_plate) do - create :v2_stock_plate, barcode_number: 106, uuid: another_plate_uuid, wells:, purpose_name: 'Limber Cherrypicked' + create :v2_stock_plate, + barcode_number: 106, + uuid: another_plate_uuid, + wells: wells, + purpose_name: 'Limber Cherrypicked' end let(:alternative_plate) do create :v2_stock_plate, barcode_number: 107, uuid: another_plate_uuid, - wells:, + wells: wells, purpose_name: alternative_purpose_name end @@ -69,7 +73,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -93,7 +97,7 @@ # Set-up the plate config create :purpose_config, uuid: example_plate.purpose.uuid create(:purpose_config, name: child_purpose_name, uuid: 'child-purpose-0') - create(:pipeline, relationships: { 'Limber Cherrypicked' => child_purpose_name }, filters:) + create(:pipeline, relationships: { 'Limber Cherrypicked' => child_purpose_name }, filters: filters) # We look up the user stub_swipecard_search(user_swipecard, user) diff --git a/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb b/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb index 928979609..3e3d05d94 100644 --- a/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb +++ b/spec/features/creating_a_quadrant_stamp_primer_panel_plate_spec.rb @@ -86,7 +86,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/features/creating_a_tag_plate_spec.rb b/spec/features/creating_a_tag_plate_spec.rb index 79aa1b37d..b217d147b 100644 --- a/spec/features/creating_a_tag_plate_spec.rb +++ b/spec/features/creating_a_tag_plate_spec.rb @@ -53,7 +53,7 @@ :tagged_purpose_config, tag_layout_templates: acceptable_templates, uuid: child_purpose_uuid, - enforce_same_template_within_pool: + enforce_same_template_within_pool: enforce_same_template_within_pool ) create :pipeline, relationships: { 'Limber Cherrypicked' => 'Tag Purpose' } @@ -87,10 +87,10 @@ 'Transfer', [ { - user_uuid:, + user_uuid: user_uuid, source_uuid: plate_uuid, destination_uuid: tag_plate_uuid, - transfer_template_uuid:, + transfer_template_uuid: transfer_template_uuid, transfers: expected_transfers } ] diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index e080127fa..d7625dd66 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -75,7 +75,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/features/failing_a_whole_plate_spec.rb b/spec/features/failing_a_whole_plate_spec.rb index 36c86eac4..22f2c8cf1 100644 --- a/spec/features/failing_a_whole_plate_spec.rb +++ b/spec/features/failing_a_whole_plate_spec.rb @@ -20,7 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells end let(:old_api_example_plate) do json :plate, barcode_number: example_plate.labware_barcode.number, uuid: plate_uuid, state: 'passed' @@ -132,7 +132,7 @@ def expect_state_change_create reason: 'Power failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/features/failing_quadrants_spec.rb b/spec/features/failing_quadrants_spec.rb index dbd1fe632..35765001a 100644 --- a/spec/features/failing_quadrants_spec.rb +++ b/spec/features/failing_quadrants_spec.rb @@ -20,7 +20,12 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells:, size: 384 + create :v2_plate, + uuid: plate_uuid, + purpose_uuid: 'stock-plate-purpose-uuid', + state: 'passed', + wells: wells, + size: 384 end let(:state_change_attributes) do @@ -30,7 +35,7 @@ reason: 'Individual Well Failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: + user_uuid: user_uuid } end diff --git a/spec/features/failing_thresholds_spec.rb b/spec/features/failing_thresholds_spec.rb index 380e4568b..116a3a1d2 100644 --- a/spec/features/failing_thresholds_spec.rb +++ b/spec/features/failing_thresholds_spec.rb @@ -22,7 +22,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells end # Setup stubs @@ -68,7 +68,7 @@ reason: 'Individual Well Failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/features/failing_wells_spec.rb b/spec/features/failing_wells_spec.rb index a14c1d59e..f7072b5c4 100644 --- a/spec/features/failing_wells_spec.rb +++ b/spec/features/failing_wells_spec.rb @@ -20,7 +20,7 @@ ] end let(:example_plate) do - create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: + create :v2_plate, uuid: plate_uuid, purpose_uuid: 'stock-plate-purpose-uuid', state: 'passed', wells: wells end # Setup stubs @@ -57,7 +57,7 @@ reason: 'Individual Well Failure', target_state: 'failed', target_uuid: plate_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/features/plate_transfer_spec.rb b/spec/features/plate_transfer_spec.rb index 83da34d9f..5aac74c18 100644 --- a/spec/features/plate_transfer_spec.rb +++ b/spec/features/plate_transfer_spec.rb @@ -35,7 +35,7 @@ purpose_uuid: 'lb_end_prep_uuid', state: 'started', barcode_number: 1, - custom_metadatum_collection: + custom_metadatum_collection: custom_metadatum_collection end let(:settings) { YAML.load_file(Rails.root.join('spec/data/settings.yml')).with_indifferent_access } @@ -56,7 +56,7 @@ reason: 'Robot bravo LB Post Shear => LB End Prep started', target_state: 'started', target_uuid: plate_uuid, - user_uuid: + user_uuid: user_uuid } end diff --git a/spec/features/pool_tubes_at_end_of_pipeline_spec.rb b/spec/features/pool_tubes_at_end_of_pipeline_spec.rb index df8339a24..01f71b4f6 100644 --- a/spec/features/pool_tubes_at_end_of_pipeline_spec.rb +++ b/spec/features/pool_tubes_at_end_of_pipeline_spec.rb @@ -46,8 +46,8 @@ expect_api_v2_posts( 'Transfer', [ - { user_uuid:, source_uuid: tube_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' }, - { user_uuid:, source_uuid: sibling_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' } + { user_uuid: user_uuid, source_uuid: tube_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' }, + { user_uuid: user_uuid, source_uuid: sibling_uuid, transfer_template_uuid: 'tube-to-tube-by-sub' } ], create_list(:v2_transfer_between_tubes, 2, destination_uuid: multiplexed_library_tube_uuid) ) diff --git a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb index f697ec3b6..73937a3d7 100644 --- a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb @@ -135,7 +135,12 @@ expect_api_v2_posts( 'Transfer', [plate_uuid, plate_uuid_2].map do |source_uuid| - { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } + { + user_uuid: user_uuid, + source_uuid: source_uuid, + destination_uuid: 'tube-0', + transfer_template_uuid: 'whole-plate-to-tube' + } end ) diff --git a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb index 40a593e30..b1a45b360 100644 --- a/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_tubes_into_one_tube_spec.rb @@ -40,7 +40,7 @@ uuid: tube_uuid, purpose_name: parent_purpose_name, aliquots: aliquot_set_1, - stock_plate:, + stock_plate: stock_plate, parents: [parent_1] end let(:example_tube) { json(*example_tube_args) } @@ -59,7 +59,7 @@ uuid: tube_uuid_2, purpose_name: parent_purpose_name, aliquots: aliquot_set_2, - stock_plate:, + stock_plate: stock_plate, parents: [parent_2] end let(:example_tube_2_listed) { associated(*example_tube2_args) } @@ -70,8 +70,8 @@ let(:barcodes) { [tube_barcode_1, tube_barcode_2] } let(:child_uuid) { 'tube-0' } - let(:child_tube) { json :tube, purpose_uuid:, purpose_name: 'Pool tube', uuid: child_uuid } - let(:child_tube_v2) { create :v2_tube, purpose_uuid:, purpose_name: 'Pool tube', uuid: child_uuid } + let(:child_tube) { json :tube, purpose_uuid: purpose_uuid, purpose_name: 'Pool tube', uuid: child_uuid } + let(:child_tube_v2) { create :v2_tube, purpose_uuid: purpose_uuid, purpose_name: 'Pool tube', uuid: child_uuid } let(:tube_creation_request_uuid) { SecureRandom.uuid } @@ -172,7 +172,7 @@ uuid: purpose_uuid, name: 'Pool tube', submission: { - template_uuid:, + template_uuid: template_uuid, options: { read_length: 150 } diff --git a/spec/features/viewing_a_plate_spec.rb b/spec/features/viewing_a_plate_spec.rb index db1a0ccf9..253f643a1 100644 --- a/spec/features/viewing_a_plate_spec.rb +++ b/spec/features/viewing_a_plate_spec.rb @@ -12,9 +12,14 @@ let(:state) { 'pending' } let(:purpose_uuid) { 'stock-plate-purpose-uuid' } let(:example_plate) do - create :v2_stock_plate, uuid: plate_uuid, barcode_number: 1, state:, wells: wells_collection, purpose_uuid: + create :v2_stock_plate, + uuid: plate_uuid, + barcode_number: 1, + state: state, + wells: wells_collection, + purpose_uuid: purpose_uuid end - let(:wells_collection) { %w[A1 B1].map { |loc| create(:v2_well, state:, position: { 'name' => loc }) } } + let(:wells_collection) { %w[A1 B1].map { |loc| create(:v2_well, state: state, position: { 'name' => loc }) } } let(:printer_list) { create_list(:v2_tube_barcode_printer, 2) + create_list(:v2_plate_barcode_printer, 2) } let(:default_tube_printer) { printer_list.first.name } let(:purpose_config) { create :purpose_config, uuid: purpose_uuid } @@ -75,7 +80,7 @@ feature 'with a suboptimal well' do let(:wells_collection) do - %w[A1 B1].map { |loc| create(:v2_well, state:, location: loc, aliquot_factory: :v2_suboptimal_aliquot) } + %w[A1 B1].map { |loc| create(:v2_well, state: state, location: loc, aliquot_factory: :v2_suboptimal_aliquot) } end scenario 'there is a warning' do fill_in_swipecard_and_barcode user_swipecard, plate_barcode diff --git a/spec/helpers/plate_helpers_spec.rb b/spec/helpers/plate_helpers_spec.rb index d39590660..138403b18 100644 --- a/spec/helpers/plate_helpers_spec.rb +++ b/spec/helpers/plate_helpers_spec.rb @@ -66,7 +66,9 @@ ] end - let(:plate_for_precap) { build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: } + let(:plate_for_precap) do + build :v2_plate_for_pooling, state: 'passed', pool_sizes: [8], outer_requests: outer_requests + end let(:expected_result) do [ diff --git a/spec/models/labware_creators/baited_plate_spec.rb b/spec/models/labware_creators/baited_plate_spec.rb index a0cc82a88..48c035bf4 100644 --- a/spec/models/labware_creators/baited_plate_spec.rb +++ b/spec/models/labware_creators/baited_plate_spec.rb @@ -87,7 +87,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/cardinal_pools_plate_spec.rb b/spec/models/labware_creators/cardinal_pools_plate_spec.rb index 54943dbf2..20704658f 100644 --- a/spec/models/labware_creators/cardinal_pools_plate_spec.rb +++ b/spec/models/labware_creators/cardinal_pools_plate_spec.rb @@ -16,7 +16,7 @@ let(:child_uuid) { 'example-dest-uuid' } let(:child_plate) { create(:v2_plate, uuid: child_uuid, well_count: plate_size) } - let(:form_attributes) { { purpose_uuid: dest_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: dest_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } let(:dummy_v1_plate) { create(:plate, uuid: parent_uuid) } diff --git a/spec/models/labware_creators/concentration_binned_plate_spec.rb b/spec/models/labware_creators/concentration_binned_plate_spec.rb index 0528e6604..875905a39 100644 --- a/spec/models/labware_creators/concentration_binned_plate_spec.rb +++ b/spec/models/labware_creators/concentration_binned_plate_spec.rb @@ -89,7 +89,7 @@ :concentration_binning_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, - library_type_name: + library_type_name: library_type_name ) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( @@ -100,7 +100,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::ConcentrationBinnedPlate.new(api, form_attributes) } diff --git a/spec/models/labware_creators/concentration_normalised_plate_spec.rb b/spec/models/labware_creators/concentration_normalised_plate_spec.rb index 8ae7238fe..edaaf4d93 100644 --- a/spec/models/labware_creators/concentration_normalised_plate_spec.rb +++ b/spec/models/labware_creators/concentration_normalised_plate_spec.rb @@ -57,7 +57,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::ConcentrationNormalisedPlate.new(api, form_attributes) } @@ -106,7 +106,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index db926109c..1ae27edd2 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -103,7 +103,7 @@ 'pooled_plate_creations', payload: { pooled_plate_creation: { - parents:, + parents: parents, child_purpose: child_purpose_uuid, user: user_uuid } @@ -119,10 +119,10 @@ def expect_transfer_creation 'Transfer', [ { - user_uuid:, + user_uuid: user_uuid, source_uuid: plate_uuid, destination_uuid: child_plate_uuid, - transfer_template_uuid:, + transfer_template_uuid: transfer_template_uuid, transfers: expected_transfers } ] @@ -132,7 +132,14 @@ def expect_transfer_creation def expect_state_change_creation expect_api_v2_posts( 'StateChange', - [{ reason: 'Used in Library creation', target_uuid: tag_plate_uuid, target_state: 'exhausted', user_uuid: }] + [ + { + reason: 'Used in Library creation', + target_uuid: tag_plate_uuid, + target_state: 'exhausted', + user_uuid: user_uuid + } + ] ) end @@ -143,7 +150,7 @@ def expect_state_change_creation { purpose_uuid: child_purpose_uuid, parent_uuid: plate_uuid, - user_uuid:, + user_uuid: user_uuid, tag_plate: { asset_uuid: tag_plate_uuid, template_uuid: tag_template_uuid, diff --git a/spec/models/labware_creators/donor_pooling_plate_spec.rb b/spec/models/labware_creators/donor_pooling_plate_spec.rb index 6006fd42a..e5a5723e7 100644 --- a/spec/models/labware_creators/donor_pooling_plate_spec.rb +++ b/spec/models/labware_creators/donor_pooling_plate_spec.rb @@ -64,7 +64,7 @@ # This is the form that includes plate barcodes, submitted by user. let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid: parent_1_plate_uuid, barcodes:, user_uuid: } + { purpose_uuid: child_purpose_uuid, parent_uuid: parent_1_plate_uuid, barcodes: barcodes, user_uuid: user_uuid } end let(:barcodes) { source_plates.map(&:human_barcode) } diff --git a/spec/models/labware_creators/final_tube_from_plate_spec.rb b/spec/models/labware_creators/final_tube_from_plate_spec.rb index bee607d05..077d4bb62 100644 --- a/spec/models/labware_creators/final_tube_from_plate_spec.rb +++ b/spec/models/labware_creators/final_tube_from_plate_spec.rb @@ -35,7 +35,13 @@ it 'pools by submission' do expect_api_v2_posts( 'Transfer', - [{ user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' }], + [ + { + user_uuid: user_uuid, + source_uuid: parent_uuid, + transfer_template_uuid: 'transfer-to-mx-tubes-on-submission' + } + ], [transfer] ) @@ -46,8 +52,8 @@ expect_api_v2_posts( 'StateChange', [ - { target_state: 'passed', target_uuid: destination_tubes[0].uuid, user_uuid: }, - { target_state: 'passed', target_uuid: destination_tubes[1].uuid, user_uuid: } + { target_state: 'passed', target_uuid: destination_tubes[0].uuid, user_uuid: user_uuid }, + { target_state: 'passed', target_uuid: destination_tubes[1].uuid, user_uuid: user_uuid } ] ) diff --git a/spec/models/labware_creators/final_tube_spec.rb b/spec/models/labware_creators/final_tube_spec.rb index 4368ce2e2..b2264a865 100644 --- a/spec/models/labware_creators/final_tube_spec.rb +++ b/spec/models/labware_creators/final_tube_spec.rb @@ -23,7 +23,7 @@ let(:transfer_template_uuid) { 'tube-to-tube-by-sub' } # Defined in spec_helper.rb let(:transfer) { create :v2_transfer } - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } context 'with a sibling-less parent tube' do let(:tube_json) { json(:tube_without_siblings, uuid: parent_uuid) } @@ -32,7 +32,7 @@ it 'should be vaild' do expect_api_v2_posts( 'Transfer', - [{ user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: }], + [{ user_uuid: user_uuid, source_uuid: parent_uuid, transfer_template_uuid: transfer_template_uuid }], [transfer] ) @@ -65,12 +65,12 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, + parent_uuid: parent_uuid, parents: { '3980000001795' => '1', '1234567890123' => '1' }, - user_uuid: + user_uuid: user_uuid } end @@ -81,8 +81,8 @@ expect_api_v2_posts( 'Transfer', [ - { user_uuid:, source_uuid: parent_uuid, transfer_template_uuid: }, - { user_uuid:, source_uuid: sibling_uuid, transfer_template_uuid: } + { user_uuid: user_uuid, source_uuid: parent_uuid, transfer_template_uuid: transfer_template_uuid }, + { user_uuid: user_uuid, source_uuid: sibling_uuid, transfer_template_uuid: transfer_template_uuid } ], [transfer, transfer_b] ) diff --git a/spec/models/labware_creators/fixed_normalised_plate_spec.rb b/spec/models/labware_creators/fixed_normalised_plate_spec.rb index c0cdfd840..29e477651 100644 --- a/spec/models/labware_creators/fixed_normalised_plate_spec.rb +++ b/spec/models/labware_creators/fixed_normalised_plate_spec.rb @@ -85,7 +85,12 @@ let(:user_uuid) { 'user-uuid' } before do - create(:fixed_normalisation_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) + create( + :fixed_normalisation_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name: library_type_name + ) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( @@ -96,7 +101,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::FixedNormalisedPlate.new(api, form_attributes) } diff --git a/spec/models/labware_creators/merged_plate_spec.rb b/spec/models/labware_creators/merged_plate_spec.rb index eaedb49fa..62bfa79ae 100644 --- a/spec/models/labware_creators/merged_plate_spec.rb +++ b/spec/models/labware_creators/merged_plate_spec.rb @@ -75,7 +75,7 @@ stub_v2_plate(source_plate_2, stub_search: false) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: source_plate_1.uuid, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: source_plate_1.uuid, user_uuid: user_uuid } } shared_examples 'a merged plate creator' do describe '#save!' do @@ -108,7 +108,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -128,8 +128,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, barcodes: [source_plate_1.barcode.machine, source_plate_2.barcode.machine] } end @@ -191,8 +191,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, barcodes: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] } end @@ -234,8 +234,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, barcodes: [source_plate_1.barcode.machine, source_plate_3.barcode.machine] } end @@ -262,7 +262,12 @@ context 'with a missing barcode' do let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, barcodes: [source_plate_1.barcode.machine, ''] } + { + purpose_uuid: child_purpose_uuid, + parent_uuid: parent_uuid, + user_uuid: user_uuid, + barcodes: [source_plate_1.barcode.machine, ''] + } end before do @@ -289,8 +294,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, barcodes: [source_plate_1.barcode.machine, source_plate_1.barcode.machine] } end @@ -330,8 +335,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, barcodes: [source_plate_1.barcode.machine, source_plate_4.barcode.machine] } end diff --git a/spec/models/labware_creators/multi_stamp_spec.rb b/spec/models/labware_creators/multi_stamp_spec.rb index a875726c8..5f8591cc6 100644 --- a/spec/models/labware_creators/multi_stamp_spec.rb +++ b/spec/models/labware_creators/multi_stamp_spec.rb @@ -547,7 +547,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/multi_stamp_tubes_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_spec.rb index aefd4d001..2e3c3e840 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_spec.rb @@ -113,7 +113,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb index 1984cbd17..6bd6e2752 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb @@ -191,7 +191,7 @@ context '#save when everything is valid' do let(:form_attributes) do - { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } + { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end let!(:ms_plate_creation_request) do @@ -221,7 +221,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -253,7 +253,7 @@ end let(:form_attributes) do - { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } + { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } @@ -278,7 +278,7 @@ end let(:form_attributes) do - { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } + { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } @@ -303,7 +303,7 @@ context 'when a tube is not of expected purpose type' do let(:form_attributes) do - { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } + { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end let(:parent_tube_2_purpose_uuid) { 'parent-tube-purpose-type-unknown-uuid' } @@ -324,7 +324,7 @@ context 'when a tube does not have an active request of the expected type' do let(:form_attributes) do - { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } + { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end let(:request_type_2) { create :request_type, key: 'unrelated_request_type_key' } @@ -362,7 +362,7 @@ end let(:form_attributes) do - { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } + { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } @@ -391,7 +391,7 @@ end let(:form_attributes) do - { user_uuid:, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: } + { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } diff --git a/spec/models/labware_creators/normalised_binned_plate_spec.rb b/spec/models/labware_creators/normalised_binned_plate_spec.rb index bd3ce6b87..82742d946 100644 --- a/spec/models/labware_creators/normalised_binned_plate_spec.rb +++ b/spec/models/labware_creators/normalised_binned_plate_spec.rb @@ -85,7 +85,12 @@ let(:user_uuid) { 'user-uuid' } before do - create(:normalised_binning_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, library_type_name:) + create( + :normalised_binning_purpose_config, + uuid: child_purpose_uuid, + name: child_purpose_name, + library_type_name: library_type_name + ) stub_v2_plate(child_plate, stub_search: false) stub_v2_plate( parent_plate, @@ -95,7 +100,7 @@ ) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::NormalisedBinnedPlate.new(api, form_attributes) } diff --git a/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb b/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb index 351f20159..099318f8e 100644 --- a/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb +++ b/spec/models/labware_creators/partial_stamped_plate_without_dilution_spec.rb @@ -81,8 +81,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, filters: { request_type_key: well_d1.requests_as_source[1].request_type.key, # Standard library_type: well_d1.requests_as_source[1].library_type # library-type-2 diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb index 6ffabb72e..5bf07429d 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_duplex_seq_spec.rb @@ -256,7 +256,7 @@ context 'on new' do has_a_working_api - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid } } it 'can be created' do expect(subject).to be_a LabwareCreators::PcrCyclesBinnedPlateForDuplexSeq @@ -272,7 +272,9 @@ content end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } + let(:form_attributes) do + { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid, file: file } + end let(:stub_upload_file_creation) do stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( @@ -299,7 +301,7 @@ :duplex_seq_customer_csv_file_upload_purpose_config, uuid: child_purpose_uuid, name: child_purpose_name, - library_type_name: + library_type_name: library_type_name ) stub_v2_plate( @@ -438,7 +440,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb index 610bd8195..0f96b8fb6 100644 --- a/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb +++ b/spec/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq_spec.rb @@ -292,7 +292,7 @@ context 'on new' do has_a_working_api - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid } } it 'can be created' do expect(subject).to be_a LabwareCreators::PcrCyclesBinnedPlateForTNanoSeq @@ -308,7 +308,9 @@ content end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, file: } } + let(:form_attributes) do + { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid, file: file } + end let(:stub_upload_file_creation) do stub_request(:post, api_url_for(parent_uuid, 'qc_files')).with( @@ -474,7 +476,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -836,7 +838,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -1192,7 +1194,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -1555,7 +1557,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index cedabd678..4f7f83f9a 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -39,11 +39,11 @@ # submission requests let(:request_type) { create :request_type, key: 'rt_1' } - let(:request_a) { create :library_request, request_type:, uuid: 'request-a1', submission_id: '2' } - let(:request_b) { create :library_request, request_type:, uuid: 'request-a2', submission_id: '2' } - let(:request_c) { create :library_request, request_type:, uuid: 'request-a3', submission_id: '2' } - let(:request_d) { create :library_request, request_type:, uuid: 'request-b1', submission_id: '2' } - let(:request_e) { create :library_request, request_type:, uuid: 'request-b2', submission_id: '2' } + let(:request_a) { create :library_request, request_type: request_type, uuid: 'request-a1', submission_id: '2' } + let(:request_b) { create :library_request, request_type: request_type, uuid: 'request-a2', submission_id: '2' } + let(:request_c) { create :library_request, request_type: request_type, uuid: 'request-a3', submission_id: '2' } + let(:request_d) { create :library_request, request_type: request_type, uuid: 'request-b1', submission_id: '2' } + let(:request_e) { create :library_request, request_type: request_type, uuid: 'request-b2', submission_id: '2' } # parent aliquots let(:parent_aliquot_sample1_aliquot1) { create(:v2_aliquot, sample: sample1, outer_request: request_a) } @@ -112,7 +112,9 @@ let(:parent_v1) { json :plate_with_metadata, uuid: parent_uuid, barcode_number: 6, qc_files_actions: %w[read create] } # form attributes - required parameters for the labware creator - let(:form_attributes) { { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: } } + let(:form_attributes) do + { user_uuid: user_uuid, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: parent_uuid } + end # child tubes for lookup after creation let(:child_tube_1_uuid) { SecureRandom.uuid } @@ -265,7 +267,12 @@ context 'when require_sequencing_tubes_only? is true' do let(:form_attributes) do - { user_uuid:, purpose_uuid: child_contingency_tube_purpose_uuid, parent_uuid:, sequencing_file: } + { + user_uuid: user_uuid, + purpose_uuid: child_contingency_tube_purpose_uuid, + parent_uuid: parent_uuid, + sequencing_file: sequencing_file + } end before do @@ -304,11 +311,11 @@ context 'when require_sequencing_tubes_only? is false' do let(:form_attributes) do { - user_uuid:, + user_uuid: user_uuid, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, - sequencing_file:, - contingency_file: + parent_uuid: parent_uuid, + sequencing_file: sequencing_file, + contingency_file: contingency_file } end @@ -388,11 +395,11 @@ context 'when a file is not correctly parsed' do let(:form_attributes) do { - user_uuid:, + user_uuid: user_uuid, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, - sequencing_file:, - contingency_file: + parent_uuid: parent_uuid, + sequencing_file: sequencing_file, + contingency_file: contingency_file } end @@ -417,11 +424,11 @@ context 'when the files are the same' do let(:form_attributes) do { - user_uuid:, + user_uuid: user_uuid, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, + parent_uuid: parent_uuid, sequencing_file: contingency_file, - contingency_file: + contingency_file: contingency_file } end @@ -449,11 +456,11 @@ context 'when the tube rack barcodes are the same' do let(:form_attributes) do { - user_uuid:, + user_uuid: user_uuid, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, - sequencing_file:, - contingency_file: + parent_uuid: parent_uuid, + sequencing_file: sequencing_file, + contingency_file: contingency_file } end @@ -513,11 +520,11 @@ context 'when a file is not correctly parsed' do let(:form_attributes) do { - user_uuid:, + user_uuid: user_uuid, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, - sequencing_file:, - contingency_file: + parent_uuid: parent_uuid, + sequencing_file: sequencing_file, + contingency_file: contingency_file } end @@ -549,11 +556,11 @@ context 'when there are duplicate tube barcodes between files' do let(:form_attributes) do { - user_uuid:, + user_uuid: user_uuid, purpose_uuid: child_contingency_tube_purpose_uuid, - parent_uuid:, - sequencing_file:, - contingency_file: + parent_uuid: parent_uuid, + sequencing_file: sequencing_file, + contingency_file: contingency_file } end let(:seq_tube_details) do @@ -598,7 +605,7 @@ let(:tube_rack_barcode) { 'TR00000001' } let(:tube_details) { { 'tube_barcode' => foreign_barcode, 'tube_rack_barcode' => tube_rack_barcode } } let(:msg_prefix) { 'Sequencing' } - let(:existing_tube) { create(:v2_tube, state: 'passed', barcode_number: 1, foreign_barcode:) } + let(:existing_tube) { create(:v2_tube, state: 'passed', barcode_number: 1, foreign_barcode: foreign_barcode) } before { allow(tube_rack_file).to receive(:position_details).and_return({ tube_posn => tube_details }) } @@ -651,11 +658,11 @@ context 'with both sequencing and contingency files' do let(:form_attributes) do { - user_uuid:, + user_uuid: user_uuid, purpose_uuid: child_sequencing_tube_purpose_uuid, - parent_uuid:, - sequencing_file:, - contingency_file: + parent_uuid: parent_uuid, + sequencing_file: sequencing_file, + contingency_file: contingency_file } end @@ -1003,7 +1010,12 @@ context 'with just a sequencing file' do let(:form_attributes) do - { user_uuid:, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid:, sequencing_file: } + { + user_uuid: user_uuid, + purpose_uuid: child_sequencing_tube_purpose_uuid, + parent_uuid: parent_uuid, + sequencing_file: sequencing_file + } end # body for stubbing the sequencing file upload diff --git a/spec/models/labware_creators/plate_with_primer_panel_spec.rb b/spec/models/labware_creators/plate_with_primer_panel_spec.rb index 9f447d4ff..4d5b9bff9 100644 --- a/spec/models/labware_creators/plate_with_primer_panel_spec.rb +++ b/spec/models/labware_creators/plate_with_primer_panel_spec.rb @@ -93,7 +93,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/plate_with_template_spec.rb b/spec/models/labware_creators/plate_with_template_spec.rb index 69605de82..3a19bd859 100644 --- a/spec/models/labware_creators/plate_with_template_spec.rb +++ b/spec/models/labware_creators/plate_with_template_spec.rb @@ -30,7 +30,7 @@ stub_api_get(parent_uuid, 'wells', body: wells) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::PlateWithTemplate.new(api, form_attributes) } @@ -60,7 +60,14 @@ it 'makes the expected requests' do expect_api_v2_posts( 'Transfer', - [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: 'child-uuid', transfer_template_uuid: }] + [ + { + user_uuid: user_uuid, + source_uuid: parent_uuid, + destination_uuid: 'child-uuid', + transfer_template_uuid: transfer_template_uuid + } + ] ) expect(subject.save!).to eq true diff --git a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb index afb59b546..a15f483ef 100644 --- a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb @@ -98,7 +98,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb index bb2ee40a4..90ca78426 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb @@ -88,7 +88,12 @@ expect_api_v2_posts( 'Transfer', [parent_uuid, parent2_uuid, parent3_uuid, parent4_uuid].map do |source_uuid| - { user_uuid:, source_uuid:, destination_uuid: 'tube-0', transfer_template_uuid: 'whole-plate-to-tube' } + { + user_uuid: user_uuid, + source_uuid: source_uuid, + destination_uuid: 'tube-0', + transfer_template_uuid: 'whole-plate-to-tube' + } end ) diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb index ee8183163..297c1be30 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_tubes_spec.rb @@ -32,7 +32,14 @@ end before do - create :purpose_config, submission: { template_uuid:, request_options: { read_length: 150 } }, uuid: purpose_uuid + create :purpose_config, + submission: { + template_uuid: template_uuid, + request_options: { + read_length: 150 + } + }, + uuid: purpose_uuid end describe '#new' do diff --git a/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb b/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb index 4cddb613b..1e01eb37b 100644 --- a/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb +++ b/spec/models/labware_creators/pooled_wells_by_sample_in_groups_spec.rb @@ -23,7 +23,7 @@ end # Attributes for initialising the labware creator - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_plate_uuid, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_plate_uuid, user_uuid: user_uuid } } # Child plate assumed to be created let(:child_plate) { create(:v2_plate, uuid: child_plate_uuid) } diff --git a/spec/models/labware_creators/quadrant_split_plate_spec.rb b/spec/models/labware_creators/quadrant_split_plate_spec.rb index c96a1026e..1719daa54 100644 --- a/spec/models/labware_creators/quadrant_split_plate_spec.rb +++ b/spec/models/labware_creators/quadrant_split_plate_spec.rb @@ -137,7 +137,7 @@ stub_v2_plate(plate, stub_search: false) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::QuadrantSplitPlate.new(api, form_attributes) } @@ -174,7 +174,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index 4ed83099e..6c5abbe77 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -291,7 +291,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/shared_examples.rb b/spec/models/labware_creators/shared_examples.rb index 6de6977a3..88f523dc1 100644 --- a/spec/models/labware_creators/shared_examples.rb +++ b/spec/models/labware_creators/shared_examples.rb @@ -257,7 +257,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' diff --git a/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb b/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb index 58e9ba63f..5356b3b8f 100644 --- a/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb +++ b/spec/models/labware_creators/stamped_plate_adding_randomised_controls_spec.rb @@ -100,7 +100,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name: + control_study_name: control_study_name ) stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) stub_v2_plate(parent_plate_v2, stub_search: false, custom_includes: parent_plate_includes) @@ -108,7 +108,7 @@ stub_v2_project(control_project) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::StampedPlateAddingRandomisedControls.new(api, form_attributes) } @@ -140,7 +140,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -235,7 +235,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name:, + control_study_name: control_study_name, controls: [ { control_type: 'pcr positive', name_prefix: 'CONTROL_POS_', fixed_location: 'G12' }, { control_type: 'pcr negative', name_prefix: 'CONTROL_NEG_' } @@ -271,7 +271,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name:, + control_study_name: control_study_name, control_location_rules: [{ type: 'not', value: %w[H1 G1] }] ) end @@ -299,7 +299,7 @@ :stamp_with_randomised_controls_purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, - control_study_name:, + control_study_name: control_study_name, control_location_rules: [{ type: 'well_exclusions', value: %w[H10 H11 H12] }] ) end diff --git a/spec/models/labware_creators/stamped_plate_compressed_spec.rb b/spec/models/labware_creators/stamped_plate_compressed_spec.rb index 4e1f98304..77acbb3bf 100644 --- a/spec/models/labware_creators/stamped_plate_compressed_spec.rb +++ b/spec/models/labware_creators/stamped_plate_compressed_spec.rb @@ -66,8 +66,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, filters: { request_type_key: parent_well_b1.requests_as_source[0].request_type.key, # Standard library_type: parent_well_b1.requests_as_source[0].library_type # library-type-1 diff --git a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb index d2cdf7206..b92847b12 100644 --- a/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb +++ b/spec/models/labware_creators/stamped_plate_reordering_columns_to_rows_spec.rb @@ -17,14 +17,14 @@ let(:parent_wells) do locations = WellHelpers.column_order(96, rows: 8, columns: 12) - locations.take(8).map { |location| create(:v2_well, location:, aliquot_count: 2, state: 'passed') } + locations.take(8).map { |location| create(:v2_well, location: location, aliquot_count: 2, state: 'passed') } end let(:parent) { create(:v2_plate, size: 96, uuid: parent_uuid, wells: parent_wells) } let(:child_wells) do locations = WellHelpers.row_order(8, rows: 1, columns: 8) - locations.take(8).map { |location| create(:v2_well, location:, aliquot_count: 0) } + locations.take(8).map { |location| create(:v2_well, location: location, aliquot_count: 0) } end let(:child_uuid) { 'child-uuid' } @@ -33,7 +33,7 @@ create(:v2_plate, size: 8, number_of_rows: 1, number_of_columns: 8, wells: child_wells, uuid: child_uuid) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { described_class.new(api, form_attributes) } @@ -93,7 +93,7 @@ let(:expect_transfer_requests) do expect(api).to receive_message_chain(:transfer_request_collection, :create!).with( user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests ) subject.save! end @@ -129,7 +129,7 @@ context 'when there are more source wells than the child plate size' do let(:parent_wells) do locations = WellHelpers.column_order(96, rows: 8, columns: 12) - locations.take(9).map { |location| create(:v2_well, location:, aliquot_count: 2, state: 'passed') } + locations.take(9).map { |location| create(:v2_well, location: location, aliquot_count: 2, state: 'passed') } end it 'reports the error' do diff --git a/spec/models/labware_creators/stamped_plate_spec.rb b/spec/models/labware_creators/stamped_plate_spec.rb index 22b16157e..77b87a322 100644 --- a/spec/models/labware_creators/stamped_plate_spec.rb +++ b/spec/models/labware_creators/stamped_plate_spec.rb @@ -33,7 +33,7 @@ stub_v2_plate(plate, stub_search: false) end - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } subject { LabwareCreators::StampedPlate.new(api, form_attributes) } @@ -65,7 +65,7 @@ payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: + transfer_requests: transfer_requests } }, body: '{}' @@ -119,7 +119,7 @@ end context 'more complicated scenarios' do - let(:plate) { create :v2_plate, uuid: parent_uuid, barcode_number: '2', wells: } + let(:plate) { create :v2_plate, uuid: parent_uuid, barcode_number: '2', wells: wells } context 'with multiple requests of different types' do let(:request_type_a) { create :request_type, key: 'rt_a' } @@ -158,8 +158,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, filters: { request_type_key: [request_type_b.key] } @@ -170,7 +170,7 @@ end context 'when a request_type is not supplied' do - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } it 'raises an exception' do expect { subject.save! }.to raise_error(LabwareCreators::ResourceInvalid) @@ -188,7 +188,14 @@ context 'when a library type is supplied' do let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: [lib_type_a] } } + { + purpose_uuid: child_purpose_uuid, + parent_uuid: parent_uuid, + user_uuid: user_uuid, + filters: { + library_type: [lib_type_a] + } + } end it_behaves_like 'a stamped plate creator' @@ -198,8 +205,8 @@ let(:form_attributes) do { purpose_uuid: child_purpose_uuid, - parent_uuid:, - user_uuid:, + parent_uuid: parent_uuid, + user_uuid: user_uuid, filters: { request_type_key: [request_type_b.key], library_type: [lib_type_a] @@ -212,7 +219,14 @@ context 'when a library type is supplied that does not match any request' do let(:form_attributes) do - { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid:, filters: { library_type: ['LibTypeB'] } } + { + purpose_uuid: child_purpose_uuid, + parent_uuid: parent_uuid, + user_uuid: user_uuid, + filters: { + library_type: ['LibTypeB'] + } + } end it 'raises an exception' do @@ -227,10 +241,10 @@ # We don't specify an outer request, and Sequencescape should just move the aliquots across # as normal. let(:request_type) { create :request_type, key: 'rt_a' } - let(:request_a) { create :library_request, request_type:, uuid: 'request-a', submission_id: '2' } - let(:request_b) { create :library_request, request_type:, uuid: 'request-b', submission_id: '2' } - let(:request_c) { create :library_request, request_type:, uuid: 'request-c', submission_id: '2' } - let(:request_d) { create :library_request, request_type:, uuid: 'request-d', submission_id: '2' } + let(:request_a) { create :library_request, request_type: request_type, uuid: 'request-a', submission_id: '2' } + let(:request_b) { create :library_request, request_type: request_type, uuid: 'request-b', submission_id: '2' } + let(:request_c) { create :library_request, request_type: request_type, uuid: 'request-c', submission_id: '2' } + let(:request_d) { create :library_request, request_type: request_type, uuid: 'request-d', submission_id: '2' } let(:aliquots_a) do [ create(:v2_aliquot, library_state: 'started', outer_request: request_a), @@ -252,7 +266,7 @@ end context 'when a request_type is supplied' do - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } let(:transfer_requests) do [ diff --git a/spec/models/labware_creators/tagged_plate_spec.rb b/spec/models/labware_creators/tagged_plate_spec.rb index 58fdeb2c5..ea2cfd797 100644 --- a/spec/models/labware_creators/tagged_plate_spec.rb +++ b/spec/models/labware_creators/tagged_plate_spec.rb @@ -30,7 +30,12 @@ let(:disable_cross_plate_pool_detection) { false } before do - create(:purpose_config, name: child_purpose_name, uuid: child_purpose_uuid, disable_cross_plate_pool_detection:) + create( + :purpose_config, + name: child_purpose_name, + uuid: child_purpose_uuid, + disable_cross_plate_pool_detection: disable_cross_plate_pool_detection + ) plate_request wells_request end @@ -188,8 +193,8 @@ { purpose_uuid: child_purpose_uuid, parent_uuid: plate_uuid, - user_uuid:, - tag_plate_barcode:, + user_uuid: user_uuid, + tag_plate_barcode: tag_plate_barcode, tag_plate: { asset_uuid: tag_plate_uuid, template_uuid: tag_template_uuid @@ -209,10 +214,10 @@ 'Transfer', [ { - user_uuid:, + user_uuid: user_uuid, source_uuid: plate_uuid, destination_uuid: tag_plate_uuid, - transfer_template_uuid:, + transfer_template_uuid: transfer_template_uuid, transfers: expected_transfers } ] @@ -220,7 +225,14 @@ expect_api_v2_posts( 'StateChange', - [{ reason: 'Used in Library creation', target_state: 'exhausted', target_uuid: tag_plate_uuid, user_uuid: }] + [ + { + reason: 'Used in Library creation', + target_state: 'exhausted', + target_uuid: tag_plate_uuid, + user_uuid: user_uuid + } + ] ) expect(subject.save).to be true diff --git a/spec/models/labware_creators/tube_from_tube_spec.rb b/spec/models/labware_creators/tube_from_tube_spec.rb index 112f1b4c7..8ed70b32c 100644 --- a/spec/models/labware_creators/tube_from_tube_spec.rb +++ b/spec/models/labware_creators/tube_from_tube_spec.rb @@ -40,7 +40,7 @@ let(:user_uuid) { 'user-uuid' } let(:transfer_template_uuid) { 'transfer-between-specific-tubes' } # Defined in spec_helper.rb - let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid:, user_uuid: } } + let(:form_attributes) { { purpose_uuid: child_purpose_uuid, parent_uuid: parent_uuid, user_uuid: user_uuid } } let(:creation_request) do stub_api_post( @@ -60,7 +60,14 @@ it 'creates the child' do expect_api_v2_posts( 'Transfer', - [{ user_uuid:, source_uuid: parent_uuid, destination_uuid: child_uuid, transfer_template_uuid: }] + [ + { + user_uuid: user_uuid, + source_uuid: parent_uuid, + destination_uuid: child_uuid, + transfer_template_uuid: transfer_template_uuid + } + ] ) subject.save! diff --git a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb index 136fc50e9..66e0996c0 100644 --- a/spec/models/labware_creators/well_filter_allowing_partials_spec.rb +++ b/spec/models/labware_creators/well_filter_allowing_partials_spec.rb @@ -32,7 +32,9 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } + let(:labware_creator) do + LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid: parent_uuid) + end let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/labware_creators/well_filter_spec.rb b/spec/models/labware_creators/well_filter_spec.rb index 55d02afef..f34d70143 100644 --- a/spec/models/labware_creators/well_filter_spec.rb +++ b/spec/models/labware_creators/well_filter_spec.rb @@ -32,7 +32,9 @@ end let(:basic_purpose) { 'test-purpose' } - let(:labware_creator) { LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid:) } + let(:labware_creator) do + LabwareCreators::StampedPlate.new(nil, purpose_uuid: 'test-purpose', parent_uuid: parent_uuid) + end let(:request_type_key_a) { 'rt_a' } let(:request_type_key_b) { 'rt_b' } diff --git a/spec/models/pipeline_list_spec.rb b/spec/models/pipeline_list_spec.rb index a91599bec..8f9220782 100644 --- a/spec/models/pipeline_list_spec.rb +++ b/spec/models/pipeline_list_spec.rb @@ -10,7 +10,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -19,7 +19,7 @@ name: 'Pipeline A' }, 'Pipeline B' => { - filters:, + filters: filters, library_pass: 'Purpose 4', relationships: { 'Purpose 3' => 'Purpose 4' @@ -27,7 +27,7 @@ name: 'Pipeline B' }, 'Pipeline C' => { - filters:, + filters: filters, library_pass: 'Purpose 5', relationships: { 'Purpose 4' => 'Purpose 5' @@ -49,7 +49,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 2' => 'Purpose 3', @@ -58,7 +58,7 @@ name: 'Pipeline A' }, 'Pipeline B' => { - filters:, + filters: filters, library_pass: 'Purpose 4', relationships: { 'Purpose 3' => 'Purpose 4' @@ -80,7 +80,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 2' => 'Purpose 3', @@ -103,7 +103,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -112,7 +112,7 @@ name: 'Pipeline A' }, 'Pipeline B' => { - filters:, + filters: filters, library_pass: 'Purpose 4', relationships: { 'Purpose 2' => 'Purpose 4' @@ -137,7 +137,7 @@ { 'Pipeline A' => { pipeline_group: 'Pipeline X', - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -147,7 +147,7 @@ }, 'Pipeline B' => { pipeline_group: 'Pipeline X', - filters:, + filters: filters, library_pass: 'Purpose 4', relationships: { 'Purpose 2' => 'Purpose 4' @@ -168,7 +168,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -246,7 +246,7 @@ let(:pipeline_config) do { 'Pipeline A' => { - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', diff --git a/spec/models/pipeline_spec.rb b/spec/models/pipeline_spec.rb index 065ec32ac..5f92b4291 100644 --- a/spec/models/pipeline_spec.rb +++ b/spec/models/pipeline_spec.rb @@ -10,7 +10,7 @@ let(:pipeline_config) do { pipeline_group: 'Group A', - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', @@ -31,7 +31,7 @@ context 'when there is no pipeline group' do let(:pipeline_config) do { - filters:, + filters: filters, library_pass: 'Purpose 3', relationships: { 'Purpose 1' => 'Purpose 2', diff --git a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb index 99e9baaf9..358878b45 100644 --- a/spec/models/presenters/concentration_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/concentration_binned_plate_presenter_spec.rb @@ -40,8 +40,8 @@ let(:labware) do build :v2_plate, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_a3], @@ -65,7 +65,14 @@ end context 'when binning configuration is present' do - before { create(:concentration_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } + before do + create( + :concentration_binning_purpose_config, + uuid: labware.purpose.uuid, + warnings: warnings, + label_class: label_class + ) + end it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/final_tube_presenter_spec.rb b/spec/models/presenters/final_tube_presenter_spec.rb index b6d7b4347..bdb366666 100644 --- a/spec/models/presenters/final_tube_presenter_spec.rb +++ b/spec/models/presenters/final_tube_presenter_spec.rb @@ -5,7 +5,9 @@ require_relative 'shared_labware_presenter_examples' RSpec.describe Presenters::FinalTubePresenter do - let(:labware) { build :v2_tube, purpose_name:, state:, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' } + let(:labware) do + build :v2_tube, purpose_name: purpose_name, state: state, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' + end before { create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') } diff --git a/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb b/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb index b6a89621f..1de7b156d 100644 --- a/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb +++ b/spec/models/presenters/minimal_pcr_plate_presenter_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Presenters::MinimalPcrPlatePresenter do let(:labware) do create :v2_plate_with_primer_panels, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [2, 2], created_at: '2016-10-19 12:00:00 +0100' diff --git a/spec/models/presenters/minimal_plate_presenter_spec.rb b/spec/models/presenters/minimal_plate_presenter_spec.rb index 1b0d94222..3245a160e 100644 --- a/spec/models/presenters/minimal_plate_presenter_spec.rb +++ b/spec/models/presenters/minimal_plate_presenter_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Presenters::MinimalPlatePresenter do let(:labware) do create :v2_plate, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [2, 2], created_at: '2016-10-19 12:00:00 +0100' diff --git a/spec/models/presenters/minimal_stock_plate_presenter_spec.rb b/spec/models/presenters/minimal_stock_plate_presenter_spec.rb index 9d3813249..947208bc1 100644 --- a/spec/models/presenters/minimal_stock_plate_presenter_spec.rb +++ b/spec/models/presenters/minimal_stock_plate_presenter_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Presenters::MinimalStockPlatePresenter do let(:labware) do create :v2_stock_plate, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [2, 2], created_at: '2016-10-19 12:00:00 +0100' diff --git a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb index 44c5d52b9..1f4a6a5f4 100644 --- a/spec/models/presenters/normalised_binned_plate_presenter_spec.rb +++ b/spec/models/presenters/normalised_binned_plate_presenter_spec.rb @@ -41,8 +41,8 @@ let(:labware) do build :v2_plate, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_c2], @@ -66,7 +66,14 @@ end context 'when binning configuration is present' do - before { create(:normalised_binning_purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) } + before do + create( + :normalised_binning_purpose_config, + uuid: labware.purpose.uuid, + warnings: warnings, + label_class: label_class + ) + end it_behaves_like 'a labware presenter' diff --git a/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb b/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb index 14cbb85d0..0cdf30e8b 100644 --- a/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb +++ b/spec/models/presenters/pcr_cycles_binned_plate_using_request_metadata_presenter_spec.rb @@ -88,8 +88,8 @@ let(:labware) do build :v2_plate, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_a3], diff --git a/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb b/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb index b12970d55..5293c69ee 100644 --- a/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb +++ b/spec/models/presenters/pcr_cycles_binned_plate_using_well_metadata_presenter_spec.rb @@ -68,8 +68,8 @@ let(:labware) do build :v2_plate, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [], wells: [well_a1, well_a2, well_b2, well_a3], diff --git a/spec/models/presenters/permissive_presenter_spec.rb b/spec/models/presenters/permissive_presenter_spec.rb index b54a4a4b8..c64484a9c 100644 --- a/spec/models/presenters/permissive_presenter_spec.rb +++ b/spec/models/presenters/permissive_presenter_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Presenters::PermissivePresenter do let(:purpose_name) { 'Example purpose' } - let(:labware) { create :v2_plate, state:, purpose_name:, pool_sizes: [1] } + let(:labware) { create :v2_plate, state: state, purpose_name: purpose_name, pool_sizes: [1] } subject { Presenters::PermissivePresenter.new(labware:) } diff --git a/spec/models/presenters/plate_presenter_spec.rb b/spec/models/presenters/plate_presenter_spec.rb index 378f4a611..40c8a357a 100644 --- a/spec/models/presenters/plate_presenter_spec.rb +++ b/spec/models/presenters/plate_presenter_spec.rb @@ -23,8 +23,8 @@ let(:labware) do build :v2_plate, - purpose_name:, - state:, + purpose_name: purpose_name, + state: state, barcode_number: 1, pool_sizes: [48, 48], created_at: '2016-10-19 12:00:00 +0100' @@ -34,7 +34,7 @@ let(:label_class) { 'Labels::PlateLabel' } before do - create(:purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:) + create(:purpose_config, uuid: labware.purpose.uuid, warnings: warnings, label_class: label_class) create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') end @@ -236,7 +236,7 @@ # split up onto different plates. They have different PCR cycle requirements, but # the warning is not required and is unwanted. This check disables the warning # if the plate contains split processes - let(:labware) { create :v2_plate, barcode_number: '2', wells: } + let(:labware) { create :v2_plate, barcode_number: '2', wells: wells } let(:request_a) { create :library_request, pcr_cycles: 1 } let(:request_b) { create :library_request, pcr_cycles: 2 } let(:request_c) { create :library_request, pcr_cycles: 1 } @@ -337,7 +337,15 @@ end context 'with a plate that has no links' do - before { create(:purpose_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links: []) } + before do + create( + :purpose_config, + uuid: labware.purpose.uuid, + warnings: warnings, + label_class: label_class, + file_links: [] + ) + end it 'returns an empty array' do expect(presenter.csv_file_links).to eq([]) @@ -349,8 +357,8 @@ create( :purpose_config, uuid: labware.purpose.uuid, - warnings:, - label_class:, + warnings: warnings, + label_class: label_class, file_links: [ { name: 'First type CSV', id: 'first_csv_id' }, { name: 'Second type CSV', id: 'second_csv_id' }, @@ -369,8 +377,8 @@ create( :purpose_config, uuid: labware.purpose.uuid, - warnings:, - label_class:, + warnings: warnings, + label_class: label_class, file_links: [ { name: 'Button 1', id: 'template', params: { page: 0 } }, { name: 'Button 2', id: 'template', params: { page: 1 } } diff --git a/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb b/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb index 21b9ebffd..171a3d85e 100644 --- a/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb +++ b/spec/models/presenters/rvi_cnda_xp_presenter_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Presenters::RviCdnaXpPresenter do let(:purpose_name) { 'Example purpose' } - let(:labware) { create :v2_plate, state:, purpose_name:, pool_sizes: [1] } + let(:labware) { create :v2_plate, state: state, purpose_name: purpose_name, pool_sizes: [1] } subject { Presenters::RviCdnaXpPresenter.new(labware:) } diff --git a/spec/models/presenters/single_child_permissive_presenter_spec.rb b/spec/models/presenters/single_child_permissive_presenter_spec.rb index 8e5ce339e..bfdce323e 100644 --- a/spec/models/presenters/single_child_permissive_presenter_spec.rb +++ b/spec/models/presenters/single_child_permissive_presenter_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Presenters::SingleChildPermissivePresenter do let(:purpose_name) { 'Example purpose' } - let(:labware) { create :v2_plate, state:, purpose_name:, pool_sizes: [1] } + let(:labware) { create :v2_plate, state: state, purpose_name: purpose_name, pool_sizes: [1] } let(:child_purpose) { 'Child purpose' } let(:child_plate) { create :v2_plate, purpose_name: child_purpose } diff --git a/spec/models/presenters/standard_presenter_spec.rb b/spec/models/presenters/standard_presenter_spec.rb index 6376b2ff3..a97b65bab 100644 --- a/spec/models/presenters/standard_presenter_spec.rb +++ b/spec/models/presenters/standard_presenter_spec.rb @@ -5,7 +5,13 @@ let(:aliquot_type) { :v2_aliquot } let(:state) { 'pending' } let(:labware) do - create :v2_plate, barcode_number: 1, state:, purpose_name:, purpose_uuid: 'test-purpose', uuid: 'plate-uuid', wells: + create :v2_plate, + barcode_number: 1, + state: state, + purpose_name: purpose_name, + purpose_uuid: 'test-purpose', + uuid: 'plate-uuid', + wells: wells end let(:wells) do [ diff --git a/spec/models/presenters/submission_plate_presenter_spec.rb b/spec/models/presenters/submission_plate_presenter_spec.rb index aab4a7072..17a416937 100644 --- a/spec/models/presenters/submission_plate_presenter_spec.rb +++ b/spec/models/presenters/submission_plate_presenter_spec.rb @@ -27,7 +27,7 @@ let(:example2_template_uuid) { SecureRandom.uuid } before do - create(:purpose_config, uuid: labware.purpose.uuid, submission_options:) + create(:purpose_config, uuid: labware.purpose.uuid, submission_options: submission_options) Settings.submission_templates = { 'example' => example_template_uuid, 'example2' => example2_template_uuid } end @@ -68,7 +68,7 @@ let(:labware) do create :v2_plate_for_submission, - purpose_name:, + purpose_name: purpose_name, barcode_number: 2, direct_submissions: [], study: submission_study, @@ -114,7 +114,9 @@ it_behaves_like 'a labware presenter' it_behaves_like 'a stock presenter' - let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } + let(:labware) do + create :v2_plate_for_submission, purpose_name: purpose_name, barcode_number: 2, direct_submissions: submissions + end let(:submissions) { create_list :v2_submission, 1, state: 'pending' } let(:barcode_string) { 'DN2T' } @@ -154,7 +156,9 @@ end end - let(:labware) { create :v2_plate_for_submission, purpose_name:, barcode_number: 2, direct_submissions: submissions } + let(:labware) do + create :v2_plate_for_submission, purpose_name: purpose_name, barcode_number: 2, direct_submissions: submissions + end let(:now) { Time.zone.parse('2020-11-24 16:13:43 +0000') } let(:submissions) { create_list :v2_submission, 1, state: 'ready', updated_at: now - 5.seconds } let(:barcode_string) { 'DN2T' } @@ -184,7 +188,7 @@ it_behaves_like 'a labware presenter' it_behaves_like 'a stock presenter' - let(:labware) { create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2] } + let(:labware) { create :v2_stock_plate, purpose_name: purpose_name, barcode_number: 2, pool_sizes: [2] } let(:barcode_string) { 'DN2T' } let(:purpose_name) { 'Test Plate' } let(:title) { purpose_name } @@ -209,7 +213,12 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: + create :v2_stock_plate, + purpose_name: purpose_name, + barcode_number: 2, + pool_sizes: [2], + direct_submissions: submissions, + state: state end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } @@ -246,7 +255,12 @@ it_behaves_like 'a stock presenter' let(:labware) do - create :v2_stock_plate, purpose_name:, barcode_number: 2, pool_sizes: [2], direct_submissions: submissions, state: + create :v2_stock_plate, + purpose_name: purpose_name, + barcode_number: 2, + pool_sizes: [2], + direct_submissions: submissions, + state: state end let(:submissions) { create_list :v2_submission, 1, state: } let(:barcode_string) { 'DN2T' } diff --git a/spec/models/presenters/tag_plate_384_presenter_spec.rb b/spec/models/presenters/tag_plate_384_presenter_spec.rb index b688757d9..e501fe03e 100644 --- a/spec/models/presenters/tag_plate_384_presenter_spec.rb +++ b/spec/models/presenters/tag_plate_384_presenter_spec.rb @@ -10,7 +10,7 @@ let(:date_format) { /\A\s?\d{1,2}-[A-Z]{3}-\d{4}\z/ } # e.g., ' 4 JUL 2023' or '24 JUL 2023' let(:purpose_name) { 'Tag Plate - 384' } let(:purpose) { create :v2_purpose, name: purpose_name } - let(:labware) { create :v2_plate, purpose:, size: 384, stock_plate: nil } + let(:labware) { create :v2_plate, purpose: purpose, size: 384, stock_plate: nil } let(:presenter) { described_class.new(labware:) } it 'can be looked up for labware' do diff --git a/spec/models/presenters/tube_presenter_spec.rb b/spec/models/presenters/tube_presenter_spec.rb index 859c34646..9a37d3c35 100644 --- a/spec/models/presenters/tube_presenter_spec.rb +++ b/spec/models/presenters/tube_presenter_spec.rb @@ -7,10 +7,10 @@ RSpec.describe Presenters::TubePresenter do let(:labware) do build :v2_tube, - receptacle:, - purpose:, - purpose_name:, - state:, + receptacle: receptacle, + purpose: purpose, + purpose_name: purpose_name, + state: state, barcode_number: 6, created_at: '2016-10-19 12:00:00 +0100' end diff --git a/spec/models/presenters/tube_rack_presenter_spec.rb b/spec/models/presenters/tube_rack_presenter_spec.rb index 7a4df7cf0..24293626d 100644 --- a/spec/models/presenters/tube_rack_presenter_spec.rb +++ b/spec/models/presenters/tube_rack_presenter_spec.rb @@ -21,7 +21,7 @@ let(:sidebar_partial) { 'default' } let(:file_links) { [] } - let(:labware) { build :tube_rack, purpose_name:, tubes:, barcode_number: 2 } + let(:labware) { build :tube_rack, purpose_name: purpose_name, tubes: tubes, barcode_number: 2 } let(:states) { %w[pending pending pending] } @@ -37,7 +37,13 @@ let(:label_class) { 'Labels::PlateLabel' } before do - create(:tube_rack_config, uuid: labware.purpose.uuid, warnings:, label_class:, file_links:) + create( + :tube_rack_config, + uuid: labware.purpose.uuid, + warnings: warnings, + label_class: label_class, + file_links: file_links + ) create(:stock_plate_config, uuid: 'stock-plate-purpose-uuid') end diff --git a/spec/models/print_job_spec.rb b/spec/models/print_job_spec.rb index 1f87d2a1e..7a0ffbf07 100644 --- a/spec/models/print_job_spec.rb +++ b/spec/models/print_job_spec.rb @@ -29,7 +29,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service:, + label_templates_by_service: label_templates_by_service, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -55,7 +55,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service:, + label_templates_by_service: label_templates_by_service, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -75,7 +75,7 @@ PrintJob.new( printer_name: printer_sprint.name, printer: printer_sprint, - label_templates_by_service:, + label_templates_by_service: label_templates_by_service, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -95,7 +95,7 @@ PrintJob.new( printer_name: printer_unknown.name, printer: printer_unknown, - label_templates_by_service:, + label_templates_by_service: label_templates_by_service, labels: [{ 'label' => { 'barcode' => '12345', 'test_attr' => 'test' } }], labels_sprint: { sprint: { @@ -115,7 +115,7 @@ let(:pmb_print_job) do PMB::PrintJob.new( printer_name: printer_pmb.name, - label_template_id:, + label_template_id: label_template_id, labels: [{ label: { barcode: '12345', test_attr: 'test' } }] ) end @@ -125,7 +125,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service:, + label_templates_by_service: label_templates_by_service, labels: [{ label: { barcode: '12345', test_attr: 'test' } }], number_of_copies: 1 ) @@ -142,7 +142,7 @@ PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, - label_templates_by_service:, + label_templates_by_service: label_templates_by_service, labels: [ { label: { barcode: '12345', test_attr: 'test' } }, { label: { barcode: '67890', test_attr: 'test2' } } @@ -189,9 +189,9 @@ PrintJob.new( printer_name: printer_sprint.name, printer: printer_sprint, - label_templates_by_service:, + label_templates_by_service: label_templates_by_service, labels: [{ label: { barcode: '12345', test_attr: 'test' } }], - labels_sprint:, + labels_sprint: labels_sprint, number_of_copies: 1 ) diff --git a/spec/models/robots/plate_to_tube_racks_robot_spec.rb b/spec/models/robots/plate_to_tube_racks_robot_spec.rb index 72855711d..0b82ae934 100644 --- a/spec/models/robots/plate_to_tube_racks_robot_spec.rb +++ b/spec/models/robots/plate_to_tube_racks_robot_spec.rb @@ -372,7 +372,7 @@ reason: "Robot #{robot_name} started", target_state: 'passed', target_uuid: tube_uuid, - user_uuid: + user_uuid: user_uuid } end ) diff --git a/spec/models/robots/pooling_and_splitting_robot_spec.rb b/spec/models/robots/pooling_and_splitting_robot_spec.rb index 0a3b6139a..1e615cbf0 100644 --- a/spec/models/robots/pooling_and_splitting_robot_spec.rb +++ b/spec/models/robots/pooling_and_splitting_robot_spec.rb @@ -59,7 +59,7 @@ let(:target_1_purpose_uuid) { SecureRandom.uuid } let(:target_plate_1_parents) { [source_plate_1] } let(:target_1_wells) do - %w[A1 B1 C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } + %w[A1 B1 C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } end let(:target_plate_1) { create :v2_plate, target_plate_1_attributes } @@ -69,7 +69,7 @@ let(:target_2_purpose_uuid) { SecureRandom.uuid } let(:target_plate_2_parents) { [source_plate_1] } let(:target_2_wells) do - %w[A1 B1 C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } + %w[A1 B1 C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } end let(:target_plate_2) { create :v2_plate, target_plate_2_attributes } @@ -268,8 +268,8 @@ let(:transfer_source_plates) { [source_plate_1, source_plate_2] } let(:target_1_wells) do - %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + - %w[A1 B1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } + %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + + %w[A1 B1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate_2, [:purpose, { wells: :upstream_plates }]) } @@ -372,7 +372,7 @@ reason: 'Robot Pooling And Splitting Robot started', target_state: 'passed', target_uuid: target_plate_1_uuid, - user_uuid: + user_uuid: user_uuid }, { contents: nil, @@ -380,7 +380,7 @@ reason: 'Robot Pooling And Splitting Robot started', target_state: 'passed', target_uuid: target_plate_2_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/models/robots/pooling_robot_spec.rb b/spec/models/robots/pooling_robot_spec.rb index bc4dea351..9199b8c66 100644 --- a/spec/models/robots/pooling_robot_spec.rb +++ b/spec/models/robots/pooling_robot_spec.rb @@ -24,7 +24,7 @@ purpose_uuid: target_purpose_uuid, barcode_number: 2, parents: target_plate_parents, - wells:, + wells: wells, state: target_plate_state } end @@ -104,7 +104,9 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } + let(:wells) do + %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } + end before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name @@ -173,8 +175,8 @@ let(:transfer_source_plates) { [source_plate, source_plate2] } let(:wells) do - %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + - %w[A1 B1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } + %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + + %w[A1 B1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate2, [:purpose, { wells: :upstream_plates }]) } @@ -220,7 +222,7 @@ reason: 'Robot Pooling Robot started', target_state: 'passed', target_uuid: target_plate_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/models/robots/quadrant_robot_spec.rb b/spec/models/robots/quadrant_robot_spec.rb index 97bb3939c..f31d579bb 100644 --- a/spec/models/robots/quadrant_robot_spec.rb +++ b/spec/models/robots/quadrant_robot_spec.rb @@ -24,7 +24,7 @@ purpose_uuid: target_purpose_uuid, barcode_number: 2, parents: target_plate_parents, - wells: + wells: wells } end @@ -102,7 +102,9 @@ let(:transfer_source_plates) { [source_plate] } - let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, upstream_plates: transfer_source_plates } } + let(:wells) do + %w[C1 D1].map { |location| create :v2_well, location: location, upstream_plates: transfer_source_plates } + end before do create :purpose_config, uuid: source_purpose_uuid, name: source_purpose_name @@ -171,8 +173,8 @@ let(:transfer_source_plates) { [source_plate, source_plate2] } let(:wells) do - %w[B1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + - %w[A1 C1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } + %w[B1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + + %w[A1 C1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate2, [:purpose, { wells: :upstream_plates }]) } @@ -223,8 +225,8 @@ let(:transfer_source_plates) { [source_plate, source_plate2] } let(:wells) do - %w[B1 D1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[1]] } + - %w[C1].map { |location| create :v2_well, location:, upstream_plates: [transfer_source_plates[0]] } + %w[B1 D1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[1]] } + + %w[C1].map { |location| create :v2_well, location: location, upstream_plates: [transfer_source_plates[0]] } end before { bed_plate_lookup(source_plate2, [:purpose, { wells: :upstream_plates }]) } @@ -270,7 +272,7 @@ reason: 'Robot Pooling Robot started', target_state: 'passed', target_uuid: target_plate_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/models/robots/robot_spec.rb b/spec/models/robots/robot_spec.rb index 83fef6358..5620c1a36 100644 --- a/spec/models/robots/robot_spec.rb +++ b/spec/models/robots/robot_spec.rb @@ -620,7 +620,7 @@ barcode_number: '123', purpose_name: 'Limber Cherrypicked', state: 'passed', - custom_metadatum_collection: + custom_metadatum_collection: custom_metadatum_collection end it "is invalid if the barcode isn't recorded" do @@ -737,7 +737,7 @@ reason: 'Robot bravo LB End Prep started', target_state: 'passed', target_uuid: plate.uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/models/robots/splitting_robot_spec.rb b/spec/models/robots/splitting_robot_spec.rb index 47de38814..5728076a5 100644 --- a/spec/models/robots/splitting_robot_spec.rb +++ b/spec/models/robots/splitting_robot_spec.rb @@ -10,14 +10,14 @@ let(:user_uuid) { SecureRandom.uuid } let(:plate_uuid) { SecureRandom.uuid } - let(:wells) { %w[C1 D1].map { |location| create :v2_well, location:, downstream_plates: transfer_target_1 } } + let(:wells) { %w[C1 D1].map { |location| create :v2_well, location: location, downstream_plates: transfer_target_1 } } let(:transfer_target_1) { [target_plate_1] } let(:source_barcode) { source_plate.human_barcode } let(:source_purpose_name) { 'Limber Cherrypicked' } let(:source_plate_state) { 'passed' } let(:source_plate) do - create :v2_plate, barcode_number: 1, purpose_name: source_purpose_name, state: source_plate_state, wells: + create :v2_plate, barcode_number: 1, purpose_name: source_purpose_name, state: source_plate_state, wells: wells end let(:target_barcode_1) { target_plate_1.human_barcode } let(:target_barcode_2) { target_plate_2.human_barcode } @@ -166,7 +166,7 @@ reason: 'Robot bravo LB End Prep started', target_state: 'passed', target_uuid: plate.uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/models/robots_spec.rb b/spec/models/robots_spec.rb index 8fbb0ec0d..a04bfc6ec 100644 --- a/spec/models/robots_spec.rb +++ b/spec/models/robots_spec.rb @@ -14,7 +14,7 @@ describe '::find' do let(:user_uuid) { SecureRandom.uuid } - subject { Robots.find(id: robot_id, api:, user_uuid:) } + subject { Robots.find(id: robot_id, api: api, user_uuid: user_uuid) } context 'with a standard robot' do let(:robot_id) { 'robot_id' } diff --git a/spec/models/sequencescape_submission_spec.rb b/spec/models/sequencescape_submission_spec.rb index b2f1942b9..480b46fb7 100644 --- a/spec/models/sequencescape_submission_spec.rb +++ b/spec/models/sequencescape_submission_spec.rb @@ -11,7 +11,9 @@ let(:template_uuid) { 'template-uuid' } let(:request_options) { { read_length: 150 } } let(:user_uuid) { 'user-uuid' } - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + end describe '#template_uuid' do context 'when set directly' do @@ -22,7 +24,9 @@ context 'when set via template_name' do let(:template_name) { 'Submission template' } - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + end before { Settings.submission_templates = { template_name => template_uuid } } @@ -33,7 +37,9 @@ end describe '#extra_barcodes_trimmed' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + end it 'removes any extra whitespaces' do obj = described_class.new(attributes.merge(extra_barcodes: [' 1234 ', ' 5678 ', ' ', ''])) @@ -42,7 +48,9 @@ end describe '#extra_plates' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + end let(:plate) { create :v2_plate } let(:obj) { described_class.new(attributes.merge(extra_barcodes: %w[1234 5678])) } @@ -57,7 +65,9 @@ end describe '#extra_assets' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + end let(:plate) { create(:passed_plate) } let(:plate2) { create(:passed_plate) } @@ -81,7 +91,9 @@ end describe '#asset_groups_for_orders_creation' do - let(:attributes) { { api:, assets:, template_uuid:, request_options:, user: user_uuid } } + let(:attributes) do + { api: api, assets: assets, template_uuid: template_uuid, request_options: request_options, user: user_uuid } + end it 'returns normal asset groups when no extra barcodes provided' do obj = described_class.new(attributes) @@ -113,8 +125,8 @@ 'orders', payload: { order: { - assets:, - request_options:, + assets: assets, + request_options: request_options, user: user_uuid } }, @@ -157,10 +169,10 @@ let(:assets2) { ['asset-2-uuid'] } let(:attributes) do { - api:, + api: api, asset_groups: { '1' => { - assets:, + assets: assets, study: study1_uuid, project: project1_uuid }, @@ -170,8 +182,8 @@ project: project2_uuid } }, - template_uuid:, - request_options:, + template_uuid: template_uuid, + request_options: request_options, user: user_uuid } end @@ -185,8 +197,8 @@ order: { study: study1_uuid, project: project1_uuid, - assets:, - request_options:, + assets: assets, + request_options: request_options, user: user_uuid } }, @@ -200,7 +212,7 @@ study: study2_uuid, project: project2_uuid, assets: assets2, - request_options:, + request_options: request_options, user: user_uuid } }, diff --git a/spec/models/state_changers_spec.rb b/spec/models/state_changers_spec.rb index 4038215a6..702c30543 100644 --- a/spec/models/state_changers_spec.rb +++ b/spec/models/state_changers_spec.rb @@ -21,11 +21,11 @@ [ { contents: wells_to_pass, - customer_accepts_responsibility:, - reason:, - target_state:, + customer_accepts_responsibility: customer_accepts_responsibility, + reason: reason, + target_state: target_state, target_uuid: plate_uuid, - user_uuid: + user_uuid: user_uuid } ] ) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e2aebd78b..c32370bac 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -63,7 +63,7 @@ options.add_argument('--headless') options.add_argument('--disable_gpu') options.add_argument('--window-size=1600,3200') - Capybara::Selenium::Driver.new(app, browser: :chrome, options:) + Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) end Capybara.javascript_driver = ENV.fetch('JS_DRIVER', 'headless_chrome').to_sym diff --git a/spec/support/api_url_helper.rb b/spec/support/api_url_helper.rb index db511413a..2e720069e 100644 --- a/spec/support/api_url_helper.rb +++ b/spec/support/api_url_helper.rb @@ -29,8 +29,8 @@ def api_url_for(*components) # @return mocked_request def stub_api_get(*components, status: 200, body: '{}') stub_request(:get, api_url_for(*components)).with(headers: { 'Accept' => 'application/json' }).to_return( - status:, - body:, + status: status, + body: body, headers: { 'content-type' => 'application/json' } @@ -67,12 +67,12 @@ def stub_api_modify(*components, body:, payload:, action: :post, status: 201) body: payload ) ) do |request, response| - request.to_return(status:, body: response, headers: { 'content-type' => 'application/json' }) + request.to_return(status: status, body: response, headers: { 'content-type' => 'application/json' }) end end def stub_api_put(*components, body:, payload:) - stub_api_modify(*components, action: :put, status: 200, body:, payload:) + stub_api_modify(*components, action: :put, status: 200, body: body, payload: payload) end end @@ -147,7 +147,7 @@ def stub_v2_plate(plate, stub_search: true, custom_query: nil, custom_includes: end def stub_v2_polymetadata(polymetadata, metadatable_id) - arguments = [{ key: polymetadata.key, metadatable_id: }] + arguments = [{ key: polymetadata.key, metadatable_id: metadatable_id }] allow(Sequencescape::Api::V2::PolyMetadatum).to receive(:find).with(*arguments).and_return([polymetadata]) end diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index 76409187d..68c32423c 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -55,10 +55,10 @@ def stub_create_labware_metadata(barcode, labware_v1, labware_uuid, user_uuid, m custom_metadatum_collection: { user: user_uuid, asset: labware_uuid, - metadata: + metadata: metadata } }, - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata:) + body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata: metadata) ) end @@ -73,7 +73,7 @@ def stub_update_labware_metadata(barcode, labware_v1, user, metadata) metadata: } }, - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata:) + body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid', metadata: metadata) ) end diff --git a/spec/support/shared_tagging_examples.rb b/spec/support/shared_tagging_examples.rb index e85c3c632..44037b2b0 100644 --- a/spec/support/shared_tagging_examples.rb +++ b/spec/support/shared_tagging_examples.rb @@ -29,7 +29,7 @@ tag_layout: { plate: tag_plate_uuid, user: user_uuid, - enforce_uniqueness: + enforce_uniqueness: enforce_uniqueness } }, body: '{}' diff --git a/spec/support/with_pmb_stubbed.rb b/spec/support/with_pmb_stubbed.rb index eeed11766..7028c97b5 100644 --- a/spec/support/with_pmb_stubbed.rb +++ b/spec/support/with_pmb_stubbed.rb @@ -34,7 +34,7 @@ def print_job_post(printer_name, template_id) data: { type: 'print_jobs', attributes: { - printer_name:, + printer_name: printer_name, label_template_id: template_id, labels: { body: [{ label: { barcode: '12345', test_attr: 'test' } }] @@ -49,7 +49,7 @@ def print_job_post_multiple_labels(printer_name, template_id) data: { type: 'print_jobs', attributes: { - printer_name:, + printer_name: printer_name, label_template_id: template_id, labels: { body: [ diff --git a/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb b/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb index 04c87281b..deea94e29 100644 --- a/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb +++ b/spec/views/exports/bioscan_mbrave.tsv.erb_spec.rb @@ -24,7 +24,7 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'C10', library_state: 'pending', - outer_request:, + outer_request: outer_request, sample: sample1, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_11_v2')) @@ -33,7 +33,7 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'A01', library_state: 'pending', - outer_request:, + outer_request: outer_request, sample: sample2, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_7_v2')) @@ -42,7 +42,7 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'A01', library_state: 'pending', - outer_request:, + outer_request: outer_request, sample: sample0, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_1_v2')) @@ -51,7 +51,7 @@ :v2_tagged_aliquot_for_mbrave, well_location: 'H12', library_state: 'pending', - outer_request:, + outer_request: outer_request, sample: sample3, tag: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_forward_96_v2')), tag2: create(:v2_tag, tag_group: create(:v2_tag_group, name: 'Bioscan_reverse_4_24_v2')) diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 6aceae34c..db478369f 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -34,12 +34,12 @@ let(:ancestor_tubes) { { sample1_uuid => ancestor_vac_tube_1, sample2_uuid => ancestor_vac_tube_2 } } # source aliquots - let(:src_aliquot1_s1) { create(:v2_aliquot, sample: sample1, study:) } - let(:src_aliquot2_s1) { create(:v2_aliquot, sample: sample1, study:) } - let(:src_aliquot3_s1) { create(:v2_aliquot, sample: sample1, study:) } - let(:src_aliquot1_s2) { create(:v2_aliquot, sample: sample2, study:) } - let(:src_aliquot2_s2) { create(:v2_aliquot, sample: sample2, study:) } - let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2, study:) } + let(:src_aliquot1_s1) { create(:v2_aliquot, sample: sample1, study: study) } + let(:src_aliquot2_s1) { create(:v2_aliquot, sample: sample1, study: study) } + let(:src_aliquot3_s1) { create(:v2_aliquot, sample: sample1, study: study) } + let(:src_aliquot1_s2) { create(:v2_aliquot, sample: sample2, study: study) } + let(:src_aliquot2_s2) { create(:v2_aliquot, sample: sample2, study: study) } + let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2, study: study) } # qc results let(:live_cell_count_qc) { create(:qc_result, key: 'live_cell_count', value: '20000', units: 'cells/ml') } @@ -49,12 +49,12 @@ # source wells let(:source_well_attributes) do [ - { location: 'A1', aliquots: [src_aliquot1_s1], downstream_tubes: [dest_tube1], qc_results: }, - { location: 'A2', aliquots: [src_aliquot2_s1], downstream_tubes: [dest_tube2], qc_results: }, - { location: 'A3', aliquots: [src_aliquot3_s1], downstream_tubes: [dest_tube3], qc_results: }, - { location: 'B1', aliquots: [src_aliquot1_s2], downstream_tubes: [dest_tube4], qc_results: }, - { location: 'B2', aliquots: [src_aliquot2_s2], downstream_tubes: [dest_tube5], qc_results: }, - { location: 'B3', aliquots: [src_aliquot3_s2], downstream_tubes: [dest_tube6], qc_results: } + { location: 'A1', aliquots: [src_aliquot1_s1], downstream_tubes: [dest_tube1], qc_results: qc_results }, + { location: 'A2', aliquots: [src_aliquot2_s1], downstream_tubes: [dest_tube2], qc_results: qc_results }, + { location: 'A3', aliquots: [src_aliquot3_s1], downstream_tubes: [dest_tube3], qc_results: qc_results }, + { location: 'B1', aliquots: [src_aliquot1_s2], downstream_tubes: [dest_tube4], qc_results: qc_results }, + { location: 'B2', aliquots: [src_aliquot2_s2], downstream_tubes: [dest_tube5], qc_results: qc_results }, + { location: 'B3', aliquots: [src_aliquot3_s2], downstream_tubes: [dest_tube6], qc_results: qc_results } ] end From 1241635ab94e0c2d5c94f4aaeb46b53825cecbd7 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 26 Sep 2024 15:45:46 +0100 Subject: [PATCH 096/141] Adding version information --- lib/deployed_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deployed_version.rb b/lib/deployed_version.rb index 3a547cfaa..1663cdb57 100644 --- a/lib/deployed_version.rb +++ b/lib/deployed_version.rb @@ -53,7 +53,7 @@ def version_hash end def version_label - version_hash ? "#{major}.#{minor}.#{patch}" : 'WIP' + major == 0 && minor == 0 && patch == 0 ? 'WIP' : "#{major}.#{minor}.#{patch}" end private From 60aa5f6bf1875b5902f56419173a80939cf3ee16 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 26 Sep 2024 15:50:25 +0100 Subject: [PATCH 097/141] Adding version information --- lib/deployed_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deployed_version.rb b/lib/deployed_version.rb index 1663cdb57..159a6e6dc 100644 --- a/lib/deployed_version.rb +++ b/lib/deployed_version.rb @@ -53,7 +53,7 @@ def version_hash end def version_label - major == 0 && minor == 0 && patch == 0 ? 'WIP' : "#{major}.#{minor}.#{patch}" + major.zero? && minor.zero? && patch.zero? ? 'WIP' : "#{major}.#{minor}.#{patch}" end private From a487ea092bc385262364a6af87eb32b8e73210c3 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 26 Sep 2024 15:56:22 +0100 Subject: [PATCH 098/141] Adding version information --- .rubocop_todo.yml | 4 ++++ lib/deployed_version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8ad0bced4..5874b9fe2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -15,3 +15,7 @@ Metrics/CollectionLiteralLength: Exclude: - 'spec/models/labware_creators/quadrant_split_plate_spec.rb' - 'spec/helpers/well_helpers_spec.rb' + +Style/NumericPredicate: + Exclude: + - 'lib/deployed_version.rb' \ No newline at end of file diff --git a/lib/deployed_version.rb b/lib/deployed_version.rb index 159a6e6dc..1663cdb57 100644 --- a/lib/deployed_version.rb +++ b/lib/deployed_version.rb @@ -53,7 +53,7 @@ def version_hash end def version_label - major.zero? && minor.zero? && patch.zero? ? 'WIP' : "#{major}.#{minor}.#{patch}" + major == 0 && minor == 0 && patch == 0 ? 'WIP' : "#{major}.#{minor}.#{patch}" end private From 5b0976867de04f7218ae5cd9635c0f26bf233b08 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 26 Sep 2024 15:58:36 +0100 Subject: [PATCH 099/141] Adding version information --- .rubocop_todo.yml | 2 +- spec/factories/well_factories.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5874b9fe2..c4c0e2786 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -18,4 +18,4 @@ Metrics/CollectionLiteralLength: Style/NumericPredicate: Exclude: - - 'lib/deployed_version.rb' \ No newline at end of file + - 'lib/deployed_version.rb' diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 60e5059b8..8400ea233 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -60,7 +60,7 @@ aliquot_factory { :v2_aliquot } aliquots do # Conditional to avoid generating requests when not required - if aliquot_count > 0 + if aliquot_count.positive? create_list aliquot_factory, aliquot_count, outer_request: outer_request, study: study, project: project else [] From a7c03bc95466b91d8bb5bc3b1d752d3b2e296d99 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 26 Sep 2024 21:19:31 +0100 Subject: [PATCH 100/141] Fix parents in Bravo BenchCel Verify initial setup --- config/robots.rb | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index a2201b142..053d9685d 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3782,7 +3782,7 @@ label: 'Bed 4' }, car('1,4').barcode => { - purpose: 'DNA Frag', + purpose: 'LCMT DNA Frag', states: ['pending'], label: 'Carousel 1,4', parent: bed(4).barcode @@ -3791,25 +3791,25 @@ purpose: 'LCMT DNA End Prep', states: ['pending'], label: 'Carousel 2,4', - parent: bed(4).barcode + parent: car('1,4').barcode }, car('3,5').barcode => { purpose: 'LCMT DNA Adp Lig', states: ['pending'], label: 'Carousel 3,5', - parent: bed(4).barcode + parent: car('2,4').barcode }, car('4,4').barcode => { purpose: 'LCMT EM TET2 Ox', states: ['pending'], label: 'Carousel 4,4', - parent: bed(4).barcode + parent: car('3,5').barcode }, car('4,3').barcode => { purpose: 'LCMT EM TET2 Stop', states: ['pending'], label: 'Carousel 4,3', - parent: bed(4).barcode + parent: car('4,4').barcode } } ) @@ -3884,34 +3884,34 @@ } ) + # XXX: The following suggest that we need to create Denat and Deam plates + # beforehand. Are we supposed to create them in pending state as well? # LCM Triomics EMSeq Bravo bed verification # Bravo LCMT EM TET2 Stop to Denat and Deam Setup - custom_robot( - 'bravo-lcmt-em-tet2-stop-to-denat-and-deam-setup', - name: 'Bravo LCMT EM TET2 Stop to Denat and Deam Setup', - verify_robot: true, - beds: { - bed(4).barcode => { - purpose: 'LCMT EM TET2 Stop', - states: ['passed'], - label: 'Bed 4' - }, - car('3,3').barcode => { - purpose: 'LCMT EM NaOH Denat', - states: ['pending'], - label: 'Carousel 4,4', - parent: bed(4).barcode, - target_state: 'passed' - }, - car('4,3').barcode => { - purpose: 'LCMT EM APOBEC Deam', - states: ['pending'], - label: 'Carousel 3,4', - parent: bed(4).barcode, - target_state: 'passed' - } - } - ) + # custom_robot( + # 'bravo-lcmt-em-tet2-stop-to-denat-and-deam-setup', + # name: 'Bravo LCMT EM TET2 Stop to Denat and Deam Setup', + # verify_robot: true, + # beds: { + # bed(4).barcode => { + # purpose: 'LCMT EM TET2 Stop', + # states: ['passed'], + # label: 'Bed 4' + # }, + # car('3,3').barcode => { + # purpose: 'LCMT EM NaOH Denat', + # states: ['pending'], + # label: 'Carousel 4,4', + # parent: bed(4).barcode + # }, + # car('4,3').barcode => { + # purpose: 'LCMT EM APOBEC Deam', + # states: ['pending'], + # label: 'Carousel 3,4', + # parent: bed(4).barcode + # } + # } + # ) # LCM Triomics EMSeq Bravo bed verification # Bravo LCMT EM NaOH Denat Verification From a25269386565fc24177a1cf5defe69b0285ababc Mon Sep 17 00:00:00 2001 From: yoldas Date: Fri, 27 Sep 2024 02:07:31 +0100 Subject: [PATCH 101/141] Fix Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR --- config/robots.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index 053d9685d..424281120 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3819,7 +3819,7 @@ custom_robot( 'bravo-lcmt-dna-frag-verification', name: 'Bravo LCMT DNA Frag Verification', - verify_robot: true, + verify_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT DNA Frag', @@ -3835,7 +3835,7 @@ custom_robot( 'bravo-lcmt-dna-end-prep-verification', name: 'Bravo LCMT DNA End Prep Verification', - verify_robot: true, + verify_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT DNA End Prep', @@ -3851,7 +3851,7 @@ custom_robot( 'bravo-lcmt-dna-adp-lig-to-lcmt-dna-lib-pcr', name: 'Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR', - verify_robot: true, + verify_robot: false, beds: { bed(6).barcode => { purpose: 'LCMT DNA Adp Lig', @@ -3873,7 +3873,7 @@ custom_robot( 'bravo-lcmt-em-tet2-ox-verification', name: 'Bravo LCMT EM TET2 Ox Verification', - verify_robot: true, + verify_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Ox', @@ -3918,7 +3918,7 @@ custom_robot( 'bravo-lcmt-em-naoh-denat-verification', name: 'Bravo LCMT EM NaOH Denat Verification', - verify_robot: true, + verify_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT EM NaOH Denat', @@ -3933,16 +3933,16 @@ # Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR custom_robot( 'bravo-lcmt-em-apobec-deam-to-lcmt-em-lib-pcr', - name: 'Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR', - verify_robot: true, + name: 'Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR', + verify_robot: false, beds: { bed(5).barcode => { - purpose: 'LCMT DNA Adp Lig', + purpose: 'LCMT EM APOBEC Deam', states: ['passed'], label: 'Bed 5' }, bed(6).barcode => { - purpose: 'LCMT DNA Lib PCR', + purpose: 'LCMT EM Lib PCR', states: ['pending'], label: 'Bed 6', parent: bed(5).barcode, From 22fb66aca0f835ddf359830f1c058e06af6e770a Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Fri, 27 Sep 2024 10:20:45 +0100 Subject: [PATCH 102/141] Adding version information --- lib/deployed_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deployed_version.rb b/lib/deployed_version.rb index 1663cdb57..263b2ecfb 100644 --- a/lib/deployed_version.rb +++ b/lib/deployed_version.rb @@ -53,7 +53,7 @@ def version_hash end def version_label - major == 0 && minor == 0 && patch == 0 ? 'WIP' : "#{major}.#{minor}.#{patch}" + major.to_s == '0' && minor.to_s == '0' && patch.to_s == '0' ? 'WIP' : "#{major}.#{minor}.#{patch}" end private From a43c1c6935d6632f20d2dadac1fbd12bcb766653 Mon Sep 17 00:00:00 2001 From: sabrine33 Date: Fri, 27 Sep 2024 11:23:32 +0100 Subject: [PATCH 103/141] Y24-336 - ANOSPP - Activate pipeline in Production unWIP file config/pipelines/high_throughput_anospp.wip.yml --- ...{high_throughput_anospp.wip.yml => high_throughput_anospp.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config/pipelines/{high_throughput_anospp.wip.yml => high_throughput_anospp.yml} (100%) diff --git a/config/pipelines/high_throughput_anospp.wip.yml b/config/pipelines/high_throughput_anospp.yml similarity index 100% rename from config/pipelines/high_throughput_anospp.wip.yml rename to config/pipelines/high_throughput_anospp.yml From cc1744ebe686c406f64d2ab349e4926ff53edb05 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 27 Sep 2024 15:10:35 +0100 Subject: [PATCH 104/141] fix: filter for any relatives that might not have a purpose Not just when there is a single relative without a purpose --- app/views/labware/_relatives_list.html.erb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/views/labware/_relatives_list.html.erb b/app/views/labware/_relatives_list.html.erb index dadcd9544..429b80b8a 100644 --- a/app/views/labware/_relatives_list.html.erb +++ b/app/views/labware/_relatives_list.html.erb @@ -1,14 +1,18 @@ <%# locals: (presenter:) %> +<% + found_parents = presenter.labware.parents&.filter{ |parent| parent.purpose.present? } + found_children = presenter.labware.children&.filter{ |child| child.purpose.present? } +%>
Parents - <%= content_tag :span, presenter.labware.parents.size, class: "badge badge-pill badge-secondary" if presenter.labware.parents&.any? %> + <%= content_tag :span, found_parents.size, class: "badge badge-pill badge-secondary" %>
- <% if presenter.labware.parents&.any? { |parent| parent.purpose.present? } %> - <%= render partial: 'labware/parent_labware_item', collection: presenter.labware.parents, as: :labware %> + <% if found_parents %> + <%= render partial: 'labware/parent_labware_item', collection: found_parents, as: :labware %> <% else %>
No parents found
<% end %> @@ -16,12 +20,12 @@
Children - <%= content_tag :span, presenter.labware.children.size, class: "badge badge-pill badge-secondary" if presenter.labware.children&.any? %> + <%= content_tag :span, found_children.size, class: "badge badge-pill badge-secondary" %>
- <% if presenter.labware.children&.any? { |child| child.purpose.present? } %> - <%= render partial: 'labware/child_labware_item', collection: presenter.labware.children, as: :labware, locals: { presenter: presenter, open_in_new_window: true } %> + <% if found_children %> + <%= render partial: 'labware/child_labware_item', collection: found_children, as: :labware, locals: { presenter: presenter, open_in_new_window: true } %> <% else %>
No children found
<% end %> From 028725b650e6a3a76af2e11e7af7574c67a97bdf Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 27 Sep 2024 15:29:27 +0100 Subject: [PATCH 105/141] fix: rename found_* -> valid_* --- app/views/labware/_relatives_list.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/labware/_relatives_list.html.erb b/app/views/labware/_relatives_list.html.erb index 429b80b8a..7f035cb7f 100644 --- a/app/views/labware/_relatives_list.html.erb +++ b/app/views/labware/_relatives_list.html.erb @@ -1,18 +1,18 @@ <%# locals: (presenter:) %> <% - found_parents = presenter.labware.parents&.filter{ |parent| parent.purpose.present? } - found_children = presenter.labware.children&.filter{ |child| child.purpose.present? } + valid_parents = presenter.labware.parents&.filter{ |parent| parent.purpose.present? } + valid_children = presenter.labware.children&.filter{ |child| child.purpose.present? } %>
Parents - <%= content_tag :span, found_parents.size, class: "badge badge-pill badge-secondary" %> + <%= content_tag :span, valid_parents.size, class: "badge badge-pill badge-secondary" %>
- <% if found_parents %> - <%= render partial: 'labware/parent_labware_item', collection: found_parents, as: :labware %> + <% if valid_parents %> + <%= render partial: 'labware/parent_labware_item', collection: valid_parents, as: :labware %> <% else %>
No parents found
<% end %> @@ -20,12 +20,12 @@
Children - <%= content_tag :span, found_children.size, class: "badge badge-pill badge-secondary" %> + <%= content_tag :span, valid_children.size, class: "badge badge-pill badge-secondary" %>
- <% if found_children %> - <%= render partial: 'labware/child_labware_item', collection: found_children, as: :labware, locals: { presenter: presenter, open_in_new_window: true } %> + <% if valid_children %> + <%= render partial: 'labware/child_labware_item', collection: valid_children, as: :labware, locals: { presenter: presenter, open_in_new_window: true } %> <% else %>
No children found
<% end %> From a1a3f9b538704ebd195143e293ad06c14c736532 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 27 Sep 2024 15:33:31 +0100 Subject: [PATCH 106/141] fix: default valid_relatives to an empty array if the filter returns nil --- app/views/labware/_relatives_list.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/labware/_relatives_list.html.erb b/app/views/labware/_relatives_list.html.erb index 7f035cb7f..6d07d5040 100644 --- a/app/views/labware/_relatives_list.html.erb +++ b/app/views/labware/_relatives_list.html.erb @@ -1,7 +1,7 @@ <%# locals: (presenter:) %> <% - valid_parents = presenter.labware.parents&.filter{ |parent| parent.purpose.present? } - valid_children = presenter.labware.children&.filter{ |child| child.purpose.present? } + valid_parents = presenter.labware.parents&.filter{ |parent| parent.purpose.present? } || [] + valid_children = presenter.labware.children&.filter{ |child| child.purpose.present? } || [] %>
From 3e658f77742555f7ca2e77802544a8626b1e5514 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Fri, 27 Sep 2024 16:14:22 +0100 Subject: [PATCH 107/141] trigger: From f674265abcd983bf329b08aecb561a84d4e9192e Mon Sep 17 00:00:00 2001 From: sabrine33 Date: Mon, 30 Sep 2024 12:23:19 +0100 Subject: [PATCH 108/141] DPL-918: update LRC PBMC Defrost PBS and LRC PBMC Pool thresholds to defaults to 65% --- config/purposes/scrna_core_cdna_prep.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/purposes/scrna_core_cdna_prep.yml b/config/purposes/scrna_core_cdna_prep.yml index 2bb7489d8..6ad949b2a 100644 --- a/config/purposes/scrna_core_cdna_prep.yml +++ b/config/purposes/scrna_core_cdna_prep.yml @@ -32,7 +32,7 @@ LRC PBMC Defrost PBS: :qc_thresholds: viability: units: '%' - default_threshold: 50 + default_threshold: 65 total_cell_count: name: Total cell count units: 'cells/ml' @@ -48,7 +48,7 @@ LRC PBMC Pools: :qc_thresholds: viability: units: '%' - default_threshold: 70 + default_threshold: 65 :presenter_class: name: Presenters::DonorPoolingPlatePresenter args: From 5735c711dc57fdda4b82dead20e9cfd2b22b19d2 Mon Sep 17 00:00:00 2001 From: Ben Topping Date: Mon, 30 Sep 2024 15:41:02 +0100 Subject: [PATCH 109/141] fix(print-job): handles case where pmb label_template doesnt exist --- app/models/print_job.rb | 17 ++++++++++++++--- spec/models/print_job_spec.rb | 19 +++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/app/models/print_job.rb b/app/models/print_job.rb index f1a7eeae3..eac78d4c3 100644 --- a/app/models/print_job.rb +++ b/app/models/print_job.rb @@ -24,10 +24,14 @@ def execute end def print_to_pmb + # Ensure the template exists before attempting to print + label_template_id = pmb_label_template_id + return false if label_template_id.nil? + job = PMB::PrintJob.new( printer_name: printer_name, - label_template_id: pmb_label_template_id, + label_template_id: label_template_id, labels: { body: (labels * number_of_copies) } @@ -134,10 +138,17 @@ def number_of_copies=(number) private def pmb_label_template_id - # This isn't a rails finder; so we disable the cop. - PMB::LabelTemplate.where(name: get_label_template_by_service('PMB')).first.id + pmb_label_template = get_label_template_by_service('PMB') + template_id = PMB::LabelTemplate.where(name: pmb_label_template).first&.id + if template_id.nil? + errors.add(:pmb, "Unable to find label template: #{pmb_label_template}") + nil + else + template_id + end rescue JsonApiClient::Errors::ConnectionError errors.add(:pmb, 'PrintMyBarcode service is down') + nil end def get_label_template_by_service(print_service) diff --git a/spec/models/print_job_spec.rb b/spec/models/print_job_spec.rb index 7a0ffbf07..162c88b2d 100644 --- a/spec/models/print_job_spec.rb +++ b/spec/models/print_job_spec.rb @@ -157,17 +157,32 @@ end it 'should not execute if pmb is down' do - stub_request(:get, "http://localhost:3002#{label_template_url}").to_raise(JsonApiClient::Errors::ConnectionError) - stub_request(:post, 'http://localhost:3002/v1/print_jobs').to_raise(JsonApiClient::Errors::ConnectionError) + pj = + PrintJob.new( + printer_name: printer_pmb.name, + printer: printer_pmb, + label_templates_by_service: label_templates_by_service, + labels: [{ label: { barcode: '12345', test_attr: 'test' } }], + number_of_copies: 1 + ) + allow(PMB::LabelTemplate).to receive(:where).and_raise(JsonApiClient::Errors::ConnectionError.new('error')) + expect(pj.execute).to be false + expect(pj.errors.full_messages[0]).to eq('Pmb PrintMyBarcode service is down') + end + it 'should not execute if the pmb label template cannot be found' do pj = PrintJob.new( printer_name: printer_pmb.name, printer: printer_pmb, + label_templates_by_service: label_templates_by_service, labels: [{ label: { barcode: '12345', test_attr: 'test' } }], number_of_copies: 1 ) + + allow(PMB::LabelTemplate).to receive(:where).and_return([]) expect(pj.execute).to be false + expect(pj.errors.full_messages[0]).to eq("Pmb Unable to find label template: #{label_template_name_pmb}") end end From 8160630265a3016d50abd49e187dd09b47703a09 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 30 Sep 2024 16:11:11 +0100 Subject: [PATCH 110/141] build: update for docker compose v2 --- README.md | 16 ++++++++-------- docker-compose.yml | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 732f3bf45..10a10ffc7 100644 --- a/README.md +++ b/README.md @@ -28,19 +28,19 @@ You must have Docker Desktop installed on your machine. Then the only command you should need to run is: ```shell -docker-compose up +docker compose up ``` Variations on this command include: -- `docker-compose up -d` which starts the container as a background task - (freeing up the terminal). You can then use `docker-compose down` to turn it +- `docker compose up -d` which starts the container as a background task + (freeing up the terminal). You can then use `docker compose down` to turn it off again. -- `GENERATE_CONFIG=false docker-compose up` which will avoid running the +- `GENERATE_CONFIG=false docker compose up` which will avoid running the `config:generate` rake task as Limber is started. -- `PRECOMPILE_ASSETS=false docker-compose up` which will avoid precompiling the +- `PRECOMPILE_ASSETS=false docker compose up` which will avoid precompiling the assets as Limber is started. -- `docker-compose up --build` which forces a rebuild of the Docker image if your +- `docker compose up --build` which forces a rebuild of the Docker image if your changes to the Dockerfile or related scripts don't seem to be taking effect. Limber should be accessible via [http://localhost:3001](http://localhost:3001). @@ -158,7 +158,7 @@ Alternatively, run `./compile_build.sh` to compile the build files or run `yarn If during development changes do not seem to be taking effect, try: - Restart the application: -- Destroy and recreate the Docker container `docker-compose down && GENERATE_CONFIG=false docker-compose up -d` +- Destroy and recreate the Docker container `docker compose down && GENERATE_CONFIG=false docker compose up -d` - Rebuild the Docker image, particularly useful for changing dependencies - Clobber local resources `rails assets:clobber` @@ -167,7 +167,7 @@ If during development changes do not seem to be taking effect, try: The rest of the sections shown here were written for and apply to the native installation, but can also be used in the Docker container if required. In order to use Docker, it's probably best to create a shell in the running container. -Assuming you started the container via `docker-compose` you can access the shell +Assuming you started the container via `docker compose` you can access the shell using: ```shell diff --git a/docker-compose.yml b/docker-compose.yml index f5de17ba0..c1c79b2b8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.3' services: limber: build: From 2e734ab164ba46f29369e06f40e1c2dd0ff50fb8 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Tue, 1 Oct 2024 10:47:18 +0100 Subject: [PATCH 111/141] Reverting back the version hash change --- lib/deployed_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deployed_version.rb b/lib/deployed_version.rb index 263b2ecfb..3a547cfaa 100644 --- a/lib/deployed_version.rb +++ b/lib/deployed_version.rb @@ -53,7 +53,7 @@ def version_hash end def version_label - major.to_s == '0' && minor.to_s == '0' && patch.to_s == '0' ? 'WIP' : "#{major}.#{minor}.#{patch}" + version_hash ? "#{major}.#{minor}.#{patch}" : 'WIP' end private From b8b52c1d5d20b22c90d69c14391e61973f9782fc Mon Sep 17 00:00:00 2001 From: Andrew Sparkes Date: Tue, 1 Oct 2024 12:28:22 +0100 Subject: [PATCH 112/141] upped version number for ANOSPP release --- .release-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.release-version b/.release-version index 71c010956..1620db590 100644 --- a/.release-version +++ b/.release-version @@ -1 +1 @@ -3.60.0 +3.61.0 From e0ef5ed54333250367b90f22e646c9e322a5663f Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 1 Oct 2024 13:53:21 +0100 Subject: [PATCH 113/141] fix: run the 'Check release version' action for even a single commit --- .github/workflows/check_release_version.yml | 9 ++++++++- .github/workflows/create_release_pr.yml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_release_version.yml b/.github/workflows/check_release_version.yml index 0c0a4c4d4..ac060ed92 100644 --- a/.github/workflows/check_release_version.yml +++ b/.github/workflows/check_release_version.yml @@ -2,10 +2,17 @@ name: Check release version on: - workflow_dispatch: pull_request: branches: - master + types: + # defaults + - opened + - synchronize + - reopened + # custom + - ready_for_review # required for Github-created PRs + jobs: check: diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index cd65bbd2c..16560e113 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -56,7 +56,7 @@ jobs: EXISTING_PR=$(gh pr list --base master --head develop --json number --jq '.[0].number') if [ -z "$EXISTING_PR" ]; then - gh pr create --base master --head develop --title "$PR_TITLE" --body "$PR_BODY" + gh pr create --base master --head develop --title "$PR_TITLE" --body "$PR_BODY" --draft else gh pr edit "$EXISTING_PR" --body "$PR_BODY" fi From 4751b73cc869b850bb0eda274b48859b92164225 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 1 Oct 2024 13:54:49 +0100 Subject: [PATCH 114/141] fix: remove initial PR branch used for debugging as trigger --- .github/workflows/create_release_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml index 16560e113..4626ccf1a 100644 --- a/.github/workflows/create_release_pr.yml +++ b/.github/workflows/create_release_pr.yml @@ -5,7 +5,6 @@ on: push: branches: - develop - - sh51/create-release-pr-action jobs: pull_request: runs-on: ubuntu-latest From ea5f24f7c2c5e420c2440af04b04d65c4f3ac4d2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Tue, 1 Oct 2024 14:25:45 +0100 Subject: [PATCH 115/141] style: prettier --- .github/workflows/check_release_version.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check_release_version.yml b/.github/workflows/check_release_version.yml index ac060ed92..83fc603b7 100644 --- a/.github/workflows/check_release_version.yml +++ b/.github/workflows/check_release_version.yml @@ -13,7 +13,6 @@ on: # custom - ready_for_review # required for Github-created PRs - jobs: check: runs-on: ubuntu-latest From 64716584b2d1fcc8b89cc8241f60a287d9e2f5b8 Mon Sep 17 00:00:00 2001 From: Ben Topping Date: Wed, 2 Oct 2024 11:37:29 +0100 Subject: [PATCH 116/141] feat(scrna): adjusts pbmc defrost to pbmc pools export values --- ...pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb | 7 +- ...rost_pbs_to_lrc_pbmc_pools.csv.erb_spec.rb | 74 +++++++++---------- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/app/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb b/app/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb index f278ed8e2..9afc22e87 100644 --- a/app/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb +++ b/app/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb @@ -24,6 +24,7 @@ study_required_number_of_cells_key = args[:study_required_number_of_cells_key] maximum_sample_volume = 60.0 # microlitres + minimum_sample_volume = 5.0 # microlitres resuspension_volume_per_sample = 2.2 # microlitres minimum_resuspension_volume = 10.0 # microlitres millilitres_to_microlitres = 1_000.0 @@ -52,14 +53,14 @@ # Calculate the sample volume required for the number of cells - required_volume = [millilitres_to_microlitres * required_number_of_cells / cell_count.value.to_i, maximum_sample_volume].min + required_volume = (millilitres_to_microlitres * required_number_of_cells / cell_count.value.to_f).clamp(minimum_sample_volume, maximum_sample_volume) transfer_request_data << [ src_barcode, src_location, @plate.labware_barcode.human, dest_well.location, - '%0.2f' % required_volume, + '%0.1f' % required_volume, # We pass in the required number of cells so that we can calculate the resuspension volume later required_number_of_cells ] @@ -74,7 +75,7 @@ required_number_of_cells = data[5] resuspension_volume = [(samples_in_pool * required_number_of_cells * wastage_accountment) / desired_chip_loading_concentration, minimum_resuspension_volume].max # Replace required number of cells with resuspension volume - data[5] = '%0.2f' % resuspension_volume + data[5] = '%0.1f' % resuspension_volume data end %> diff --git a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb_spec.rb index 8bc52ae7f..5918977e4 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_lrc_pbmc_pools.csv.erb_spec.rb @@ -10,20 +10,20 @@ let(:plate1_barcode) { 'DN1S' } let(:plate2_barcode) { 'DN2T' } - let(:total_cell_count_a1) { create(:qc_result, key: 'total_cell_count', value: '1_000_000', units: 'cells/ml') } - let(:total_cell_count_b1) { create(:qc_result, key: 'total_cell_count', value: '2_000_000', units: 'cells/ml') } - let(:total_cell_count_c1) { create(:qc_result, key: 'total_cell_count', value: '3_000_000', units: 'cells/ml') } - let(:total_cell_count_d1) { create(:qc_result, key: 'total_cell_count', value: '4_000_000', units: 'cells/ml') } + let(:total_cell_count_a1) { create(:qc_result, key: 'total_cell_count', value: '100_000', units: 'cells/ml') } + let(:total_cell_count_b1) { create(:qc_result, key: 'total_cell_count', value: '200_000', units: 'cells/ml') } + let(:total_cell_count_c1) { create(:qc_result, key: 'total_cell_count', value: '300_000', units: 'cells/ml') } + let(:total_cell_count_d1) { create(:qc_result, key: 'total_cell_count', value: '400_000', units: 'cells/ml') } - let(:total_cell_count_a2) { create(:qc_result, key: 'total_cell_count', value: '5_000_000', units: 'cells/ml') } - let(:total_cell_count_b2) { create(:qc_result, key: 'total_cell_count', value: '6_000_000', units: 'cells/ml') } - let(:total_cell_count_c2) { create(:qc_result, key: 'total_cell_count', value: '7_000_000', units: 'cells/ml') } - let(:total_cell_count_d2) { create(:qc_result, key: 'total_cell_count', value: '8_000_000', units: 'cells/ml') } + let(:total_cell_count_a2) { create(:qc_result, key: 'total_cell_count', value: '500_000', units: 'cells/ml') } + let(:total_cell_count_b2) { create(:qc_result, key: 'total_cell_count', value: '600_000', units: 'cells/ml') } + let(:total_cell_count_c2) { create(:qc_result, key: 'total_cell_count', value: '700_000', units: 'cells/ml') } + let(:total_cell_count_d2) { create(:qc_result, key: 'total_cell_count', value: '800_000', units: 'cells/ml') } - let(:total_cell_count_a3) { create(:qc_result, key: 'total_cell_count', value: '9_000_000', units: 'cells/ml') } - let(:total_cell_count_b3) { create(:qc_result, key: 'total_cell_count', value: '10_000_000', units: 'cells/ml') } - let(:total_cell_count_c3) { create(:qc_result, key: 'total_cell_count', value: '11_000_000', units: 'cells/ml') } - let(:total_cell_count_d3) { create(:qc_result, key: 'total_cell_count', value: '12_000_000', units: 'cells/ml') } + let(:total_cell_count_a3) { create(:qc_result, key: 'total_cell_count', value: '900_000', units: 'cells/ml') } + let(:total_cell_count_b3) { create(:qc_result, key: 'total_cell_count', value: '1_000_000', units: 'cells/ml') } + let(:total_cell_count_c3) { create(:qc_result, key: 'total_cell_count', value: '1_100_000', units: 'cells/ml') } + let(:total_cell_count_d3) { create(:qc_result, key: 'total_cell_count', value: '1_200_000', units: 'cells/ml') } let(:source_well_a1) do create(:v2_well, location: 'A1', qc_results: [total_cell_count_a1], plate_barcode: plate1_barcode) @@ -130,18 +130,18 @@ 'Sample Volume (µL)', 'Resuspension Volume (µL)' ], - %w[DN1S A1 DN3U A1 5.00 11.90], - %w[DN1S B1 DN3U B1 2.50 11.90], - %w[DN1S A2 DN3U A1 1.00 11.90], - %w[DN1S B2 DN3U B1 0.83 11.90], - %w[DN1S A3 DN3U A1 0.56 11.90], - %w[DN1S B3 DN3U B1 0.50 11.90], - %w[DN2T C1 DN3U A1 1.67 11.90], - %w[DN2T D1 DN3U B1 1.25 11.90], - %w[DN2T C2 DN3U A1 0.71 11.90], - %w[DN2T D2 DN3U B1 0.62 11.90], - %w[DN2T C3 DN3U A1 0.45 11.90], - %w[DN2T D3 DN3U B1 0.42 11.90] + %w[DN1S A1 DN3U A1 50.0 11.9], + %w[DN1S B1 DN3U B1 25.0 11.9], + %w[DN1S A2 DN3U A1 10.0 11.9], + %w[DN1S B2 DN3U B1 8.3 11.9], + %w[DN1S A3 DN3U A1 5.6 11.9], + %w[DN1S B3 DN3U B1 5.0 11.9], + %w[DN2T C1 DN3U A1 16.7 11.9], + %w[DN2T D1 DN3U B1 12.5 11.9], + %w[DN2T C2 DN3U A1 7.1 11.9], + %w[DN2T D2 DN3U B1 6.2 11.9], + %w[DN2T C3 DN3U A1 5.0 11.9], + %w[DN2T D3 DN3U B1 5.0 11.9] ] end @@ -175,7 +175,7 @@ context 'with study-specific cell count option' do let!(:study) do - poly_metadatum = create(:poly_metadatum, key: cell_count_key, value: '9000') + poly_metadatum = create(:poly_metadatum, key: cell_count_key, value: '6000') create(:study_with_poly_metadata, poly_metadata: [poly_metadatum]) # poly_metadata with cell count option end @@ -191,18 +191,18 @@ 'Sample Volume (µL)', 'Resuspension Volume (µL)' ], - %w[DN1S A1 DN3U A1 9.00 21.43], - %w[DN1S B1 DN3U B1 4.50 21.43], - %w[DN1S A2 DN3U A1 1.80 21.43], - %w[DN1S B2 DN3U B1 1.50 21.43], - %w[DN1S A3 DN3U A1 1.00 21.43], - %w[DN1S B3 DN3U B1 0.90 21.43], - %w[DN2T C1 DN3U A1 3.00 21.43], - %w[DN2T D1 DN3U B1 2.25 21.43], - %w[DN2T C2 DN3U A1 1.29 21.43], - %w[DN2T D2 DN3U B1 1.12 21.43], - %w[DN2T C3 DN3U A1 0.82 21.43], - %w[DN2T D3 DN3U B1 0.75 21.43] + %w[DN1S A1 DN3U A1 60.0 14.3], + %w[DN1S B1 DN3U B1 30.0 14.3], + %w[DN1S A2 DN3U A1 12.0 14.3], + %w[DN1S B2 DN3U B1 10.0 14.3], + %w[DN1S A3 DN3U A1 6.7 14.3], + %w[DN1S B3 DN3U B1 6.0 14.3], + %w[DN2T C1 DN3U A1 20.0 14.3], + %w[DN2T D1 DN3U B1 15.0 14.3], + %w[DN2T C2 DN3U A1 8.6 14.3], + %w[DN2T D2 DN3U B1 7.5 14.3], + %w[DN2T C3 DN3U A1 5.5 14.3], + %w[DN2T D3 DN3U B1 5.0 14.3] ] end it 'renders the csv' do From a1656f1b394ade507f61039d46dc1ce9de41e495 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 3 Oct 2024 08:33:36 +0100 Subject: [PATCH 117/141] Testing compile-build automated deployment release --- .github/workflows/automated_release.yml | 2 +- compile-build | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/automated_release.yml b/.github/workflows/automated_release.yml index d97cfb087..8d50b1c57 100644 --- a/.github/workflows/automated_release.yml +++ b/.github/workflows/automated_release.yml @@ -29,7 +29,7 @@ jobs: # Actually run our build - name: Create Build - run: ./compile-build + run: ./compile-build '' v${{ env.RELEASE_VERSION }} ${BRANCH_NAME} # Create a release tag based on the branch name and .release-version file - name: Set release tag diff --git a/compile-build b/compile-build index aefb1c1ec..c85f5bf8a 100755 --- a/compile-build +++ b/compile-build @@ -10,9 +10,9 @@ bundle exec rake assets:clobber echo 'Compiling assets' bundle exec rake assets:precompile echo 'Generating sha' -git rev-parse HEAD > REVISION -git tag -l --points-at HEAD --sort -version:refname | head -1 > TAG -git rev-parse --abbrev-ref HEAD > BRANCH +Teecho ${1:-$(git rev-parse HEAD)} > REVISION +echo ${2:-$(git tag -l --points-at HEAD --sort -version:refname | head -1)} > TAG +echo ${3:-$(git rev-parse --abbrev-ref HEAD)} > BRANCH echo 'Compiling tar.gz' tar \ --exclude='*.swp' \ From 6e155b144ceee478743904216016781d83374b7b Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 3 Oct 2024 08:35:50 +0100 Subject: [PATCH 118/141] Testing compile-build automated deployment release --- compile-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile-build b/compile-build index c85f5bf8a..f5ff94575 100755 --- a/compile-build +++ b/compile-build @@ -10,7 +10,7 @@ bundle exec rake assets:clobber echo 'Compiling assets' bundle exec rake assets:precompile echo 'Generating sha' -Teecho ${1:-$(git rev-parse HEAD)} > REVISION +echo ${1:-$(git rev-parse HEAD)} > REVISION echo ${2:-$(git tag -l --points-at HEAD --sort -version:refname | head -1)} > TAG echo ${3:-$(git rev-parse --abbrev-ref HEAD)} > BRANCH echo 'Compiling tar.gz' From 69e24005d0e2724aeffcdfca5ab485d7dc2ffd89 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 3 Oct 2024 08:38:55 +0100 Subject: [PATCH 119/141] Rolling back the changes. --- .github/workflows/automated_release.yml | 2 +- compile-build | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/automated_release.yml b/.github/workflows/automated_release.yml index 8d50b1c57..d97cfb087 100644 --- a/.github/workflows/automated_release.yml +++ b/.github/workflows/automated_release.yml @@ -29,7 +29,7 @@ jobs: # Actually run our build - name: Create Build - run: ./compile-build '' v${{ env.RELEASE_VERSION }} ${BRANCH_NAME} + run: ./compile-build # Create a release tag based on the branch name and .release-version file - name: Set release tag diff --git a/compile-build b/compile-build index f5ff94575..aefb1c1ec 100755 --- a/compile-build +++ b/compile-build @@ -10,9 +10,9 @@ bundle exec rake assets:clobber echo 'Compiling assets' bundle exec rake assets:precompile echo 'Generating sha' -echo ${1:-$(git rev-parse HEAD)} > REVISION -echo ${2:-$(git tag -l --points-at HEAD --sort -version:refname | head -1)} > TAG -echo ${3:-$(git rev-parse --abbrev-ref HEAD)} > BRANCH +git rev-parse HEAD > REVISION +git tag -l --points-at HEAD --sort -version:refname | head -1 > TAG +git rev-parse --abbrev-ref HEAD > BRANCH echo 'Compiling tar.gz' tar \ --exclude='*.swp' \ From 26468611574e4d5dd89eb13ade348934236671ee Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 3 Oct 2024 08:48:44 +0100 Subject: [PATCH 120/141] New branch with CI possible fixes --- .github/workflows/automated_release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/automated_release.yml b/.github/workflows/automated_release.yml index d97cfb087..9baa842da 100644 --- a/.github/workflows/automated_release.yml +++ b/.github/workflows/automated_release.yml @@ -5,6 +5,7 @@ on: branches: - master - develop + - temp-branch-for-testing-ci-actions env: BUNDLE_WITHOUT: 'test lint' @@ -27,10 +28,6 @@ jobs: with: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - # Actually run our build - - name: Create Build - run: ./compile-build - # Create a release tag based on the branch name and .release-version file - name: Set release tag # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable @@ -38,6 +35,10 @@ jobs: # On the master branch this would then only create RELEASE_VERSION=2.4.6 run: echo "RELEASE_VERSION=$(printf -- '%s%s\n' $(cat .release-version) $([ ${BRANCH_NAME} = "develop" ] && printf -- '-%s-develop' ${GITHUB_RUN_ID} || echo ""))" >> $GITHUB_ENV + # Actually run our build + - name: Create Build + run: ./compile-build '' v${{ env.RELEASE_VERSION }} ${BRANCH_NAME} + # Create a GitHub release with the release asset as an artifact - name: Create release and upload release.tar.gz uses: ncipollo/release-action@v1.8.8 From 076ccb8215fa900b5dc691e5328c8ae6bbd65786 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 3 Oct 2024 08:54:06 +0100 Subject: [PATCH 121/141] Removing temp branch from ci files --- .github/workflows/automated_release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/automated_release.yml b/.github/workflows/automated_release.yml index 9baa842da..d3821b796 100644 --- a/.github/workflows/automated_release.yml +++ b/.github/workflows/automated_release.yml @@ -5,7 +5,6 @@ on: branches: - master - develop - - temp-branch-for-testing-ci-actions env: BUNDLE_WITHOUT: 'test lint' From b181599b073d738349b02fa6a7c33c863dd02a42 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 3 Oct 2024 09:03:45 +0100 Subject: [PATCH 122/141] Removing temp branch from ci files --- compile-build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile-build b/compile-build index aefb1c1ec..f5ff94575 100755 --- a/compile-build +++ b/compile-build @@ -10,9 +10,9 @@ bundle exec rake assets:clobber echo 'Compiling assets' bundle exec rake assets:precompile echo 'Generating sha' -git rev-parse HEAD > REVISION -git tag -l --points-at HEAD --sort -version:refname | head -1 > TAG -git rev-parse --abbrev-ref HEAD > BRANCH +echo ${1:-$(git rev-parse HEAD)} > REVISION +echo ${2:-$(git tag -l --points-at HEAD --sort -version:refname | head -1)} > TAG +echo ${3:-$(git rev-parse --abbrev-ref HEAD)} > BRANCH echo 'Compiling tar.gz' tar \ --exclude='*.swp' \ From 788b993079a59e35128bdc992b4c4218142b2533 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 7 Oct 2024 09:48:10 +0100 Subject: [PATCH 123/141] build: only run version check when PR is not draft --- .github/workflows/check_release_version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check_release_version.yml b/.github/workflows/check_release_version.yml index 83fc603b7..d85e1525f 100644 --- a/.github/workflows/check_release_version.yml +++ b/.github/workflows/check_release_version.yml @@ -16,6 +16,8 @@ on: jobs: check: runs-on: ubuntu-latest + # only run when PR is not draft + if: ${{ !github.event.pull_request.draft }} steps: - uses: actions/checkout@v4 From 8c0eee8127dc72e2931c8c2b3a2b63009f77be4a Mon Sep 17 00:00:00 2001 From: sabrine33 Date: Mon, 7 Oct 2024 16:49:57 +0100 Subject: [PATCH 124/141] DPL-918: default total cell count to LRC PBMC Defrost Pools to 500000 total cells/ml --- config/purposes/scrna_core_cdna_prep.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/purposes/scrna_core_cdna_prep.yml b/config/purposes/scrna_core_cdna_prep.yml index 6ad949b2a..69b6ba70f 100644 --- a/config/purposes/scrna_core_cdna_prep.yml +++ b/config/purposes/scrna_core_cdna_prep.yml @@ -49,6 +49,11 @@ LRC PBMC Pools: viability: units: '%' default_threshold: 65 + total_cell_count: + name: Total cell count + units: 'cells/ml' + default_threshold: 500000 + decimal_places: 0 :presenter_class: name: Presenters::DonorPoolingPlatePresenter args: From 82fea7e6feafc78ece515ef9eb46d165c4f4918e Mon Sep 17 00:00:00 2001 From: Ben Topping Date: Tue, 8 Oct 2024 08:43:20 +0100 Subject: [PATCH 125/141] feat(scrna): pbmc bank driver file tweaks --- app/views/exports/pbmc_bank_tubes_content_report.csv.erb | 2 +- config/purposes/scrna_core_cell_extraction.yml | 6 +++--- .../pbmc_bank_tubes_content_report.csv.erb_spec.rb | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 96969e020..9cebb17cd 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -68,7 +68,7 @@ child_tube_v2.barcode, # FluidX barcode child_tube_v2.created_at, # Extraction and freeze date destination, # Sequencing or contingency - source_well.latest_live_cell_count&.value, # Cell count + source_well.latest_total_cell_count&.value, # Total Cell Count source_well.latest_cell_viability&.value, # Viability volume, # Volume source_well.aliquots.first.study.name, # Study name diff --git a/config/purposes/scrna_core_cell_extraction.yml b/config/purposes/scrna_core_cell_extraction.yml index 112f7cc0e..120e7db61 100644 --- a/config/purposes/scrna_core_cell_extraction.yml +++ b/config/purposes/scrna_core_cell_extraction.yml @@ -81,10 +81,10 @@ LRC PBMC Bank: viability: units: '%' default_threshold: 50 - live_cell_count: - name: Live cell count + total_cell_count: + name: Total cell count units: 'cells/ml' - default_threshold: 400000 + default_threshold: 650000 decimal_places: 0 # FluidX tube for freezing and output of cell banking protocol LRC Bank Seq: diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index 60240d5a4..ccef5e72b 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -42,9 +42,9 @@ let(:src_aliquot3_s2) { create(:v2_aliquot, sample: sample2, study: study) } # qc results - let(:live_cell_count_qc) { create(:qc_result, key: 'live_cell_count', value: '20000', units: 'cells/ml') } + let(:total_cell_count_qc) { create(:qc_result, key: 'total_cell_count', value: '20000', units: 'cells/ml') } let(:viability_qc) { create(:qc_result, key: 'viability', value: '75', units: '%') } - let(:qc_results) { [live_cell_count_qc, viability_qc] } + let(:qc_results) { [total_cell_count_qc, viability_qc] } # source wells let(:source_well_attributes) do @@ -247,8 +247,8 @@ context 'when some data is missing' do # qc results, no viability_qc - let(:live_cell_count_qc) { create(:qc_result, key: 'live_cell_count', value: nil, units: 'cells/ml') } - let(:qc_results) { [live_cell_count_qc] } + let(:total_cell_count_qc) { create(:qc_result, key: 'total_cell_count', value: nil, units: 'cells/ml') } + let(:qc_results) { [total_cell_count_qc] } # expected file content let(:expected_content) do From 72d2011b4021bdefe58962ced758e09e6077565c Mon Sep 17 00:00:00 2001 From: Ben Topping Date: Tue, 8 Oct 2024 09:05:23 +0100 Subject: [PATCH 126/141] feat(scrna): update decimal place values for pbmc pools driver files --- .../exports/hamilton_gem_x_5p_chip_loading.csv.erb | 6 +++--- .../hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb | 2 +- .../hamilton_gem_x_5p_chip_loading.csv.erb_spec.rb | 12 ++++++------ ...n_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb b/app/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb index 92fa28913..b432a7670 100644 --- a/app/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb +++ b/app/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb @@ -45,9 +45,9 @@ src_location, @plate.labware_barcode.human, mapping[dest_well.location], - '%0.2f' % source_well_volume, - '%0.2f' % sample_volume, - '%0.2f' % pbs_volume + '%0.1f' % source_well_volume, + '%0.1f' % sample_volume, + '%0.1f' % pbs_volume ] end %> diff --git a/app/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb b/app/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb index 2c099d73e..375cfa9be 100644 --- a/app/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb +++ b/app/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb @@ -31,7 +31,7 @@ @plate.labware_barcode.human, well.location, well.name, - '%0.2f' % source_well_volume + '%0.1f' % source_well_volume ] rows_array << row end diff --git a/spec/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb_spec.rb b/spec/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb_spec.rb index d55abded2..e171ff9d4 100644 --- a/spec/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_gem_x_5p_chip_loading.csv.erb_spec.rb @@ -54,9 +54,9 @@ source_well_a1.location, dest_plate.barcode.human, mapping[dest_well_a1.location], - '13.81', - '37.50', - '0.00' + '13.8', + '37.5', + '0.0' ] end @@ -67,9 +67,9 @@ source_well_b1.location, dest_plate.barcode.human, mapping[dest_well_a2.location], - '109.05', - '37.50', - '0.00' + '109.0', + '37.5', + '0.0' ] end diff --git a/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb b/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb index ec8bb3fd4..db3f8cb3c 100644 --- a/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb +++ b/spec/views/exports/hamilton_lrc_pbmc_pools_to_cellaca_count.csv.erb_spec.rb @@ -65,7 +65,7 @@ well.location, well.name, format( - '%0.2f', + '%0.1f', ((well.aliquots.size * required_number_of_cells * wastage_factor) / desired_chip_loading_concentration) ) ] From 927e721610ae15d8970e86dee39a861fef9ee275 Mon Sep 17 00:00:00 2001 From: Ben Topping Date: Tue, 8 Oct 2024 12:58:37 +0100 Subject: [PATCH 127/141] feat(scrna): rename cell count header in pbmc bank tubes content report --- .../exports/pbmc_bank_tubes_content_report.csv.erb | 2 +- .../pbmc_bank_tubes_content_report.csv.erb_spec.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb index 9cebb17cd..a63003273 100644 --- a/app/views/exports/pbmc_bank_tubes_content_report.csv.erb +++ b/app/views/exports/pbmc_bank_tubes_content_report.csv.erb @@ -10,7 +10,7 @@ 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', - 'Cell count (cells/ml)', + 'Total cell count (cells/ml)', 'Viability (%)', 'Volume (µl)', 'Study name', diff --git a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb index ccef5e72b..c3b3e6d7e 100644 --- a/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb +++ b/spec/views/exports/pbmc_bank_tubes_content_report.csv.erb_spec.rb @@ -200,7 +200,7 @@ 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', - 'Cell count (cells/ml)', + 'Total cell count (cells/ml)', 'Viability (%)', 'Volume (µl)', 'Study name', @@ -262,7 +262,7 @@ 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', - 'Cell count (cells/ml)', + 'Total cell count (cells/ml)', 'Viability (%)', 'Volume (µl)', 'Study name', @@ -302,7 +302,7 @@ 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', - 'Cell count (cells/ml)', + 'Total cell count (cells/ml)', 'Viability (%)', 'Volume (µl)', 'Study name', @@ -395,7 +395,7 @@ 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', - 'Cell count (cells/ml)', + 'Total cell count (cells/ml)', 'Viability (%)', 'Volume (µl)', 'Study name', @@ -490,7 +490,7 @@ 'FluidX barcode', 'Extraction and freeze date', 'Sequencing or contingency', - 'Cell count (cells/ml)', + 'Total cell count (cells/ml)', 'Viability (%)', 'Volume (µl)', 'Study name', From 18b17c512303f370cd08f04187ff038b58f3cbae Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Tue, 8 Oct 2024 13:53:41 +0100 Subject: [PATCH 128/141] Linting! --- app/controllers/health_controller.rb | 3 +-- app/controllers/search_controller.rb | 3 +-- app/controllers/tubes/validate_paired_tubes_controller.rb | 3 +-- app/models/robots/bed/invalid.rb | 3 +-- spec/factories/strategies/api_strategy.rb | 3 +-- spec/factories/well_factories.rb | 2 +- 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 1298857fc..02b1ee3cf 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -2,6 +2,5 @@ # Controller to display a page stating that Limber is up, as a health check endpoint class HealthController < ApplicationController - def show - end + def show; end end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index e3ecce169..f2d5e3345 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -7,8 +7,7 @@ class InputError < StandardError before_action :check_for_login!, only: [:my_plates] # rubocop:todo Rails/LexicallyScopedActionFilter - def new - end + def new; end def ongoing_plates # rubocop:todo Metrics/AbcSize plate_search = api.search.find(Settings.searches.fetch('Find plates')) diff --git a/app/controllers/tubes/validate_paired_tubes_controller.rb b/app/controllers/tubes/validate_paired_tubes_controller.rb index db1c8980f..ca929c7cd 100644 --- a/app/controllers/tubes/validate_paired_tubes_controller.rb +++ b/app/controllers/tubes/validate_paired_tubes_controller.rb @@ -5,6 +5,5 @@ class Tubes::ValidatePairedTubesController < ApplicationController before_action :check_for_current_user! - def index - end + def index; end end diff --git a/app/models/robots/bed/invalid.rb b/app/models/robots/bed/invalid.rb index d881210d2..f707b1606 100644 --- a/app/models/robots/bed/invalid.rb +++ b/app/models/robots/bed/invalid.rb @@ -7,8 +7,7 @@ def initialize(barcode) @barcode = barcode end - def load(_plate_barcodes) - end + def load(_plate_barcodes); end def plate nil diff --git a/spec/factories/strategies/api_strategy.rb b/spec/factories/strategies/api_strategy.rb index 79432b1d6..588c984fb 100644 --- a/spec/factories/strategies/api_strategy.rb +++ b/spec/factories/strategies/api_strategy.rb @@ -11,8 +11,7 @@ def initialize delegate :association, to: :@strategy - def result(evaluation) - end + def result(evaluation); end end FactoryBot.register_strategy(:api_object, ApiStrategy) diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index a910cc2b1..445f10d60 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -61,7 +61,7 @@ aliquots do # Conditional to avoid generating requests when not required if aliquot_count.positive? - create_list(aliquot_factory, aliquot_count, outer_request: outer_request, study: study, project: project) + create_list(aliquot_factory, aliquot_count, outer_request:, study:, project:) else [] end From a346ded06cf908f080a558296198358771d8d986 Mon Sep 17 00:00:00 2001 From: yoldas Date: Wed, 9 Oct 2024 00:11:42 +0100 Subject: [PATCH 129/141] Allow creating Deam plate from the parent Denat plate in pending state --- config/purposes/lcm_triomics.wip.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/purposes/lcm_triomics.wip.yml b/config/purposes/lcm_triomics.wip.yml index 289e8a979..14a059f9b 100644 --- a/config/purposes/lcm_triomics.wip.yml +++ b/config/purposes/lcm_triomics.wip.yml @@ -47,6 +47,7 @@ LCMT EM NaOH Denat: :stock_plate: false :cherrypickable_target: false :input_plate: false + :presenter_class: Presenters::PermissivePresenter :size: 96 LCMT EM APOBEC Deam: :asset_type: plate From 687d4596c78c96e6f7b4f85089bf513b2299af07 Mon Sep 17 00:00:00 2001 From: yoldas Date: Wed, 9 Oct 2024 00:13:26 +0100 Subject: [PATCH 130/141] Enable Bravo LCMT EM TET2 Stop to Denat and Deam Setup --- config/robots.rb | 89 ++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index 26fea19d3..f0d619afd 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3728,11 +3728,12 @@ } ) - # LCM Triomics EMSeq Bravo BenchCel bed verification + # LCM Triomics WGS and EMSeq bed verification # Verify initial setup custom_robot( 'bravo-verify-initial-setup', name: 'Bravo Verify Initial Setup', + require_robot: false, beds: { bed(4).barcode => { purpose: 'LCMT Lysate', @@ -3772,12 +3773,12 @@ } ) - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT DNA Frag Verification custom_robot( 'bravo-lcmt-dna-frag-verification', name: 'Bravo LCMT DNA Frag Verification', - verify_robot: false, + require_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT DNA Frag', @@ -3788,12 +3789,12 @@ } ) - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT DNA End Prep Verification custom_robot( 'bravo-lcmt-dna-end-prep-verification', name: 'Bravo LCMT DNA End Prep Verification', - verify_robot: false, + require_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT DNA End Prep', @@ -3804,12 +3805,12 @@ } ) - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT DNA Adp Lig to LCMT DNA Lib PCR custom_robot( 'bravo-lcmt-dna-adp-lig-to-lcmt-dna-lib-pcr', name: 'Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR', - verify_robot: false, + require_robot: false, beds: { bed(6).barcode => { purpose: 'LCMT DNA Adp Lig', @@ -3826,12 +3827,12 @@ } ) - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT EM TET2 Ox Verification custom_robot( 'bravo-lcmt-em-tet2-ox-verification', name: 'Bravo LCMT EM TET2 Ox Verification', - verify_robot: false, + require_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Ox', @@ -3842,41 +3843,39 @@ } ) - # XXX: The following suggest that we need to create Denat and Deam plates - # beforehand. Are we supposed to create them in pending state as well? - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT EM TET2 Stop to Denat and Deam Setup - # custom_robot( - # 'bravo-lcmt-em-tet2-stop-to-denat-and-deam-setup', - # name: 'Bravo LCMT EM TET2 Stop to Denat and Deam Setup', - # verify_robot: true, - # beds: { - # bed(4).barcode => { - # purpose: 'LCMT EM TET2 Stop', - # states: ['passed'], - # label: 'Bed 4' - # }, - # car('3,3').barcode => { - # purpose: 'LCMT EM NaOH Denat', - # states: ['pending'], - # label: 'Carousel 4,4', - # parent: bed(4).barcode - # }, - # car('4,3').barcode => { - # purpose: 'LCMT EM APOBEC Deam', - # states: ['pending'], - # label: 'Carousel 3,4', - # parent: bed(4).barcode - # } - # } - # ) - - # LCM Triomics EMSeq Bravo bed verification + custom_robot( + 'bravo-lcmt-em-tet2-stop-to-denat-and-deam-setup', + name: 'Bravo LCMT EM TET2 Stop to Denat and Deam Setup', + require_robot: false, + beds: { + bed(4).barcode => { + purpose: 'LCMT EM TET2 Stop', + states: ['passed'], + label: 'Bed 4' + }, + car('3,3').barcode => { + purpose: 'LCMT EM NaOH Denat', + states: ['pending'], + label: 'Carousel 3,3', + parent: bed(4).barcode + }, + car('3,4').barcode => { + purpose: 'LCMT EM APOBEC Deam', + states: ['pending'], + label: 'Carousel 3,4', + parent: car('3,3').barcode + } + } + ) + + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT EM NaOH Denat Verification custom_robot( 'bravo-lcmt-em-naoh-denat-verification', name: 'Bravo LCMT EM NaOH Denat Verification', - verify_robot: false, + require_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT EM NaOH Denat', @@ -3887,12 +3886,12 @@ } ) - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR custom_robot( 'bravo-lcmt-em-apobec-deam-to-lcmt-em-lib-pcr', name: 'Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR', - verify_robot: false, + require_robot: false, beds: { bed(5).barcode => { purpose: 'LCMT EM APOBEC Deam', @@ -3909,12 +3908,12 @@ } ) - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP custom_robot( 'hamilton-lcmt-dna-lib-pcr-to-lcmt-dna-pcr-xp', name: 'Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP', - verify_robot: false, + require_robot: false, beds: { bed(7).barcode => { purpose: 'LCMT DNA Lib PCR', @@ -3943,12 +3942,12 @@ } ) - # LCM Triomics EMSeq Bravo bed verification + # LCM Triomics WGS and EMSeq bed verification # Hamilton LCMT EM Lib PCR => LCMT EM PCR XP custom_robot( 'hamilton-lcmt-em-lib-pcr-to-lcmt-em-pcr-xp', name: 'Hamilton LCMT EM Lib PCR => LCMT EM PCR XP', - verify_robot: false, + require_robot: false, beds: { bed(7).barcode => { purpose: 'LCMT EM Lib PCR', From 670553fac8ea920236dc9496553c4c19f499065d Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Wed, 9 Oct 2024 08:34:40 +0100 Subject: [PATCH 131/141] Linting (again)! --- app/controllers/health_controller.rb | 3 ++- app/controllers/search_controller.rb | 3 ++- app/controllers/tubes/validate_paired_tubes_controller.rb | 3 ++- app/models/robots/bed/invalid.rb | 3 ++- spec/factories/strategies/api_strategy.rb | 3 ++- spec/factories/well_factories.rb | 6 +----- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 02b1ee3cf..1298857fc 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -2,5 +2,6 @@ # Controller to display a page stating that Limber is up, as a health check endpoint class HealthController < ApplicationController - def show; end + def show + end end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index f2d5e3345..e3ecce169 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -7,7 +7,8 @@ class InputError < StandardError before_action :check_for_login!, only: [:my_plates] # rubocop:todo Rails/LexicallyScopedActionFilter - def new; end + def new + end def ongoing_plates # rubocop:todo Metrics/AbcSize plate_search = api.search.find(Settings.searches.fetch('Find plates')) diff --git a/app/controllers/tubes/validate_paired_tubes_controller.rb b/app/controllers/tubes/validate_paired_tubes_controller.rb index ca929c7cd..db1c8980f 100644 --- a/app/controllers/tubes/validate_paired_tubes_controller.rb +++ b/app/controllers/tubes/validate_paired_tubes_controller.rb @@ -5,5 +5,6 @@ class Tubes::ValidatePairedTubesController < ApplicationController before_action :check_for_current_user! - def index; end + def index + end end diff --git a/app/models/robots/bed/invalid.rb b/app/models/robots/bed/invalid.rb index f707b1606..d881210d2 100644 --- a/app/models/robots/bed/invalid.rb +++ b/app/models/robots/bed/invalid.rb @@ -7,7 +7,8 @@ def initialize(barcode) @barcode = barcode end - def load(_plate_barcodes); end + def load(_plate_barcodes) + end def plate nil diff --git a/spec/factories/strategies/api_strategy.rb b/spec/factories/strategies/api_strategy.rb index 588c984fb..79432b1d6 100644 --- a/spec/factories/strategies/api_strategy.rb +++ b/spec/factories/strategies/api_strategy.rb @@ -11,7 +11,8 @@ def initialize delegate :association, to: :@strategy - def result(evaluation); end + def result(evaluation) + end end FactoryBot.register_strategy(:api_object, ApiStrategy) diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 445f10d60..3e5dba5d9 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -60,11 +60,7 @@ aliquot_factory { :v2_aliquot } aliquots do # Conditional to avoid generating requests when not required - if aliquot_count.positive? - create_list(aliquot_factory, aliquot_count, outer_request:, study:, project:) - else - [] - end + aliquot_count.positive? ? create_list(aliquot_factory, aliquot_count, outer_request:, study:, project:) : [] end # The factory to use for outer requests From 544651c5fa420d52f6859ae24cece20609ca85be Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 10 Oct 2024 02:53:43 +0100 Subject: [PATCH 132/141] Add Adp Lig, Stop, and Deam bed verifications --- config/robots.rb | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/config/robots.rb b/config/robots.rb index f0d619afd..13aee3903 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3827,6 +3827,22 @@ } ) + # LCM Triomics WGS and EMSeq bed verification + # Bravo LCMT DNA Adp Lig Verification + custom_robot( + 'bravo-lcmt-dna-adp-lig-verification', + name: 'Bravo LCMT DNA Adp Lig Verification', + require_robot: false, + beds: { + bed(5).barcode => { + purpose: 'LCMT DNA Adp Lig', + states: ['pending'], + label: 'Bed 5', + target_state: 'passed' + } + } + ) + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT EM TET2 Ox Verification custom_robot( @@ -3843,6 +3859,22 @@ } ) + # LCM Triomics WGS and EMSeq bed verification + # Bravo LCMT EM TET2 Stop Verification + custom_robot( + 'bravo-lcmt-em-tet2-stop-verification', + name: 'Bravo LCMT EM TET2 Stop Verification', + require_robot: false, + beds: { + bed(5).barcode => { + purpose: 'LCMT EM TET2 Stop', + states: ['pending'], + label: 'Bed 5', + target_state: 'passed' + } + } + ) + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT EM TET2 Stop to Denat and Deam Setup custom_robot( @@ -3886,6 +3918,22 @@ } ) + # LCM Triomics WGS and EMSeq bed verification + # Bravo LCMT EM APOBEC Deam Verification + custom_robot( + 'bravo-lcmt-em-apobec-deam-verification', + name: 'Bravo LCMT EM APOBEC Deam Verification', + require_robot: false, + beds: { + bed(5).barcode => { + purpose: 'LCMT EM APOBEC Deam', + states: ['pending'], + label: 'Bed 5', + target_state: 'passed' + } + } + ) + # LCM Triomics WGS and EMSeq bed verification # Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR custom_robot( From 1737f0b873a0feafb88e9db861a06db11daa7b1b Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 10 Oct 2024 02:55:30 +0100 Subject: [PATCH 133/141] Require robot in LCM Triomics bed verifications --- config/robots.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index 13aee3903..17af14016 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3733,7 +3733,7 @@ custom_robot( 'bravo-verify-initial-setup', name: 'Bravo Verify Initial Setup', - require_robot: false, + require_robot: true, beds: { bed(4).barcode => { purpose: 'LCMT Lysate', @@ -3778,7 +3778,7 @@ custom_robot( 'bravo-lcmt-dna-frag-verification', name: 'Bravo LCMT DNA Frag Verification', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT DNA Frag', @@ -3794,7 +3794,7 @@ custom_robot( 'bravo-lcmt-dna-end-prep-verification', name: 'Bravo LCMT DNA End Prep Verification', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT DNA End Prep', @@ -3810,7 +3810,7 @@ custom_robot( 'bravo-lcmt-dna-adp-lig-to-lcmt-dna-lib-pcr', name: 'Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR', - require_robot: false, + require_robot: true, beds: { bed(6).barcode => { purpose: 'LCMT DNA Adp Lig', @@ -3832,7 +3832,7 @@ custom_robot( 'bravo-lcmt-dna-adp-lig-verification', name: 'Bravo LCMT DNA Adp Lig Verification', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT DNA Adp Lig', @@ -3848,7 +3848,7 @@ custom_robot( 'bravo-lcmt-em-tet2-ox-verification', name: 'Bravo LCMT EM TET2 Ox Verification', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Ox', @@ -3864,7 +3864,7 @@ custom_robot( 'bravo-lcmt-em-tet2-stop-verification', name: 'Bravo LCMT EM TET2 Stop Verification', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Stop', @@ -3880,7 +3880,7 @@ custom_robot( 'bravo-lcmt-em-tet2-stop-to-denat-and-deam-setup', name: 'Bravo LCMT EM TET2 Stop to Denat and Deam Setup', - require_robot: false, + require_robot: true, beds: { bed(4).barcode => { purpose: 'LCMT EM TET2 Stop', @@ -3907,7 +3907,7 @@ custom_robot( 'bravo-lcmt-em-naoh-denat-verification', name: 'Bravo LCMT EM NaOH Denat Verification', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM NaOH Denat', @@ -3923,7 +3923,7 @@ custom_robot( 'bravo-lcmt-em-apobec-deam-verification', name: 'Bravo LCMT EM APOBEC Deam Verification', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM APOBEC Deam', @@ -3939,7 +3939,7 @@ custom_robot( 'bravo-lcmt-em-apobec-deam-to-lcmt-em-lib-pcr', name: 'Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR', - require_robot: false, + require_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM APOBEC Deam', @@ -3961,7 +3961,7 @@ custom_robot( 'hamilton-lcmt-dna-lib-pcr-to-lcmt-dna-pcr-xp', name: 'Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP', - require_robot: false, + require_robot: true, beds: { bed(7).barcode => { purpose: 'LCMT DNA Lib PCR', @@ -3995,7 +3995,7 @@ custom_robot( 'hamilton-lcmt-em-lib-pcr-to-lcmt-em-pcr-xp', name: 'Hamilton LCMT EM Lib PCR => LCMT EM PCR XP', - require_robot: false, + require_robot: true, beds: { bed(7).barcode => { purpose: 'LCMT EM Lib PCR', From fde4c92227e83936ac76e8f3f428ec3ec4b100b7 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 10 Oct 2024 03:03:27 +0100 Subject: [PATCH 134/141] Set target state to started after setup verifications --- config/robots.rb | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/config/robots.rb b/config/robots.rb index 17af14016..1fc1d248f 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3744,31 +3744,36 @@ purpose: 'LCMT DNA Frag', states: ['pending'], label: 'Carousel 1,4', - parent: bed(4).barcode + parent: bed(4).barcode, + target_state: 'started' }, car('2,4').barcode => { purpose: 'LCMT DNA End Prep', states: ['pending'], label: 'Carousel 2,4', - parent: car('1,4').barcode + parent: car('1,4').barcode, + target_state: 'started' }, car('3,5').barcode => { purpose: 'LCMT DNA Adp Lig', states: ['pending'], label: 'Carousel 3,5', - parent: car('2,4').barcode + parent: car('2,4').barcode, + target_state: 'started' }, car('4,4').barcode => { purpose: 'LCMT EM TET2 Ox', states: ['pending'], label: 'Carousel 4,4', - parent: car('3,5').barcode + parent: car('3,5').barcode, + target_state: 'started' }, car('4,3').barcode => { purpose: 'LCMT EM TET2 Stop', states: ['pending'], label: 'Carousel 4,3', - parent: car('4,4').barcode + parent: car('4,4').barcode, + target_state: 'started' } } ) @@ -3782,7 +3787,7 @@ beds: { bed(5).barcode => { purpose: 'LCMT DNA Frag', - states: ['pending'], + states: ['started'], label: 'Bed 5', target_state: 'passed' } @@ -3798,7 +3803,7 @@ beds: { bed(5).barcode => { purpose: 'LCMT DNA End Prep', - states: ['pending'], + states: ['started'], label: 'Bed 5', target_state: 'passed' } @@ -3836,7 +3841,7 @@ beds: { bed(5).barcode => { purpose: 'LCMT DNA Adp Lig', - states: ['pending'], + states: ['started'], label: 'Bed 5', target_state: 'passed' } @@ -3852,7 +3857,7 @@ beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Ox', - states: ['pending'], + states: ['started'], label: 'Bed 5', target_state: 'passed' } @@ -3868,7 +3873,7 @@ beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Stop', - states: ['pending'], + states: ['started'], label: 'Bed 5', target_state: 'passed' } @@ -3891,13 +3896,15 @@ purpose: 'LCMT EM NaOH Denat', states: ['pending'], label: 'Carousel 3,3', - parent: bed(4).barcode + parent: bed(4).barcode, + target_state: 'started' }, car('3,4').barcode => { purpose: 'LCMT EM APOBEC Deam', states: ['pending'], label: 'Carousel 3,4', - parent: car('3,3').barcode + parent: car('3,3').barcode, + target_state: 'started' } } ) @@ -3911,7 +3918,7 @@ beds: { bed(5).barcode => { purpose: 'LCMT EM NaOH Denat', - states: ['pending'], + states: ['started'], label: 'Bed 5', target_state: 'passed' } @@ -3927,7 +3934,7 @@ beds: { bed(5).barcode => { purpose: 'LCMT EM APOBEC Deam', - states: ['pending'], + states: ['started'], label: 'Bed 5', target_state: 'passed' } From 3a4e0e127c0b2faad681674bfd0678daedbe5fb2 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 10 Oct 2024 03:59:03 +0100 Subject: [PATCH 135/141] Verify robot in bed verifications when applicable --- config/robots.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/config/robots.rb b/config/robots.rb index 1fc1d248f..6e545c73b 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3733,7 +3733,8 @@ custom_robot( 'bravo-verify-initial-setup', name: 'Bravo Verify Initial Setup', - require_robot: true, + require_robot: true, # Robot barcode must be scanned in. + verify_robot: false, # First robot step; no previous robot. beds: { bed(4).barcode => { purpose: 'LCMT Lysate', @@ -3784,6 +3785,7 @@ 'bravo-lcmt-dna-frag-verification', name: 'Bravo LCMT DNA Frag Verification', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT DNA Frag', @@ -3800,6 +3802,7 @@ 'bravo-lcmt-dna-end-prep-verification', name: 'Bravo LCMT DNA End Prep Verification', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT DNA End Prep', @@ -3816,6 +3819,7 @@ 'bravo-lcmt-dna-adp-lig-to-lcmt-dna-lib-pcr', name: 'Bravo LCMT DNA Adp Lig => LCMT DNA Lib PCR', require_robot: true, + verify_robot: true, beds: { bed(6).barcode => { purpose: 'LCMT DNA Adp Lig', @@ -3838,6 +3842,7 @@ 'bravo-lcmt-dna-adp-lig-verification', name: 'Bravo LCMT DNA Adp Lig Verification', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT DNA Adp Lig', @@ -3854,6 +3859,7 @@ 'bravo-lcmt-em-tet2-ox-verification', name: 'Bravo LCMT EM TET2 Ox Verification', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Ox', @@ -3870,6 +3876,7 @@ 'bravo-lcmt-em-tet2-stop-verification', name: 'Bravo LCMT EM TET2 Stop Verification', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM TET2 Stop', @@ -3886,6 +3893,7 @@ 'bravo-lcmt-em-tet2-stop-to-denat-and-deam-setup', name: 'Bravo LCMT EM TET2 Stop to Denat and Deam Setup', require_robot: true, + verify_robot: true, beds: { bed(4).barcode => { purpose: 'LCMT EM TET2 Stop', @@ -3915,6 +3923,7 @@ 'bravo-lcmt-em-naoh-denat-verification', name: 'Bravo LCMT EM NaOH Denat Verification', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM NaOH Denat', @@ -3931,6 +3940,7 @@ 'bravo-lcmt-em-apobec-deam-verification', name: 'Bravo LCMT EM APOBEC Deam Verification', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM APOBEC Deam', @@ -3947,6 +3957,7 @@ 'bravo-lcmt-em-apobec-deam-to-lcmt-em-lib-pcr', name: 'Bravo LCMT EM APOBEC Deam => LCMT EM Lib PCR', require_robot: true, + verify_robot: true, beds: { bed(5).barcode => { purpose: 'LCMT EM APOBEC Deam', @@ -3969,6 +3980,7 @@ 'hamilton-lcmt-dna-lib-pcr-to-lcmt-dna-pcr-xp', name: 'Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP', require_robot: true, + verify_robot: true, beds: { bed(7).barcode => { purpose: 'LCMT DNA Lib PCR', @@ -4003,6 +4015,7 @@ 'hamilton-lcmt-em-lib-pcr-to-lcmt-em-pcr-xp', name: 'Hamilton LCMT EM Lib PCR => LCMT EM PCR XP', require_robot: true, + verify_robot: false, # Previous robot is Bravo. beds: { bed(7).barcode => { purpose: 'LCMT EM Lib PCR', From 7e2eb1ba801343e8361edae4eb237c1379ea8193 Mon Sep 17 00:00:00 2001 From: yoldas Date: Thu, 10 Oct 2024 04:35:24 +0100 Subject: [PATCH 136/141] Not verify robot in hamilton robot step because the previous robot is bravo --- config/robots.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/robots.rb b/config/robots.rb index 6e545c73b..bd18dc2bf 100644 --- a/config/robots.rb +++ b/config/robots.rb @@ -3980,7 +3980,7 @@ 'hamilton-lcmt-dna-lib-pcr-to-lcmt-dna-pcr-xp', name: 'Hamilton LCMT DNA Lib PCR => LCMT DNA PCR XP', require_robot: true, - verify_robot: true, + verify_robot: false, # Previous robot is Bravo. beds: { bed(7).barcode => { purpose: 'LCMT DNA Lib PCR', From 7764fd3a74b5ac8c3ad8e8ff6074d78f5c007572 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 10 Oct 2024 10:57:16 +0100 Subject: [PATCH 137/141] fix: reword libraries warning messages for improved clarity --- app/models/validators/failed_validator.rb | 4 ++-- app/models/validators/in_progress_validator.rb | 4 ++-- spec/features/viewing_a_minimal_plate_spec.rb | 6 +++--- spec/features/viewing_a_plate_spec.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/validators/failed_validator.rb b/app/models/validators/failed_validator.rb index de774df76..9d963438a 100644 --- a/app/models/validators/failed_validator.rb +++ b/app/models/validators/failed_validator.rb @@ -11,8 +11,8 @@ def validate(presenter) affected_range = WellHelpers.formatted_range(problem_wells, presenter.size) presenter.errors.add( - :libraries, - "on this plate have already been failed (#{affected_range}). You should not carry out further work. " \ + :submission, + "on this plate has already been failed (#{affected_range}). You should not carry out further work. " \ 'Any further work conducted from this plate will run into issues at the end of the pipeline.' ) end diff --git a/app/models/validators/in_progress_validator.rb b/app/models/validators/in_progress_validator.rb index d9b00921e..f7dfc3b85 100644 --- a/app/models/validators/in_progress_validator.rb +++ b/app/models/validators/in_progress_validator.rb @@ -7,8 +7,8 @@ def validate(presenter) return true unless presenter.labware.any_complete_requests? presenter.errors.add( - :libraries, - 'on this plate have already been completed. ' \ + :submission, + '(active) is not present for this labware. ' \ 'Any further work conducted from this plate may run into issues at the end of the pipeline.' ) end diff --git a/spec/features/viewing_a_minimal_plate_spec.rb b/spec/features/viewing_a_minimal_plate_spec.rb index 383a86d8b..74d660178 100644 --- a/spec/features/viewing_a_minimal_plate_spec.rb +++ b/spec/features/viewing_a_minimal_plate_spec.rb @@ -64,7 +64,7 @@ scenario 'there is a warning' do fill_in_swipecard_and_barcode user_swipecard, plate_barcode expect(find('.asset-warnings')).to have_content( - 'Libraries on this plate have already been completed. ' \ + 'Submission (active) is not present for this labware. ' \ 'Any further work conducted from this plate may run into issues at the end of the pipeline.' ) end @@ -76,7 +76,7 @@ scenario 'there is a warning' do fill_in_swipecard_and_barcode user_swipecard, plate_barcode expect(find('.asset-warnings')).to have_content( - 'Libraries on this plate have already been failed (A1-E1). You should not carry out further work. ' \ + 'Submission on this plate has already been failed (A1-E1). You should not carry out further work. ' \ 'Any further work conducted from this plate will run into issues at the end of the pipeline.' ) end @@ -105,7 +105,7 @@ scenario 'there is a warning' do fill_in_swipecard_and_barcode user_swipecard, plate_barcode expect(find('.asset-warnings')).to have_content( - 'Libraries on this plate have already been completed. ' \ + 'Submission (active) is not present for this labware. ' \ 'Any further work conducted from this plate may run into issues at the end of the pipeline.' ) end diff --git a/spec/features/viewing_a_plate_spec.rb b/spec/features/viewing_a_plate_spec.rb index 253f643a1..222c4ef11 100644 --- a/spec/features/viewing_a_plate_spec.rb +++ b/spec/features/viewing_a_plate_spec.rb @@ -109,7 +109,7 @@ scenario 'there is a warning' do fill_in_swipecard_and_barcode user_swipecard, plate_barcode expect(find('.asset-warnings')).to have_content( - 'Libraries on this plate have already been completed. ' \ + 'Submission (active) is not present for this labware. ' \ 'Any further work conducted from this plate may run into issues at the end of the pipeline.' ) end From 8c87d22334e8cb10003525fc1899e4163e064cff Mon Sep 17 00:00:00 2001 From: sabrine33 Date: Thu, 10 Oct 2024 14:01:36 +0100 Subject: [PATCH 138/141] LRC PBMC Defrost PBS total cell count/ml defaults to 500000 LRC PBMC Bank defaults to 85% --- config/purposes/scrna_core_cdna_prep.yml | 2 +- config/purposes/scrna_core_cell_extraction.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/purposes/scrna_core_cdna_prep.yml b/config/purposes/scrna_core_cdna_prep.yml index 69b6ba70f..ec992d5e0 100644 --- a/config/purposes/scrna_core_cdna_prep.yml +++ b/config/purposes/scrna_core_cdna_prep.yml @@ -36,7 +36,7 @@ LRC PBMC Defrost PBS: total_cell_count: name: Total cell count units: 'cells/ml' - default_threshold: 400000 + default_threshold: 500000 decimal_places: 0 :stock_plate: false :input_plate: false diff --git a/config/purposes/scrna_core_cell_extraction.yml b/config/purposes/scrna_core_cell_extraction.yml index 120e7db61..8039dd289 100644 --- a/config/purposes/scrna_core_cell_extraction.yml +++ b/config/purposes/scrna_core_cell_extraction.yml @@ -80,7 +80,7 @@ LRC PBMC Bank: :qc_thresholds: viability: units: '%' - default_threshold: 50 + default_threshold: 85 total_cell_count: name: Total cell count units: 'cells/ml' From 11736d4ae1c2902f9d11595bd09960e5592a2194 Mon Sep 17 00:00:00 2001 From: sabrine33 <139128026+sabrine33@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:53:01 +0100 Subject: [PATCH 139/141] release 3.61.1 --- .release-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.release-version b/.release-version index 1620db590..6621aa3bc 100644 --- a/.release-version +++ b/.release-version @@ -1 +1 @@ -3.61.0 +3.61.1 From 6e7b21160cd8e21eec3ab9f44b30ec633c3db0b9 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 14 Oct 2024 16:02:51 +0100 Subject: [PATCH 140/141] Remove unwanted hash value references --- app/models/labware_creators/custom_tagged_plate.rb | 2 +- spec/features/creating_plate_with_bait_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 3b631e2a1..97509a064 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -105,7 +105,7 @@ def tag_layout_attributes def create_labware! create_plate! do |plate_uuid| Sequencescape::Api::V2::TagLayout.create!( - tag_layout_attributes.merge(plate_uuid: plate_uuid, user_uuid: user_uuid) + tag_layout_attributes.merge(plate_uuid:, user_uuid:) ) end end diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index 9186a7f24..2c5c015e3 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -48,7 +48,7 @@ # These stubs are required to render plate_creation baiting page expect_api_v2_posts( 'BaitLibraryLayout', - [{ plate_uuid: plate_uuid, user_uuid: user_uuid }], + [{ plate_uuid:, user_uuid: }], [[bait_library_layout]], method: :preview ) From 9157bfefac93666f5bffd23708c3159154f9d2ad Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 14 Oct 2024 16:04:48 +0100 Subject: [PATCH 141/141] Apply Prettier --- app/models/labware_creators/custom_tagged_plate.rb | 4 +--- spec/features/creating_plate_with_bait_spec.rb | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 97509a064..d7d161c94 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -104,9 +104,7 @@ def tag_layout_attributes def create_labware! create_plate! do |plate_uuid| - Sequencescape::Api::V2::TagLayout.create!( - tag_layout_attributes.merge(plate_uuid:, user_uuid:) - ) + Sequencescape::Api::V2::TagLayout.create!(tag_layout_attributes.merge(plate_uuid:, user_uuid:)) end end end diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index 2c5c015e3..99aa56faa 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -46,12 +46,7 @@ # end of stubs for plate show page # These stubs are required to render plate_creation baiting page - expect_api_v2_posts( - 'BaitLibraryLayout', - [{ plate_uuid:, user_uuid: }], - [[bait_library_layout]], - method: :preview - ) + expect_api_v2_posts('BaitLibraryLayout', [{ plate_uuid:, user_uuid: }], [[bait_library_layout]], method: :preview) # end of stubs for plate_creation baiting page