fixes from transition, tests pass, just because there are too little

This commit is contained in:
2022-12-11 12:20:53 +02:00
parent c615a77af3
commit 829d653b44
12 changed files with 54 additions and 32 deletions

View File

@ -11,7 +11,7 @@ module Merged
expect(first.class).to be Image
end
it "image has name" do
expect(first.name).to eq "large"
expect(first.name).to eq "3dprinter_wide"
end
end
end

View File

@ -16,5 +16,10 @@ module Merged
it "has section array" do
expect(index.sections.first.class).to be Section
end
it "has section indexes" do
index.sections.each_with_index do |section, index|
expect(section.index).to be index + 1
end
end
end
end

View File

@ -2,22 +2,47 @@ require 'rails_helper'
module Merged
RSpec.describe Section, type: :model do
let(:first) {Section.last}
let(:first) {Section.find_by_id(1)}
let(:second) {Section.find_by_id(2)}
let(:last) {Section.last}
it "has Sections.all" do
expect(Section.all.length).to be 40
end
it "has index page" do
expect(first.class).to be Section
expect(last.class).to be Section
end
it "has index" do
expect(first.index).to eq 10
expect(last.index).to eq 10
end
it "has cards" do
expect(first.cards.length).to eq 5
expect(last.cards.length).to eq 5
end
it "has cards array" do
expect(first.cards.class).to be ActiveHash::Relation
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
end
it "has option_definitions" do
expect(last.option_definitions.class).to be Array
expect(last.option_definitions.length).to be 4
expect(last.option_definitions.second.class).to be Option
expect(last.option_definitions.second.name).to eq "handler"
end
it "last has previous" do
expect(last.previous_section.index).to be 9
end
it "first has no previous" do
expect(first.index).to be 1
expect(first.previous_section).to be nil
end
it "first has next" do
expect(first.next_section.index).to be 2
end
it "last has no next" do
expect(last.next_section).to be nil
end
end
end