Skip to content

Commit 153d663

Browse files
committed
Test package_model hooks in bits_expiration test
* expire_packages! is now implicitly called by hooks
1 parent 72d6a9d commit 153d663

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

spec/unit/lib/cloud_controller/bits_expiration_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,12 @@ module VCAP::CloudController
161161

162162
it 'expires old packages' do
163163
expiration = BitsExpiration.new
164-
expiration.expire_packages!(app)
165164
num_of_packages_to_keep = expiration.packages_storage_count + 1
166165
remaining_packages = PackageModel.where(state: PackageModel::READY_STATE, app_guid: app.guid)
167166
expect(remaining_packages.count).to eq(num_of_packages_to_keep)
168167
end
169168

170169
it 'does not delete the package related to the current droplet' do
171-
BitsExpiration.new.expire_packages!(app)
172170
app.reload && @current_package.reload
173171
expect(@current_package.state).to eq(PackageModel::READY_STATE)
174172
end
@@ -181,7 +179,7 @@ module VCAP::CloudController
181179
end
182180

183181
it 'enqueues a job to delete the blob' do
184-
expect { BitsExpiration.new.expire_packages!(app) }.to change(Delayed::Job, :count).from(0).to(5)
182+
expect(Delayed::Job.count).to eq(5)
185183
expect(Delayed::Job).to(be_all { |j| j.handler.include?('DeleteExpiredPackageBlob') })
186184
end
187185
end

0 commit comments

Comments
 (0)