-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 💍 ExportToDistCsv::*.Service のテストを追加した(テストに合わせてリファクタも) (#70)
- Loading branch information
1 parent
45ea7bc
commit aaa9a3c
Showing
8 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'ExportToDistCsv::AlbumsService' do | ||
it 'エクスポータが正しく実行できること' do | ||
csv_filepath = 'tmp/dist_csv_albums.csv' | ||
|
||
ExportToDistCsv::AlbumsService.new.execute(csv_filepath) | ||
|
||
expect(File.exist?(csv_filepath)).to eq true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'ExportToDistCsv::ArtistsService' do | ||
it 'エクスポータが正しく実行できること' do | ||
csv_filepath = 'tmp/dist_csv_artists.csv' | ||
|
||
ExportToDistCsv::ArtistsService.new.execute(csv_filepath) | ||
|
||
expect(File.exist?(csv_filepath)).to eq true | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
spec/services/export_to_dist_csv/features_in_all_albums_service_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'ExportToDistCsv::FeaturesInAllAlbumsService' do | ||
it 'エクスポータが正しく実行できること' do | ||
csv_filepath = 'tmp/dist_csv_features_all.csv' | ||
|
||
ExportToDistCsv::FeaturesInAllAlbumsService.new.execute(csv_filepath) | ||
|
||
expect(File.exist?(csv_filepath)).to eq true | ||
end | ||
end |
26 changes: 26 additions & 0 deletions
26
spec/services/export_to_dist_csv/features_in_each_album_service_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'ExportToDistCsv::FeaturesInEachAlbumService' do | ||
it 'エクスポータが正しく実行できること' do | ||
exported_files_dir = 'tmp' | ||
|
||
# TODO: DRY じゃないので直したい | ||
album_name_to_exported_file_name = { | ||
'幻想水滸伝 ORIGINAL GAME SOUNDTRACK' => 'features_s1.csv', | ||
'幻想水滸伝II ORIGINAL GAME SOUNDTRACK Vol.1' => 'features_s2_1.csv', | ||
'幻想水滸伝II ORIGINAL GAME SOUNDTRACK Vol.2' => 'features_s2_2.csv', | ||
'幻想水滸伝III ORIGINAL SOUNDTRACK SELECTION' => 'features_s3.csv', | ||
'幻想水滸伝IV ORIGINAL SOUNDTRACK SELECTION' => 'features_s4.csv', | ||
'幻想水滸伝V ORIGINAL SOUNDTRACK SELECTION' => 'features_s5.csv', | ||
'幻想水滸伝ティアクライス ORIGINAL SOUNDTRACK' => 'features_tk.csv', | ||
'幻想水滸伝 紡がれし百年の時 オリジナルサウンドトラック' => 'features_tsumutoki.csv' | ||
} | ||
|
||
album_name_to_exported_file_name.each do |album_name, exported_file_name| | ||
service = ExportToDistCsv::FeaturesInEachAlbumService.new(album_name) | ||
service.execute(exported_files_dir) | ||
|
||
expect(File.exist?("#{exported_files_dir}/#{exported_file_name}")).to be_truthy | ||
end | ||
end | ||
end |