Skip to content

Commit 996efca

Browse files
authored
Merge pull request #1069 from sanger/sh/remove-spec-puts
Tidy rspec output
2 parents a933818 + 776f702 commit 996efca

File tree

2 files changed

+124
-27
lines changed

2 files changed

+124
-27
lines changed

spec/lib/tasks_spec.rb

Lines changed: 122 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,76 @@
1313

1414
describe 'create tags' do
1515
it 'creates all of the pacbio tag sets' do
16-
Rake::Task['tags:create:pacbio_all'].invoke
16+
expect { Rake::Task['tags:create:pacbio_all'].invoke }.to output(
17+
<<~HEREDOC
18+
-> Creating Sequel_16_barcodes_v3 tag set and tags
19+
-> Tag Set successfully created
20+
-> Sequel_16_barcodes_v3 tags successfully created
21+
-> Creating Sequel_48_Microbial_Barcoded_OHA_v1tag set and tags
22+
-> Tag Set successfully created
23+
-> Sequel_48_Microbial_Barcoded_OHA_v1 tags successfully created
24+
-> Creating TruSeq_CD_i7_i5_D0x_8mer tag set and tags
25+
-> Tag Set successfully created
26+
-> TruSeq_CD_i7_i5_D0x_8mer tags successfully created
27+
-> Creating Sequel_96_Barcoded_OHA_v1 tag set and tags
28+
-> Tag Set successfully created
29+
-> Sequel_96_Barcoded_OHA_v1 tags successfully created
30+
-> Creating Pacbio IsoSeq tag set and tags
31+
-> Tag Set successfully created
32+
-> IsoSeq_Primers_12_Barcodes_v1 created
33+
-> Creating Nextera UD tag set and tags
34+
-> Tag Set successfully created
35+
-> Nextera_UD_Index_PlateA tags successfully created
36+
-> Creating Pacbio_96_barcode_plate_v3 tag set and tags
37+
-> Tag Set successfully created
38+
-> Pacbio_96_barcode_plate_v3 tags successfully created
39+
HEREDOC
40+
).to_stdout
1741
expect(TagSet.count).to eq(7)
1842
end
1943

2044
it 'creates all of the ont tag sets' do
21-
Rake::Task['tags:create:ont_all'].invoke
45+
expect { Rake::Task['tags:create:ont_all'].invoke }.to output(
46+
<<~HEREDOC
47+
-> Creating SQK-NBD114.96 tag set and tags
48+
-> Tag Set successfully created
49+
-> SQK-NBD114.96 tags successfully created
50+
HEREDOC
51+
).to_stdout
2252
expect(TagSet.count).to eq(1)
2353
end
2454

2555
it 'creates all of the tag sets' do
2656
# We need to reenable all tag tasks because they have all already been invoked by this point
2757
Rake.application.in_namespace(:tags) { |namespace| namespace.tasks.each(&:reenable) }
28-
Rake::Task['tags:create:traction_all'].invoke
58+
expect { Rake::Task['tags:create:traction_all'].invoke }.to output(
59+
<<~HEREDOC
60+
-> Creating Sequel_16_barcodes_v3 tag set and tags
61+
-> Tag Set successfully created
62+
-> Sequel_16_barcodes_v3 tags successfully created
63+
-> Creating Sequel_48_Microbial_Barcoded_OHA_v1tag set and tags
64+
-> Tag Set successfully created
65+
-> Sequel_48_Microbial_Barcoded_OHA_v1 tags successfully created
66+
-> Creating TruSeq_CD_i7_i5_D0x_8mer tag set and tags
67+
-> Tag Set successfully created
68+
-> TruSeq_CD_i7_i5_D0x_8mer tags successfully created
69+
-> Creating Sequel_96_Barcoded_OHA_v1 tag set and tags
70+
-> Tag Set successfully created
71+
-> Sequel_96_Barcoded_OHA_v1 tags successfully created
72+
-> Creating Pacbio IsoSeq tag set and tags
73+
-> Tag Set successfully created
74+
-> IsoSeq_Primers_12_Barcodes_v1 created
75+
-> Creating Nextera UD tag set and tags
76+
-> Tag Set successfully created
77+
-> Nextera_UD_Index_PlateA tags successfully created
78+
-> Creating Pacbio_96_barcode_plate_v3 tag set and tags
79+
-> Tag Set successfully created
80+
-> Pacbio_96_barcode_plate_v3 tags successfully created
81+
-> Creating SQK-NBD114.96 tag set and tags
82+
-> Tag Set successfully created
83+
-> SQK-NBD114.96 tags successfully created
84+
HEREDOC
85+
).to_stdout
2986
expect(TagSet.count).to eq(8)
3087
end
3188
end
@@ -40,19 +97,21 @@
4097
Rake::Task['tags:create:pacbio_isoseq'].reenable
4198
expect { Rake::Task['pacbio_data:create'].invoke }
4299
.to output(
43-
"-> Creating Sequel_16_barcodes_v3 tag set and tags\n" \
44-
"-> Tag Set successfully created\n" \
45-
"-> Sequel_16_barcodes_v3 tags successfully created\n" \
46-
"-> Creating Pacbio IsoSeq tag set and tags\n" \
47-
"-> Tag Set successfully created\n" \
48-
"-> IsoSeq_Primers_12_Barcodes_v1 created\n" \
49-
"-> Creating pacbio plates and tubes...\b\b\b\n" \
50-
"-> Creating pacbio libraries...\b\b\b\n" \
51-
"-> Finding Pacbio SMRT Link versions...\b\b\b\n" \
52-
"-> Creating pacbio runs:\n " \
53-
"-> Creating runs for v11...\b\b\b\n " \
54-
"-> Creating runs for v12_revio...\b\b\b\n" \
55-
"-> Pacbio runs successfully created\n"
100+
<<~HEREDOC
101+
-> Creating Sequel_16_barcodes_v3 tag set and tags
102+
-> Tag Set successfully created
103+
-> Sequel_16_barcodes_v3 tags successfully created
104+
-> Creating Pacbio IsoSeq tag set and tags
105+
-> Tag Set successfully created
106+
-> IsoSeq_Primers_12_Barcodes_v1 created
107+
-> Creating pacbio plates and tubes...\b\b\b#{' '}
108+
-> Creating pacbio libraries...\b\b\b#{' '}
109+
-> Finding Pacbio SMRT Link versions...\b\b\b#{' '}
110+
-> Creating pacbio runs:
111+
-> Creating runs for v11...\b\b\b#{' '}
112+
-> Creating runs for v12_revio...\b\b\b#{' '}
113+
-> Pacbio runs successfully created
114+
HEREDOC
56115
).to_stdout
57116
expect(Pacbio::Run.count)
58117
.to eq(12)
@@ -61,26 +120,42 @@
61120

62121
describe 'library_types:create' do
63122
it 'creates the library types' do
64-
expect { Rake::Task['library_types:create'].invoke }.to change(LibraryType, :count).by(15).and output("-> Library types updated\n").to_stdout
123+
expect { Rake::Task['library_types:create'].invoke }.to change(LibraryType, :count).by(15).and output(
124+
<<~HEREDOC
125+
-> Library types updated
126+
HEREDOC
127+
).to_stdout
65128
end
66129
end
67130

68131
describe 'data_types:create' do
69132
it 'creates the data types' do
70-
expect { Rake::Task['data_types:create'].invoke }.to change(DataType, :count).by(2).and output("-> Data types updated\n").to_stdout
133+
expect { Rake::Task['data_types:create'].invoke }.to change(DataType, :count).by(2).and output(
134+
<<~HEREDOC
135+
-> Data types updated
136+
HEREDOC
137+
).to_stdout
71138
end
72139
end
73140

74141
describe 'ont_instruments:create' do
75142
it 'creates the correct instrument data' do
76143
Rake::Task['ont_instruments:create'].reenable
77-
expect { Rake::Task['ont_instruments:create'].invoke }.to change(Ont::Instrument, :count).and output("-> ONT Instruments successfully created\n").to_stdout
144+
expect { Rake::Task['ont_instruments:create'].invoke }.to change(Ont::Instrument, :count).and output(
145+
<<~HEREDOC
146+
-> ONT Instruments successfully created
147+
HEREDOC
148+
).to_stdout
78149
end
79150
end
80151

81152
describe 'min_know_versions:create' do
82153
it 'creates the correct MinKnowVersion data' do
83-
expect { Rake::Task['min_know_versions:create'].invoke }.to change(Ont::MinKnowVersion, :count).and output("-> ONT MinKnow versions successfully created\n").to_stdout
154+
expect { Rake::Task['min_know_versions:create'].invoke }.to change(Ont::MinKnowVersion, :count).and output(
155+
<<~HEREDOC
156+
-> ONT MinKnow versions successfully created
157+
HEREDOC
158+
).to_stdout
84159
end
85160
end
86161

@@ -150,7 +225,11 @@
150225

151226
it 'modifies the data correctly' do
152227
expect(Pacbio::Well.count).to eq(6) # create(:pacbio_plate) also creates a well
153-
Rake::Task['pacbio_wells:migrate_smrt_link_options'].invoke
228+
expect { Rake::Task['pacbio_wells:migrate_smrt_link_options'].invoke }.to output(
229+
<<~HEREDOC
230+
-> 6 instances of pacbio well updated.
231+
HEREDOC
232+
).to_stdout
154233
[well1, well2, well3, well4, well5].collect(&:reload)
155234
expect(well1.generate_hifi).to eq('In SMRT Link')
156235
expect(well2.generate_hifi).to eq('On Instrument')
@@ -162,7 +241,11 @@
162241

163242
describe 'qc_assay_types:create' do
164243
it 'creates the correct number of qc assay types' do
165-
expect { Rake::Task['qc_assay_types:create'].invoke }.to change(QcAssayType, :count).by(10).and output("-> QC Assay Types updated\n").to_stdout
244+
expect { Rake::Task['qc_assay_types:create'].invoke }.to change(QcAssayType, :count).by(10).and output(
245+
<<~HEREDOC
246+
-> QC Assay Types updated
247+
HEREDOC
248+
).to_stdout
166249
end
167250
end
168251

@@ -191,7 +274,11 @@
191274
# Reenabling the task makes it possible to invoke again.
192275
# Invoke the data migration task for smrt_link options.
193276
Rake::Task['pacbio_wells:migrate_smrt_link_options'].reenable
194-
Rake::Task['pacbio_wells:migrate_smrt_link_options'].invoke
277+
expect { Rake::Task['pacbio_wells:migrate_smrt_link_options'].invoke }.to output(
278+
<<~HEREDOC
279+
-> 2 instances of pacbio well updated.
280+
HEREDOC
281+
).to_stdout
195282

196283
# Reload the attributes of the record from the database.
197284
# We want to see what was saved by the task.
@@ -208,7 +295,13 @@
208295
describe 'migrate_pacbio_run_smrt_link_versions' do
209296
it 'creates smrt link version and options for v10' do
210297
Rake::Task['pacbio_runs:migrate_pacbio_run_smrt_link_versions'].reenable
211-
Rake::Task['pacbio_runs:migrate_pacbio_run_smrt_link_versions'].invoke
298+
expect do
299+
Rake::Task['pacbio_runs:migrate_pacbio_run_smrt_link_versions'].invoke
300+
end.to output(
301+
<<~HEREDOC
302+
-> Pacbio SMRT Link versions and options successfully created
303+
HEREDOC
304+
).to_stdout
212305

213306
version = Pacbio::SmrtLinkVersion.find_by(name: 'v10', default: true, active: true)
214307
expect(version).not_to be_nil
@@ -294,7 +387,11 @@
294387

295388
Rake::Task['smrt_link_versions:create'].reenable
296389
Rake::Task['pacbio_runs:migrate_pacbio_run_smrt_link_versions'].reenable
297-
Rake::Task['pacbio_runs:migrate_pacbio_run_smrt_link_versions'].invoke
390+
expect { Rake::Task['pacbio_runs:migrate_pacbio_run_smrt_link_versions'].invoke }.to output(
391+
<<~HEREDOC
392+
-> Pacbio SMRT Link versions and options successfully created
393+
HEREDOC
394+
).to_stdout
298395

299396
run10.reload
300397
run11.reload

spec/spec_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@
8888
# config.default_formatter = "doc"
8989
# end
9090
#
91-
# Print the 10 slowest examples and example groups at the
91+
# Print the 1 slowest examples and example groups at the
9292
# end of the spec run, to help surface which specs are running
9393
# particularly slow.
94-
config.profile_examples = 10
94+
config.profile_examples = 1
9595
#
9696
# # Run specs in random order to surface order dependencies. If you find an
9797
# # order dependency and want to debug it, you can fix the order by providing

0 commit comments

Comments
 (0)