Skip to content

Commit

Permalink
Create progress status display for sub guide card rake task (#116)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
leefaisonr and bess authored Aug 2, 2023
1 parent 5349812 commit 7dcf726
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ Layout/LineLength:

Metrics/BlockLength:
Exclude:
- "spec/**/*"
- "spec/**/*"

Rails/Output:
Enabled: false
3 changes: 3 additions & 0 deletions app/services/sub_guide_loading_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ def initialize(csv_location: nil)
def import
sub_guide_card_data = CSV.parse(File.read(csv_location), headers: true, liberal_parsing: true)
sub_guide_card_data.each do |entry|
print '#'
$stdout.flush
import_sub_guide_card(entry)
end
puts 'task completed!'
end

private
Expand Down
4 changes: 4 additions & 0 deletions spec/services/sub_guide_loading_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
sgls.import
expect(SubGuideCard.count).to eq 6
end

it 'displays progress status during import' do
expect { sgls.import }.to output("######task completed!\n").to_stdout
end
end

0 comments on commit 7dcf726

Please sign in to comment.