show page for pages (a start)

This commit is contained in:
2022-12-16 16:50:56 +02:00
parent 54e8c287ca
commit 6dbddce173
11 changed files with 79 additions and 25 deletions

View File

@ -7,11 +7,17 @@ RSpec.feature "Pages", type: :feature do
expect(page).to have_title("Dummy")
expect(page).to have_text("Pages")
end
end
describe "index page" do
it "returns http success" do
it "has an index page" do
visit "/merged/pages"
click_on ("index")
end
it "edit page works " do
visit "/merged/pages"
within("#index") do
click_on ("Edit")
end
end
end
end

View File

@ -6,7 +6,7 @@ module Merged
let(:first) {Card.first}
it "has Card.all" do
expect(Card.all.length).to be 46
expect(Card.all.length).to be 20
end
it "has cards" do
expect(first.class).to be Card
@ -29,16 +29,16 @@ module Merged
end
it "deletes " do
card = Card.find(20)
expect(card).not_to be nil
card.delete
expect{Card.find(20) }.to raise_error(ActiveHash::RecordNotFound)
id = first.id
first.delete
expect{Card.find(id) }.to raise_error(ActiveHash::RecordNotFound)
end
it "destroys " do
Card.find(20).destroy
id = first.id
first.delete
Card.reload
expect{Card.find(20) }.to raise_error(ActiveHash::RecordNotFound)
expect{Card.find(id) }.to raise_error(ActiveHash::RecordNotFound)
end
end

View File

@ -5,7 +5,7 @@ module Merged
let(:index) {Page.find_by_name('index')}
it "has Pages.all" do
expect(Page.all.length).to be 6
expect(Page.all.length).to be 2
end
it "has index page" do
expect(index.class).to be Page
@ -53,5 +53,9 @@ module Merged
page = Page.new_page( name)
expect(page.name).to eq name
end
it "has type" do
expect(index.type).to eq "page"
end
end
end

View File

@ -2,12 +2,11 @@ require 'rails_helper'
module Merged
RSpec.describe Section, type: :model do
let(:first) {Section.find_by_id(1)}
let(:second) {Section.find_by_id(2)}
let(:first) {Section.first}
let(:last) {Section.last}
it "has Sections.all" do
expect(Section.all.length).to be 40
expect(Section.all.length).to be 14
end
it "has index page" do
expect(last.class).to be Section
@ -22,8 +21,8 @@ module Merged
expect(last.cards.class).to be ActiveHash::Relation
end
it "has options" do
expect(second.options.class).to be Hash
expect(second.options.length).to be 6
expect(last.options.class).to be Hash
expect(first.options.length).to be 4
end
it "has option_definitions" do
expect(last.option_definitions.class).to be Array