fix indexing and ordering for section and card

This commit is contained in:
2022-12-11 14:03:21 +02:00
parent 829d653b44
commit 912400b852
13 changed files with 53 additions and 71 deletions

View File

@ -13,5 +13,14 @@ module Merged
it "has index" do
expect(first.index).to eq 1
end
it "first has no previous" do
expect(first.index).to be 1
expect(first.previous_card).to be nil
end
it "first has next" do
expect(first.next_card.index).to be 2
end
end
end

View File

@ -18,7 +18,7 @@ module Merged
end
it "has section indexes" do
index.sections.each_with_index do |section, index|
expect(section.index).to be index + 1
expect(section.index).to be index + 1 # because we have human index
end
end
end

View File

@ -1,4 +1,5 @@
require 'capybara/rspec'
# 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`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
@ -38,6 +39,12 @@ RSpec.configure do |config|
mocks.verify_partial_doubles = true
end
config.before(:each) do |example|
module Merged
[Page, Section, Card].each { |m| m.reload(true) }
end
end
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
# have no way to turn it off -- the option exists only for backwards
# compatibility in RSpec 3). It causes shared context metadata to be