|
52 | 52 | describe '.compose' do |
53 | 53 | subject(:compose) { service.compose(%w[key1 key2 key3], 'dest_key') } |
54 | 54 |
|
55 | | - let!(:db_file1) { create(:active_storage_db_file, ref: 'key1', data: 'first file') } |
56 | | - let!(:db_file2) { create(:active_storage_db_file, ref: 'key2', data: 'second file') } |
57 | | - let!(:db_file3) { create(:active_storage_db_file, ref: 'key3', data: 'third file') } |
| 55 | + let!(:first_db_file) { create(:active_storage_db_file, ref: 'key1', data: 'first file') } |
| 56 | + let!(:second_db_file) { create(:active_storage_db_file, ref: 'key2', data: 'second file') } |
| 57 | + let!(:third_db_file) { create(:active_storage_db_file, ref: 'key3', data: 'third file') } |
58 | 58 |
|
59 | 59 | it 'composes the source files' do |
60 | | - expect { compose }.to change { ::ActiveStorageDB::File.where(ref: 'dest_key').count }.by(1) |
61 | | - expect(compose).to be_kind_of ::ActiveStorageDB::File |
62 | | - expect(compose.data).to eq [db_file1.data, db_file2.data, db_file3.data].join |
| 60 | + expect { compose }.to change { ActiveStorageDB::File.where(ref: 'dest_key').count }.by(1) |
| 61 | + expect(compose).to be_a ActiveStorageDB::File |
| 62 | + expect(compose.data).to eq [first_db_file.data, second_db_file.data, third_db_file.data].join |
63 | 63 | end |
64 | 64 | end |
65 | 65 | end |
|
70 | 70 | before { upload } |
71 | 71 |
|
72 | 72 | it 'deletes the file' do |
73 | | - expect { delete }.to change { ActiveStorageDB::File.count }.from(1).to(0) |
| 73 | + expect { delete }.to change(ActiveStorageDB::File, :count).from(1).to(0) |
74 | 74 | end |
75 | 75 | end |
76 | 76 |
|
|
80 | 80 | before { upload } |
81 | 81 |
|
82 | 82 | it 'deletes the files' do |
83 | | - expect { delete_prefixed }.to change { ActiveStorageDB::File.count }.from(1).to(0) |
| 83 | + expect { delete_prefixed }.to change(ActiveStorageDB::File, :count).from(1).to(0) |
84 | 84 | end |
85 | 85 | end |
86 | 86 |
|
|
154 | 154 |
|
155 | 155 | describe '.upload' do |
156 | 156 | it 'uploads the data' do |
157 | | - expect(upload).to be_kind_of ActiveStorageDB::File |
| 157 | + expect(upload).to be_a ActiveStorageDB::File |
158 | 158 | ensure |
159 | 159 | service.delete(key) |
160 | 160 | end |
|
163 | 163 | let(:upload) { service.upload(key, StringIO.new(fixture_data), checksum: checksum) } |
164 | 164 |
|
165 | 165 | it 'uploads the data' do |
166 | | - expect(upload).to be_kind_of ActiveStorageDB::File |
| 166 | + expect(upload).to be_a ActiveStorageDB::File |
167 | 167 | ensure |
168 | 168 | service.delete(key) |
169 | 169 | end |
|
0 commit comments