-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove AMQP-base resource management
- Loading branch information
1 parent
26043b5
commit f4f2c38
Showing
1 changed file
with
11 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
require "spec_helper" | ||
|
||
describe CreateDestroyer do | ||
class FakeResource | ||
def self.model_name | ||
"" | ||
end | ||
end | ||
let(:device) { FactoryBot.create(:device) } | ||
let(:someone_else) { FactoryBot.create(:device) } | ||
let(:point) { FactoryBot.create(:generic_pointer, device: device) } | ||
|
||
it "destroys a fake resource" do | ||
Destroy = CreateDestroyer.run!(resource: FakeResource) | ||
Destroy.run!(resource: FakeResource.new) | ||
it "creates a destroyer" do | ||
Destroy = CreateDestroyer.run!(resource: GenericPointer) | ||
outcome = Destroy.run(generic_pointer: point, device: someone_else) | ||
expect(outcome.success?).to be(false) | ||
expect(outcome.errors.message_list).to include("You do not own that generic_pointer") | ||
expect(point.reload).to be | ||
Destroy.run!(generic_pointer: point, device: point.device) | ||
expect(GenericPointer.find_by(id: point.id)).to be(nil) | ||
end | ||
end |