nicely working delete tests
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
require 'rails_helper'
|
||||
require "git"
|
||||
|
||||
module Merged
|
||||
RSpec.describe Card, type: :model do
|
||||
@ -33,7 +34,6 @@ module Merged
|
||||
Card.find(20).destroy
|
||||
Card.reload
|
||||
expect{Card.find(20) }.to raise_error(ActiveHash::RecordNotFound)
|
||||
git = Git.open(Engine.root)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -21,5 +21,25 @@ module Merged
|
||||
expect(section.index).to be index + 1 # because we have human index
|
||||
end
|
||||
end
|
||||
|
||||
it "deletes " do
|
||||
id = index.id
|
||||
index.delete
|
||||
expect{Page.find(id) }.to raise_error(ActiveHash::RecordNotFound)
|
||||
end
|
||||
|
||||
it "destroys " do
|
||||
id = index.id
|
||||
index.destroy
|
||||
Section.reload
|
||||
expect{Page.find(id) }.to raise_error(ActiveHash::RecordNotFound)
|
||||
end
|
||||
|
||||
it "destroys sections" do
|
||||
id = index.sections.first.id
|
||||
index.destroy
|
||||
Section.reload
|
||||
expect{Page.find(id) }.to raise_error(ActiveHash::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -44,5 +44,25 @@ module Merged
|
||||
it "last has no next" do
|
||||
expect(last.next_section).to be nil
|
||||
end
|
||||
|
||||
it "deletes " do
|
||||
last_id = last.id
|
||||
last.delete
|
||||
expect{Section.find(last_id) }.to raise_error(ActiveHash::RecordNotFound)
|
||||
end
|
||||
|
||||
it "destroys " do
|
||||
last_id = last.id
|
||||
last.destroy
|
||||
Section.reload
|
||||
expect{Section.find(last_id) }.to raise_error(ActiveHash::RecordNotFound)
|
||||
end
|
||||
it "destroys cards" do
|
||||
card_id = last.cards.first.id
|
||||
last.destroy
|
||||
Section.reload
|
||||
expect{Card.find(card_id) }.to raise_error(ActiveHash::RecordNotFound)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user