fix all news

This commit is contained in:
2022-12-12 18:17:48 +02:00
parent 0d1adab3f3
commit 7966437324
10 changed files with 47 additions and 33 deletions

View File

@ -23,6 +23,11 @@ module Merged
expect(first.next_card.index).to be 2
end
it "create a new" do
card = Card.new_card("card_normal_square" , 1 , 1)
expect(card.index).to eq 1
end
it "deletes " do
card = Card.find(20)
expect(card).not_to be nil

View File

@ -21,32 +21,33 @@ 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
it "creates simple section" do
s = index.new_section("section_spacer")
expect(s).not_to be nil
expect(s.template).to eq "section_spacer"
end
it "creates section with right index" do
should_be = index.sections.last.index + 1
s = index.new_section("section_spacer")
expect(s.index).to eq should_be
end
it "creates page" do
name = "randomname"
page = Page.new_page( name)

View File

@ -50,6 +50,13 @@ module Merged
expect(s.template).to eq "section_spacer"
end
it "creates card with right index" do
s = Section.find_by_template("section_cards")
length = s.cards.length
c = s.new_card
expect(c.index).to eq length + 1
end
it "deletes " do
last_id = last.id
last.delete