Add JSON support for pin/unpin on the card endpoints and add tests.
This commit is contained in:
@@ -17,6 +17,17 @@ class Cards::PinsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "create as JSON" do
|
||||
card = cards(:layout)
|
||||
|
||||
assert_not card.pinned_by?(users(:kevin))
|
||||
|
||||
post card_pin_path(card), as: :json
|
||||
|
||||
assert_response :no_content
|
||||
assert card.reload.pinned_by?(users(:kevin))
|
||||
end
|
||||
|
||||
test "destroy" do
|
||||
assert_changes -> { cards(:shipping).pinned_by?(users(:kevin)) }, from: true, to: false do
|
||||
perform_enqueued_jobs do
|
||||
@@ -28,4 +39,15 @@ class Cards::PinsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "destroy as JSON" do
|
||||
card = cards(:shipping)
|
||||
|
||||
assert card.pinned_by?(users(:kevin))
|
||||
|
||||
delete card_pin_path(card), as: :json
|
||||
|
||||
assert_response :no_content
|
||||
assert_not card.reload.pinned_by?(users(:kevin))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user