Add a test case for implication requests.
This commit is contained in:
@@ -25,12 +25,32 @@ class TagImplicationRequestsControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "create action" do
|
context "create action" do
|
||||||
should "render" do
|
should "create forum post" do
|
||||||
assert_difference("ForumTopic.count", 1) do
|
assert_difference("ForumTopic.count", 1) do
|
||||||
post :create, {:tag_implication_request => {:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "ccc", :skip_secondary_validations => true}}, {:user_id => @user.id}
|
post :create, {:tag_implication_request => {:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "ccc", :skip_secondary_validations => true}}, {:user_id => @user.id}
|
||||||
end
|
end
|
||||||
assert_redirected_to(forum_topic_path(ForumTopic.last))
|
assert_redirected_to(forum_topic_path(ForumTopic.last))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "create a pending implication" do
|
||||||
|
params = {
|
||||||
|
:tag_implication_request => {
|
||||||
|
:antecedent_name => "foo",
|
||||||
|
:consequent_name => "bar",
|
||||||
|
:reason => "blah blah",
|
||||||
|
:skip_secondary_validations => true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post :create, params, {:user_id => @user.id}
|
||||||
|
|
||||||
|
tir = assigns(:tag_implication_request)
|
||||||
|
assert_redirected_to(forum_topic_path(tir.forum_topic))
|
||||||
|
|
||||||
|
assert("foo", tir.tag_implication.antecedent_name)
|
||||||
|
assert("bar", tir.tag_implication.consequent_name)
|
||||||
|
assert("pending", tir.tag_implication.status)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user