Remove "save as draft"
Removes the creating status completely as well as the abandoned cards system. It will always resume drafts if they exist, for a given collection and user. https://app.box-car.com/5986089/cards/2489
This commit is contained in:
@@ -21,11 +21,12 @@ class Cards::PublishesControllerTest < ActionDispatch::IntegrationTest
|
||||
card.drafted!
|
||||
|
||||
assert_changes -> { card.reload.published? }, from: false, to: true do
|
||||
assert_difference -> { Card.creating.count }, +1 do
|
||||
assert_difference -> { Card.count }, +1 do
|
||||
post card_publish_path(card, creation_type: "add_another")
|
||||
end
|
||||
end
|
||||
|
||||
assert_redirected_to Card.creating.last
|
||||
assert Card.last.drafted?
|
||||
assert_redirected_to Card.last
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,11 +15,23 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "create" do
|
||||
test "create a new draft" do
|
||||
assert_difference -> { Card.count }, 1 do
|
||||
post collection_cards_path(collections(:writebook))
|
||||
end
|
||||
assert_redirected_to card_path(Card.last)
|
||||
|
||||
assert Card.last.drafted?
|
||||
assert_redirected_to Card.last
|
||||
end
|
||||
|
||||
test "create resumes existing draft if it exists" do
|
||||
draft = collections(:writebook).cards.create!(creator: users(:kevin), status: :drafted)
|
||||
|
||||
assert_no_difference -> { Card.count } do
|
||||
post collection_cards_path(collections(:writebook))
|
||||
end
|
||||
|
||||
assert_redirected_to draft
|
||||
end
|
||||
|
||||
test "show" do
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
require "test_helper"
|
||||
|
||||
class Cards::RecoversControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :jz
|
||||
end
|
||||
|
||||
test "create" do
|
||||
abandoned_card = collections(:writebook).cards.create! creator: users(:kevin)
|
||||
abandoned_card.update!(title: "An edited title")
|
||||
unsaved_card = collections(:writebook).cards.create! creator: users(:kevin)
|
||||
|
||||
post card_recover_path(unsaved_card)
|
||||
|
||||
assert_redirected_to abandoned_card
|
||||
assert_equal [ abandoned_card ], Card.creating
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user