nicely working delete tests

This commit is contained in:
Torsten 2022-12-11 22:50:50 +02:00
parent 350ebb33ef
commit 60b270786c
6 changed files with 46 additions and 490 deletions

View File

@ -7,7 +7,7 @@ module Merged
include Optioned
fields :name , :page_id , :index , :cards , :options
fields :name , :page_id , :index , :options
fields :template , :card_template , :id , :text , :header, :image
def cards

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,5 @@
require 'capybara/rspec'
require "git"
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
@ -40,7 +41,10 @@ RSpec.configure do |config|
end
config.before(:each) do |example|
# reset data so we can delete/edit/add at will. aka DatabaseCleaner
module Merged
git = Git.open(Engine.root)
git.checkout_file("HEAD" , "test/dummy/merged")
[Page, Section, Card].each { |m| m.reload(true) }
end
end

View File

@ -138,49 +138,6 @@
- :template: form_section
:id: 9
:card_template: form_field
:cards:
- id: 1
header: Name
text: ''
options:
compulsory: 'yes'
form_type: text
updated_at: *1
section_id: 9
index: 1
- id: 2
header: Email
text: ''
options:
compulsory: 'yes'
form_type: email
updated_at: *1
section_id: 9
index: 2
- id: 3
header: Phone
text: ''
options:
compulsory: 'yes'
form_type: phone
updated_at: *1
section_id: 9
index: 3
- id: 4
header: Interest
text: ''
updated_at: *1
section_id: 9
index: 4
- id: 5
header: Message
text: ''
options:
compulsory: 'no'
form_type: message
updated_at: *1
section_id: 9
index: 5
:header: Participate
:text: "If you want to use any of the facilities or machines listed above, you need
to be a member of the coop. This requires a small fee and a certain amount of
@ -226,59 +183,6 @@
:image:
:id: 11
:card_template: card_full_image
:cards:
- header: Standard
text: This is the standard two patient room. They are mostly towards the south,
so may have great, or too much light, depending on how you see it. The size
is about 3x5, cost 120e.
image: standard
id: 6
options:
background: solid_blue
color: white
align: left
updated_at: *2
section_id: 11
index: 1
- header: Large
text: The old four patient rooms are basically twice the size as the small. They
are large enough to be shared. The size is about 30m2 and the cost 240e. Like
the small rooms these are south facing, very light.
image: large
id: 7
options:
background: solid_blue
color: white
align: left
updated_at: *2
section_id: 11
index: 2
- id: 8
header: Non standard
text: There are smaller, rooms, and some connected rooms. If your needs are small,
of you rather have 2 small rooms than one, talk to us. These are mostly old
admin rooms facing north, starting at 100e.
image: non_standard_room
options:
background: solid_blue
color: white
align: left
updated_at: *2
section_id: 11
index: 3
- id: 9
header: Wet spaces
text: If your work requires you to get dirty, we have different size wet rooms.
Here we are talking about spaces with floor drains that are tiled all around.
There are about 2-3 per floor, in different sizes, from 12 to 25m2.
options:
background: solid_blue
color: white
align: left
image: wet_space_room
updated_at: *2
section_id: 11
index: 4
:options:
button_link: ''
button_text: ''
@ -290,41 +194,6 @@
- :template: section_cards
:id: 12
:card_template: card_normal_square
:cards:
- id: 10
header: Common spaces
text: Each floor has it's own large common space. Also, Hub Feenix offers great
public spaces, terraces, a cafe, co-working and maker spaces.
image: common_spaces
options:
background: solid_red
align: center
updated_at: *2
section_id: 12
index: 1
- id: 11
header: En suite and fold out
text: "Some rooms have attached (or shared) bathrooms. Also, you have the option
of a fold-out bed to stay overnight.\r\nIt's like a home away from home."
image: en_suite_studio
options:
background: solid_blue
align: center
updated_at: *2
section_id: 12
index: 2
- id: 12
header: Shared kitchen, own sink
text: Each floor has it's own common kitchen. This is especially useful if you
take the option of a fold out bed to stay overnight. And almost all spaces have
a sink in the room, so you can clean things or make a tea in peace.
options:
background: solid_indigo
align: center
image: studio_kitchen
updated_at: *2
section_id: 12
index: 3
:header: Included
:text: The studios offer a unique environment both in terms of fellow beings, and
the spaces around.
@ -339,49 +208,6 @@
- :template: form_section
:id: 13
:card_template: form_field
:cards:
- id: 13
header: Name
text: ''
options:
compulsory: 'yes'
form_type: text
updated_at: *2
section_id: 13
index: 1
- id: 14
header: Email
text: ''
options:
compulsory: 'yes'
form_type: email
updated_at: *2
section_id: 13
index: 2
- id: 15
header: Phone
text: ''
options:
compulsory: 'no'
form_type: phone
updated_at: *2
section_id: 13
index: 3
- id: 16
header: Space requirements
text: ''
updated_at: *2
section_id: 13
index: 4
- id: 17
header: Message
text: ''
options:
compulsory: 'no'
form_type: message
updated_at: *2
section_id: 13
index: 5
:options:
ok_message: Ok
handler: FormHandler
@ -417,93 +243,6 @@
- :template: section_cards
:id: 15
:card_template: card_normal_square
:cards:
- id: 18
header: The Hall
text: Our beautiful hall, one of the largest in the area, is 8 x 20m and can accommodate
50 yogi, 80 dancers, or 120 listeners. We have a professional audio system for
dancing and of course chairs for meetings.
options:
background: none
align: center
subheader: 40 - 120
color: none
image: the_hall
updated_at: *3
section_id: 15
index: 1
- id: 19
header: Mandala room
text: The Mandala room, in the fifth floor, is a slightly asymmetrical 100m2.
With it's great views and light atmosphere it is especially suited for yoga
(30) and mediation (60). It also has a private eating area and staircase.
options:
background: none
align: center
subheader: 30 - 60
color: none
image: mandala_room
updated_at: *3
section_id: 15
index: 2
- id: 20
header: Sky Conference
text: "Also in the fifth floor with great views is the sky conference room. It
sits 35 people as shown and up to 80 in a theatre arrangement.\r\n\r\nThere
is a smaller semi attached break room and two more break-out rooms next to it.\r\n\r\nGreat
for meetings of any sort."
image: sky_conference
options:
background: light_orange
align: center
color: none
subheader: 35 - 80
updated_at: *3
section_id: 15
index: 3
- id: 21
header: Lootus room
text: "Downstairs, next to the café, the spacious lotus room is especially good
for day events. 20 Yogi or dancers fit easily into the 70m2 and for group work
30 is still good.\r\n\r\nCan be rented on hourly basis."
image: lotus_room
options:
background: light_orange
align: center
color: none
subheader: 15 - 30
updated_at: *3
section_id: 15
index: 4
- id: 22
header: Earth room
text: "On the ground floor (with a clay plastered wall)\r\n\r\nthe earth room
is great for groups wanting privacy. It's 50m2, with accommodation on the same
floor, sits up to 25 people either with or without tables."
image: earth_room
options:
background: none
align: center
color: none
subheader: 10 - 25
updated_at: *3
section_id: 15
index: 5
- id: 23
header: The Loft
text: "For smaller groups, we have many 40 m2 rooms, depending on the needs. Dancing,
yoga, theatre practise, group work.\r\nThe room shown is especially cosy (a
roof extension), and accommodates about 12 yogi or 15 sitting. Also available
per hour."
image: loft_room
options:
background: light_grey
align: center
color: none
subheader: 8-15
updated_at: *3
section_id: 15
index: 6
:header: Spaces
:text: For different size groups and needs
:options:
@ -624,58 +363,6 @@
- :template: form_section
:id: 24
:card_template: form_field
:cards:
- id: 24
header: Name
text: ''
updated_at: *3
section_id: 24
index: 1
- id: 25
header: Email
text: ''
options:
compulsory: 'yes'
form_type: email
updated_at: *3
section_id: 24
index: 2
- id: 26
header: Phone
text: ''
updated_at: *3
section_id: 24
index: 3
- id: 27
header: Event Type
text: ''
updated_at: *3
section_id: 24
index: 4
- id: 28
header: Number of participants
text: ''
updated_at: *3
section_id: 24
index: 5
- id: 29
header: Date
text: ''
options:
compulsory: 'yes'
form_type: date
updated_at: *3
section_id: 24
index: 6
- id: 30
header: Message
text: ''
options:
compulsory: 'no'
form_type: message
updated_at: *3
section_id: 24
index: 7
:header: Start planning now
:text: We create custom packages for your specific needs. Just tell us what you
are planning, for how many people and we will create a solution for you.
@ -709,50 +396,6 @@
- :template: section_cards
:id: 26
:card_template: card_gap_square
:cards:
- id: 31
header: Floating desk
text: "Come anytime and work on any of the available desk. We have 30 places in
two rooms, with mixed normal desks, high desks, standing places and bean bags.\r\nAlso
possible per day, 10e."
options:
background: solid_blue
color: white
order: left
align: center
subheader: 120 / month
image: floating_office_small
updated_at: *4
section_id: 26
index: 1
- id: 32
header: Single office
text: If you need the quiet, or require safe shelf space, rent your own private
office. We provide desk, chair, shelves and wifi
options:
background: solid_blue
color: white
order: right
align: center
subheader: 200 / month
image: single_office_small
updated_at: *4
section_id: 26
index: 2
- id: 33
header: Double office
text: "Double offices are slightly larger than the singles, but also come furnished
to your needs.\r\n"
options:
background: solid_blue
color: white
order: left
align: center
subheader: 350 / month
image: double_office_small
updated_at: *4
section_id: 26
index: 3
:header: Relax, connect and work
:text: "Relaxed work environments have been shown to be more productive. Working
in different places and positions, even a bit of background noise, helps creativity
@ -767,52 +410,6 @@
- :template: form_section
:id: 27
:card_template: form_field
:cards:
- id: 34
header: Name
text: ''
options:
compulsory: 'yes'
form_type: text
updated_at: *4
section_id: 27
index: 1
- id: 35
header: Email
text: ''
options:
compulsory: 'yes'
form_type: email
updated_at: *4
section_id: 27
index: 2
- id: 36
header: Phone
text: ''
options:
compulsory: 'no'
form_type: phone
updated_at: *4
section_id: 27
index: 3
- id: 37
header: Space
text: ''
options:
compulsory: 'yes'
form_type: text
updated_at: *4
section_id: 27
index: 4
- id: 38
header: Message
text: ''
options:
compulsory: 'no'
form_type: message
updated_at: *4
section_id: 27
index: 5
:header: Join the working tribe
:text: ''
:options:
@ -998,45 +595,6 @@
- :template: section_cards
:id: 39
:card_template: card_normal_square
:cards:
- id: 39
header: Cafe
text: Our cafe serves vegan and vegetarian light food and great tea and coffee.
image: service_cafe
options:
background: light_gray
color: solid_blue
align: center
subheader: ''
updated_at: *6
section_id: 39
index: 1
- id: 40
header: Treatments
text: In our healery you can get professional help from osteopathy, shiatsu, acupuncture
and more.
image: service_treatments
options:
background: light_gray
color: solid_blue
align: center
subheader: ''
updated_at: *6
section_id: 39
index: 2
- id: 41
header: Boutique and Gallery
text: In our Boutique, you can find organic cosmetics, buy our great hub feenix
teas to take home and find inspirational art from our artists.
image: service_boutique
options:
background: light_gray
color: solid_blue
align: center
subheader: ''
updated_at: *6
section_id: 39
index: 3
:header: Services
:text: ''
:options:
@ -1049,52 +607,6 @@
- :template: form_section
:id: 40
:card_template: form_field
:cards:
- id: 42
header: Name
text: ''
options:
compulsory: 'yes'
form_type: text
updated_at: *6
section_id: 40
index: 1
- id: 43
header: Email
text: ''
options:
compulsory: 'yes'
form_type: text
updated_at: *6
section_id: 40
index: 2
- id: 44
header: Phone
text: ''
options:
compulsory: 'no'
form_type: text
updated_at: *6
section_id: 40
index: 3
- id: 45
header: Subject
text: TEXT
options:
compulsory: 'yes'
form_type: text
updated_at: *6
section_id: 40
index: 4
- id: 46
header: Message
text: ''
options:
compulsory: 'yes'
form_type: message
updated_at: *6
section_id: 40
index: 5
:header: Contact
:text: "Högbenintie 30, 10350 Meltola, Raasepori\r\n\r\ninfo@hubfeenix.fi\r\n\r\n0505337881\r\n"
:options: