aliases/implications: remove dead approving/updating code.
Remove the edit, update, and approve endpoints for tag aliases and implications. These have been useless since individual alias and implication requests were removed. Aliases and implications could only be edited or approved if they were in the pending state, which is no longer possible. Also remove unused new alias/implication request forms.
This commit is contained in:
@@ -7,50 +7,6 @@ class TagAliasesControllerTest < ActionDispatch::IntegrationTest
|
||||
@tag_alias = create(:tag_alias, antecedent_name: "aaa", consequent_name: "bbb")
|
||||
end
|
||||
|
||||
context "edit action" do
|
||||
should "render" do
|
||||
get_auth edit_tag_alias_path(@tag_alias), @user
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "update action" do
|
||||
context "for a pending alias" do
|
||||
setup do
|
||||
as_admin do
|
||||
@tag_alias.update(status: "pending")
|
||||
end
|
||||
end
|
||||
|
||||
should "succeed" do
|
||||
put_auth tag_alias_path(@tag_alias), @user, params: {:tag_alias => {:antecedent_name => "xxx"}}
|
||||
@tag_alias.reload
|
||||
assert_equal("xxx", @tag_alias.antecedent_name)
|
||||
end
|
||||
|
||||
should "not allow changing the status" do
|
||||
put_auth tag_alias_path(@tag_alias), @user, params: {:tag_alias => {:status => "active"}}
|
||||
@tag_alias.reload
|
||||
assert_equal("pending", @tag_alias.status)
|
||||
end
|
||||
|
||||
# TODO: Broken in shoulda-matchers 2.8.0. Need to upgrade to 3.1.1.
|
||||
# should_eventually permit(:antecedent_name, :consequent_name, :forum_topic_id).for(:update)
|
||||
end
|
||||
|
||||
context "for an approved alias" do
|
||||
setup do
|
||||
@tag_alias.update_attribute(:status, "approved")
|
||||
end
|
||||
|
||||
should "fail" do
|
||||
put_auth tag_alias_path(@tag_alias), @user, params: {:tag_alias => {:antecedent_name => "xxx"}}
|
||||
@tag_alias.reload
|
||||
assert_equal("aaa", @tag_alias.antecedent_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "index action" do
|
||||
should "list all tag alias" do
|
||||
get_auth tag_aliases_path, @user
|
||||
|
||||
@@ -7,47 +7,6 @@ class TagImplicationsControllerTest < ActionDispatch::IntegrationTest
|
||||
@tag_implication = create(:tag_implication, antecedent_name: "aaa", consequent_name: "bbb")
|
||||
end
|
||||
|
||||
context "edit action" do
|
||||
should "render" do
|
||||
get_auth tag_implication_path(@tag_implication), @user
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "update action" do
|
||||
context "for a pending implication" do
|
||||
setup do
|
||||
as_admin do
|
||||
@tag_implication.update(status: "pending")
|
||||
end
|
||||
end
|
||||
|
||||
should "succeed" do
|
||||
put_auth tag_implication_path(@tag_implication), @user, params: {:tag_implication => {:antecedent_name => "xxx"}}
|
||||
@tag_implication.reload
|
||||
assert_equal("xxx", @tag_implication.antecedent_name)
|
||||
end
|
||||
|
||||
should "not allow changing the status" do
|
||||
put_auth tag_implication_path(@tag_implication), @user, params: {:tag_implication => {:status => "active"}}
|
||||
@tag_implication.reload
|
||||
assert_equal("pending", @tag_implication.status)
|
||||
end
|
||||
end
|
||||
|
||||
context "for an approved implication" do
|
||||
setup do
|
||||
@tag_implication.update_attribute(:status, "approved")
|
||||
end
|
||||
|
||||
should "fail" do
|
||||
put_auth tag_implication_path(@tag_implication), @user, params: {:tag_implication => {:antecedent_name => "xxx"}}
|
||||
@tag_implication.reload
|
||||
assert_equal("aaa", @tag_implication.antecedent_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "index action" do
|
||||
should "list all tag implications" do
|
||||
get tag_implications_path
|
||||
|
||||
Reference in New Issue
Block a user