Wire up comboboxes
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
require "test_helper"
|
||||
|
||||
class Assignments::SwapsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "swap with same user" do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do
|
||||
post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_assignee_id: users(:kevin).id,
|
||||
outgoing_assignee_id: users(:kevin).id
|
||||
}
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another user" do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: false, to: true do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do
|
||||
post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_assignee_id: users(:david).id,
|
||||
outgoing_assignee_id: users(:kevin).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another user when already assigned" do
|
||||
assert_no_changes "bubbles(:logo).assigned_to?(users(:jz))" do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do
|
||||
post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_assignee_id: users(:jz).id,
|
||||
outgoing_assignee_id: users(:kevin).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
require "test_helper"
|
||||
|
||||
class Assignments::TogglesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "create" do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: false, to: true do
|
||||
post bucket_bubble_assignment_toggles_url(buckets(:writebook), bubbles(:logo)), params: { assignee_id: users(:david).id }
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: true, to: false do
|
||||
post bucket_bubble_assignment_toggles_url(buckets(:writebook), bubbles(:logo)), params: { assignee_id: users(:david).id }
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
require "test_helper"
|
||||
|
||||
class Taggings::SwapsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "swap with same tag" do
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:web))", from: true, to: false do
|
||||
post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_tag_id: tags(:web).id,
|
||||
outgoing_tag_id: tags(:web).id
|
||||
}
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another tag" do
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:mobile))", from: false, to: true do
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:web))", from: true, to: false do
|
||||
post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_tag_id: tags(:mobile).id,
|
||||
outgoing_tag_id: tags(:web).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another tag when already tagged" do
|
||||
assert_no_changes "bubbles(:layout).tagged_with?(tags(:mobile))" do
|
||||
assert_changes "bubbles(:layout).tagged_with?(tags(:web))", from: true, to: false do
|
||||
post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:layout)), params: {
|
||||
incoming_tag_id: tags(:mobile).id,
|
||||
outgoing_tag_id: tags(:web).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:layout)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
require "test_helper"
|
||||
|
||||
class Taggings::TogglesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "create" do
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:mobile))", from: false, to: true do
|
||||
post bucket_bubble_tagging_toggles_url(buckets(:writebook), bubbles(:logo)), params: { tag_id: tags(:mobile).id }
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:mobile))", from: true, to: false do
|
||||
post bucket_bubble_tagging_toggles_url(buckets(:writebook), bubbles(:logo)), params: { tag_id: tags(:mobile).id }
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
require "test_helper"
|
||||
|
||||
class TagsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "create with existing tag" do
|
||||
assert_no_difference -> { accounts(:"37s").tags.count } do
|
||||
post bucket_bubble_tags_url(buckets(:writebook), bubbles(:logo)), params: { tag: { title: "Web" } }
|
||||
end
|
||||
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "create with new tag" do
|
||||
assert_difference -> { accounts(:"37s").tags.count }, +1 do
|
||||
post bucket_bubble_tags_url(buckets(:writebook), bubbles(:logo)), params: { tag: { title: "Horizons" } }
|
||||
end
|
||||
|
||||
assert_redirected_to bubbles(:logo)
|
||||
assert bubbles(:logo).tags.pluck(:title).include?("Horizons")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user