mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-26 18:18:51 +01:00
Add authentication with devise, fix tests
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProblemsControllerTest < ActionController::TestCase
|
||||
include Devise::TestHelpers
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TranslationsControllerTest < ActionController::TestCase
|
||||
include Devise::TestHelpers
|
||||
|
||||
setup do
|
||||
@translation = translations(:translation_one)
|
||||
@update = {
|
||||
title: 'New title',
|
||||
content: 'This is the new content',
|
||||
}
|
||||
@admin = admins(:admin)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
sign_in @admin
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:translations)
|
||||
@@ -29,6 +33,7 @@ class TranslationsControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
test "should show translation" do
|
||||
sign_in @admin
|
||||
get :show, id: @translation
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
6
test/fixtures/admins.yml
vendored
6
test/fixtures/admins.yml
vendored
@@ -3,4 +3,8 @@
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
#
|
||||
|
||||
admin:
|
||||
email: admin@example.com
|
||||
encrypted_password: <%= Devise.bcrypt(Admin, 'password') %>
|
||||
Reference in New Issue
Block a user