1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2026-01-26 18:18:51 +01:00

Move translation viewing to admin namespace

This commit is contained in:
2015-02-16 09:37:13 +01:00
parent 49c7d97a41
commit 6b463417ba
26 changed files with 96 additions and 39 deletions

View File

@@ -0,0 +1,15 @@
require 'test_helper'
class Admin::DashboardControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
login
end
test "should get index" do
get :index
assert_response :success
end
end

View File

@@ -0,0 +1,21 @@
require 'test_helper'
class Admin::TranslationsControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
login
@translation = translations(:translation_one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:translations)
end
test "should show translation" do
get :show, id: @translation
assert_response :success
end
end

View File

@@ -4,7 +4,6 @@ class TranslationsControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
@translation = translations(:translation_one)
@update = {
title: 'New title',
content: 'This is the new content',
@@ -13,14 +12,6 @@ class TranslationsControllerTest < ActionController::TestCase
title: '',
content: ''
}
@admin = admins(:admin)
end
test "should get index" do
sign_in @admin
get :index
assert_response :success
assert_not_nil assigns(:translations)
end
test "should get new for translated problem" do
@@ -46,10 +37,4 @@ class TranslationsControllerTest < ActionController::TestCase
post :create, problem_id: 1, translation: @incorrect
end
end
test "should show translation" do
sign_in @admin
get :show, id: @translation
assert_response :success
end
end

View File

@@ -10,4 +10,8 @@ class ActiveSupport::TestCase
fixtures :all
# Add more helper methods to be used by all tests here...
def login
admin = admins(:admin)
sign_in admin
end
end