mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-26 18:18:51 +01:00
Use Omniauthable user model with admin role
This commit is contained in:
@@ -4,7 +4,7 @@ class Admin::DashboardControllerTest < ActionDispatch::IntegrationTest
|
||||
include Devise::Test::IntegrationHelpers
|
||||
|
||||
setup do
|
||||
login
|
||||
login_admin
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
|
||||
@@ -4,7 +4,7 @@ class Admin::TranslationsControllerTest < ActionDispatch::IntegrationTest
|
||||
include Devise::Test::IntegrationHelpers
|
||||
|
||||
setup do
|
||||
login
|
||||
login_admin
|
||||
@translation = translations(:translation_one)
|
||||
@translation_alternative = translations(:translation_two_alternative)
|
||||
end
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# 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::Encryptor.digest(Admin, 'password') %>
|
||||
provider: github
|
||||
uid: admin
|
||||
name: admin
|
||||
role: 1
|
||||
|
||||
translator:
|
||||
provider: github
|
||||
uid: translator
|
||||
name: translator
|
||||
role: 0
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AdminTest < ActiveSupport::TestCase
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
@@ -10,8 +10,13 @@ class ActiveSupport::TestCase
|
||||
fixtures :all
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
def login
|
||||
admin = admins(:admin)
|
||||
def login_admin
|
||||
admin = users(:admin)
|
||||
sign_in admin
|
||||
end
|
||||
|
||||
def login_translator
|
||||
translator = users(:translator)
|
||||
sign_in translator
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user