From dfb8d0106d0ac8db681e06884a0f3e81951e6a01 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 6 Feb 2017 02:01:20 -0600 Subject: [PATCH] tests: add more posts controller tests. --- test/functional/posts_controller_test.rb | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/functional/posts_controller_test.rb b/test/functional/posts_controller_test.rb index 51ac1445f..01da6f29f 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -89,6 +89,32 @@ class PostsControllerTest < ActionController::TestCase assert_response :success end end + + context "with an md5 param" do + should "render" do + get :index, { md5: @post.md5 } + assert_redirected_to(@post) + end + end + end + + context "show_seq action" do + should "render" do + posts = FactoryGirl.create_list(:post, 3) + + get :show_seq, { seq: "prev", id: posts[1].id } + assert_redirected_to(posts[2]) + + get :show_seq, { seq: "next", id: posts[1].id } + assert_redirected_to(posts[0]) + end + end + + context "random action" do + should "render" do + get :random, { tags: "aaaa" } + assert_redirected_to(post_path(@post, tags: "aaaa")) + end end context "show action" do