Skip to content

Commit 7dcf726

Browse files
leefaisonrbess
andauthored
Create progress status display for sub guide card rake task (#116)
* Create progress status display for sub guide card rake task Co-authored-by: Bess Sadler <[email protected]> * rubocop exception --------- Co-authored-by: Bess Sadler <[email protected]>
1 parent 5349812 commit 7dcf726

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.rubocop.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ Layout/LineLength:
99

1010
Metrics/BlockLength:
1111
Exclude:
12-
- "spec/**/*"
12+
- "spec/**/*"
13+
14+
Rails/Output:
15+
Enabled: false

app/services/sub_guide_loading_service.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ def initialize(csv_location: nil)
1313
def import
1414
sub_guide_card_data = CSV.parse(File.read(csv_location), headers: true, liberal_parsing: true)
1515
sub_guide_card_data.each do |entry|
16+
print '#'
17+
$stdout.flush
1618
import_sub_guide_card(entry)
1719
end
20+
puts 'task completed!'
1821
end
1922

2023
private

spec/services/sub_guide_loading_service_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
sgls.import
1818
expect(SubGuideCard.count).to eq 6
1919
end
20+
21+
it 'displays progress status during import' do
22+
expect { sgls.import }.to output("######task completed!\n").to_stdout
23+
end
2024
end

0 commit comments

Comments
 (0)