Add redirects, update test types

This commit is contained in:
pfischbeck committed 2017-11-26 14:32:18 +01:00
1 parent c69eb788ef
commit b5697eff56
7 files changed
+39 -27

No files matched your search

@@ -1,26 +1,26 @@
require 'test_helper'
class Admin::DashboardControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
class Admin::DashboardControllerTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
setup do
login
end
test "should get index" do
get :index
get admin_dashboard_index_url
assert_response :success
end
test "should post new problem count" do
post :update_problem_count, params: { problem_count: 15 }
assert_redirected_to controller: 'admin/dashboard', action: 'index'
post admin_dashboard_update_problem_count_url(problem_count: 15)
assert_redirected_to admin_dashboard_index_url
assert_equal 15, Problem.count
end
test "should fail incorrect problem count" do
post :update_problem_count, params: { problem_count: 2 }
assert_redirected_to controller: 'admin/dashboard', action: 'index'
post admin_dashboard_update_problem_count_url(problem_count: 2)
assert_redirected_to admin_dashboard_index_url
assert_equal 3, Problem.count
end
@@ -1,20 +1,20 @@
require 'test_helper'
class Admin::TranslationsControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
class Admin::TranslationsControllerTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
setup do
login
@translation = translations(:translation_one)
end
test "should get index" do
get :index
get admin_translations_url
assert_response :success
assert_not_nil assigns(:translations)
end
test "should show translation" do
get :show, params: { id: @translation }
get admin_translation_url(id: @translation)
assert_response :success
end