fix admin controllers auth logic
This commit is contained in:
parent
c9ab846c3a
commit
d20f10a607
|
@ -1,9 +1,3 @@
|
|||
# All Administrate controllers inherit from this `Admin::ApplicationController`,
|
||||
# making it the ideal place to put authentication logic or other
|
||||
# before_filters.
|
||||
#
|
||||
# If you want to add pagination or other controller-level concerns,
|
||||
# you're free to overwrite the RESTful controller actions.
|
||||
module Admin
|
||||
class AdminController < ApplicationController
|
||||
layout "admin"
|
||||
|
@ -11,9 +5,8 @@ module Admin
|
|||
|
||||
def authenticate_admin
|
||||
user = current_user
|
||||
if(user)
|
||||
redirect_to "/" unless user.admin?
|
||||
end
|
||||
return true if(user) and user.admin?
|
||||
redirect_to "/"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
feature 'About page' do
|
||||
|
||||
scenario 'Visit the course page' do
|
||||
visit 'course'
|
||||
expect(page).to have_content 'Web Application Development'
|
||||
expect(page).to have_content 'Technical skill is the start'
|
||||
expect(page).to have_content 'You will give 2'
|
||||
end
|
||||
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
# Feature: Home page
|
||||
# As a visitor
|
||||
# I want to visit a home page
|
||||
# So I can learn more about the website
|
||||
feature 'Home page' do
|
||||
|
||||
# Scenario: Visit the home page
|
||||
# Given I am a visitor
|
||||
# When I visit the home page
|
||||
# Then I see "Welcome"
|
||||
scenario 'visit the home page' do
|
||||
visit root_path
|
||||
expect(page).to have_content 'Become a web-developer'
|
||||
expect(page).to have_content 'Small groups, relaxed'
|
||||
expect(page).to have_content 'Relax in the nature'
|
||||
end
|
||||
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
# Feature: Navigation links
|
||||
# As a visitor
|
||||
# I want to see navigation links
|
||||
# So I can find home, sign in, or sign up
|
||||
feature 'Navigation links', :devise do
|
||||
|
||||
# Scenario: View navigation links
|
||||
# Given I am a visitor
|
||||
# When I visit the home page
|
||||
# Then I see "home," "sign in," and "sign up"
|
||||
scenario 'view navigation links' do
|
||||
visit root_path
|
||||
expect(page).to have_content 'Course'
|
||||
expect(page).to have_content 'Apply'
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,29 @@
|
|||
feature 'Static pages' do
|
||||
|
||||
scenario 'Visit the course page' do
|
||||
visit 'course'
|
||||
expect(page).to have_content 'Web Application Development'
|
||||
expect(page).to have_content 'Technical skill is the start'
|
||||
expect(page).to have_content 'You will give 2'
|
||||
end
|
||||
|
||||
scenario 'view navigation links' do
|
||||
visit root_path
|
||||
expect(page).to have_content 'Course'
|
||||
expect(page).to have_content 'Apply'
|
||||
end
|
||||
|
||||
scenario 'visit the home page' do
|
||||
visit root_path
|
||||
expect(page).to have_content 'Become a web-developer'
|
||||
expect(page).to have_content 'Small groups, relaxed'
|
||||
expect(page).to have_content 'Relax in the nature'
|
||||
end
|
||||
|
||||
scenario 'visit the admin' do
|
||||
visit admin_courses_path
|
||||
expect(page).to have_content 'Relax in the nature'
|
||||
expect(page.current_path).to eq root_path
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue