Add workflow column filtering to cards (#2787)
This commit is contained in:
@@ -15,6 +15,20 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "index as JSON can filter by workflow column id" do
|
||||
get cards_path(format: :json), params: { column_ids: [ columns(:writebook_in_progress).id ] }
|
||||
assert_response :success
|
||||
|
||||
assert_equal [ cards(:text).number ], @response.parsed_body.pluck("number")
|
||||
end
|
||||
|
||||
test "index as JSON can OR multiple workflow column ids" do
|
||||
get cards_path(format: :json), params: { column_ids: [ columns(:writebook_triage).id, columns(:writebook_in_progress).id ] }
|
||||
assert_response :success
|
||||
|
||||
assert_equal [ cards(:logo).number, cards(:layout).number, cards(:text).number ].sort, @response.parsed_body.pluck("number").sort
|
||||
end
|
||||
|
||||
test "create a new draft" do
|
||||
assert_difference -> { Card.count }, 1 do
|
||||
post board_cards_path(boards(:writebook))
|
||||
|
||||
@@ -166,6 +166,17 @@ class FilterTest < ActiveSupport::TestCase
|
||||
assert_not users(:david).filters.new(board_ids: [ boards(:writebook).id ]).used?(ignore_boards: true)
|
||||
end
|
||||
|
||||
test "column ids filter cards by workflow columns" do
|
||||
assert_equal [ cards(:text) ], users(:david).filters.new(column_ids: [ columns(:writebook_in_progress).id ]).cards.to_a
|
||||
assert_equal [ cards(:logo), cards(:layout) ].sort_by(&:id), users(:david).filters.new(column_ids: [ columns(:writebook_triage).id ]).cards.to_a.sort_by(&:id)
|
||||
end
|
||||
|
||||
test "column ids are ORed together" do
|
||||
filter = users(:david).filters.new(column_ids: [ columns(:writebook_triage).id, columns(:writebook_in_progress).id ])
|
||||
|
||||
assert_equal [ cards(:logo), cards(:layout), cards(:text) ].sort_by(&:id), filter.cards.to_a.sort_by(&:id)
|
||||
end
|
||||
|
||||
test "board titles are scoped to creator's account" do
|
||||
# Give mike (initech) access to the board in his account
|
||||
boards(:miltons_wish_list).accesses.grant_to(users(:mike))
|
||||
|
||||
Reference in New Issue
Block a user