| Age | Commit message (Collapse) | Author |
|
Two real bugs surfaced by the full test suite, not by the new tests
written for this feature -- both were latent the moment lock_for_editing!
and save_draft! replaced find_or_create_draft, and only visible once an
existing test exercised the exact path each one lived in.
lock_for_editing! never stamped user/editor onto a draft that already
existed when the lock was acquired. find_or_create_draft used to do this
as part of acquiring the lock; splitting lock acquisition from draft
creation dropped it entirely, since it looked like draft-creation logic
rather than locking logic. Restored as an explicit step: claim authorship
only if none is set yet, editorship unconditionally, matching the old
behavior exactly.
save_draft!'s "no draft yet" branch set user/editor before calling
clone_attributes_from, whose first line is an unconditional self.reload
-- silently discarding both, since neither had been persisted yet.
clone_attributes_from also always copies published_at from its source
without the ||= guard used for template_name, and the source here is
always the autosave, whose published_at is never anything but nil --
meaning every single promotion, not just the first, was quietly
resetting a published page's published_at, which publish_draft!'s own
||= Time.now would then treat as never-published and re-stamp. Fixed by
running clone_attributes_from first on both branches, then applying
user/editor/published_at afterward, exactly as the existing-draft branch
already happened to do by accident.
Four controller tests updated to insert a real put :update between
get :edit and assertions that used to be true immediately after
visiting edit -- deferred draft creation means edit alone no longer
produces one, which is the intended consequence of this whole
redesign, not something these tests were meant to catch.
|
|
Fallout from the earlier nodes#show heading change, which replaced the
Title row with an <h1> -- unrelated to the autosave work in the
preceding commits.
|
|
Route Save and autosave through the new Node methods
update now promotes the current autosave into the draft via
save_draft! rather than writing submitted params directly; autosave
gets its own PUT member route so PATCH update can mean "deliberate
save" specifically, matching every other custom action on this
resource. Both now require the lock to already be held rather than
acquiring it themselves, which is a deliberate narrowing: through the
real UI this is always true, since neither can fire before edit has
loaded. Two existing tests called update directly with no prior
edit, which the old code tolerated by acquiring the lock as a side
effect; updated to call edit first instead of loosening the
guarantee back open.
NodesController#edit itself is unchanged and still calls the old
find_or_create_draft, so drafts are still created eagerly on entering
edit for now -- switching that over is the next step, not this one.
|
|
|
|
test_can_remove_a_node_with_an_event previously just called node.destroy
and get :index with no assertions at all - would pass whether or not
occurrences were actually cleaned up, or even if index rendered
correctly afterward. Now confirms occurrences genuinely exist before
destroy (otherwise a passing post-destroy count of zero is meaningless -
indistinguishable from "nothing to cascade in the first place"), scopes
the count to this event specifically rather than a global Occurrence.count
that could coincidentally pass regardless of whether this cascade works,
and checks the trailing index request actually succeeds rather than just
not raising.
First real test of the occurrences.event_id FK constraint added earlier
this session, not just the application-level dependent: :destroy.
|
|
nodes#show's events table now renders unconditionally (previously
hidden entirely for a zero-event node) and gains an "add event" link.
The suggested tag_list is derived from the page's own category tags
via NodesHelper::DEFAULT_EVENT_TAG_BY_PAGE_TAG (erfa-detail/
chaostreff-detail -> open-day) rather than hardcoded, and degrades to
a blank field for any node whose tags don't match - deliberately
universal, not chapter-specific, since Updates have historically
carried event dates the same way.
events#new surfaces *why* the tag was pre-filled via flash.now (not
flash - this is a same-request render, not a redirect), using an
explicit auto_tag_source param passed alongside tag_list rather than
having the controller re-derive the reason from node_id.
No destroy link added to nodes#show's events list - deliberate, per
existing subnav-semantics convention (destructive actions live on the
resource's own views). Covered directly by test.
Adds real coverage for EventsController, previously 100% commented-out
scaffold, plus unit tests for the new tag-mapping helper and the
weekday-abbreviation helpers from the prior commit.
|
|
- Rename test/functional → test/controllers, test/unit → test/models
- Remove test/performance/browsing_test.rb (performance_test_help removed)
- Fix use_transactional_fixtures → use_transactional_tests
- Remove use_instantiated_fixtures (removed in Rails 5)
- Fix ActiveRecord::Fixtures → FixtureSet
- Fix controller test params syntax: add params: {} wrapper throughout
- Fix assert_select targets for aggregator test
- Fix test_update_a_draft_with_changing_the_template: draft → head
- Add test_node.reload after children.create! (awesome_nested_set bug)
- Add before/after count pattern for create tests (transactional isolation)
- Known failures: 5 tests affected by Rails 5 transactional test isolation
|