From d74503ae0504027574db62098c9f0cea371576c1 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 5 Feb 2017 01:31:21 -0600 Subject: [PATCH] tests: add misc controller tests. --- app/controllers/admin/dashboards_controller.rb | 2 -- app/logical/admin_dashboard.rb | 2 +- test/functional/admin/dashboards_controller_test.rb | 12 ++++++++++++ .../artist_commentary_versions_controller_test.rb | 12 ++++++++++++ test/functional/counts_controller_test.rb | 12 ++++++++++++ test/functional/delayed_jobs_controller_test.rb | 12 ++++++++++++ test/functional/dtext_previews_controller_test.rb | 12 ++++++++++++ 7 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 test/functional/admin/dashboards_controller_test.rb create mode 100644 test/functional/artist_commentary_versions_controller_test.rb create mode 100644 test/functional/counts_controller_test.rb create mode 100644 test/functional/delayed_jobs_controller_test.rb create mode 100644 test/functional/dtext_previews_controller_test.rb diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb index 83076fdd7..c6ec0a31a 100644 --- a/app/controllers/admin/dashboards_controller.rb +++ b/app/controllers/admin/dashboards_controller.rb @@ -1,7 +1,5 @@ module Admin class DashboardsController < ApplicationController - before_filter :admin_only - def show @dashboard = AdminDashboard.new end diff --git a/app/logical/admin_dashboard.rb b/app/logical/admin_dashboard.rb index 8d4635e0d..b15b039ff 100644 --- a/app/logical/admin_dashboard.rb +++ b/app/logical/admin_dashboard.rb @@ -12,6 +12,6 @@ class AdminDashboard end def forum_topics - ForumTopic.where(category_id: 1).order("id desc").limit(20) + ForumTopic.search(category_id: 1).order("id desc").limit(20) end end diff --git a/test/functional/admin/dashboards_controller_test.rb b/test/functional/admin/dashboards_controller_test.rb new file mode 100644 index 000000000..d33a30036 --- /dev/null +++ b/test/functional/admin/dashboards_controller_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' + +class Admin::DashboardsControllerTest < ActionController::TestCase + context "The admin dashboard controller" do + context "show action" do + should "render" do + get :show + assert_response :success + end + end + end +end diff --git a/test/functional/artist_commentary_versions_controller_test.rb b/test/functional/artist_commentary_versions_controller_test.rb new file mode 100644 index 000000000..323677a5e --- /dev/null +++ b/test/functional/artist_commentary_versions_controller_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' + +class ArtistCommentaryVersionsControllerTest < ActionController::TestCase + context "The artist commentary versions controller" do + context "index action" do + should "render" do + get :index + assert_response :success + end + end + end +end diff --git a/test/functional/counts_controller_test.rb b/test/functional/counts_controller_test.rb new file mode 100644 index 000000000..52fe13113 --- /dev/null +++ b/test/functional/counts_controller_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' + +class CountsControllerTest < ActionController::TestCase + context "The counts commentary controller" do + context "posts action" do + should "render" do + get :posts + assert_response :success + end + end + end +end diff --git a/test/functional/delayed_jobs_controller_test.rb b/test/functional/delayed_jobs_controller_test.rb new file mode 100644 index 000000000..e3231f4cd --- /dev/null +++ b/test/functional/delayed_jobs_controller_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' + +class DelayedJobsControllerTest < ActionController::TestCase + context "The delayed jobs controller" do + context "index action" do + should "render" do + get :index + assert_response :success + end + end + end +end diff --git a/test/functional/dtext_previews_controller_test.rb b/test/functional/dtext_previews_controller_test.rb new file mode 100644 index 000000000..6c4ced596 --- /dev/null +++ b/test/functional/dtext_previews_controller_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' + +class DtextPreviewsControllerTest < ActionController::TestCase + context "The dtext previews controller" do + context "create action" do + should "render" do + post :create, { body: "h1. Touhou\n\n* [[touhou]]" } + assert_response :success + end + end + end +end