adds admin layout and access links [#163]

This commit is contained in:
rgarcia
2015-08-14 12:37:44 +02:00
parent 15aafe570b
commit 88defaa455
11 changed files with 114 additions and 0 deletions

View File

@@ -31,4 +31,50 @@ feature 'Admin' do
expect(page).to_not have_content "not authorized"
end
scenario "Admin access links" do
create(:administrator, user: user)
login_as(user)
visit root_path
expect(page).to have_link('Administration')
expect(page).to_not have_link('Moderator')
end
scenario "Moderation access links" do
create(:moderator, user: user)
login_as(user)
visit root_path
expect(page).to have_link('Moderation')
expect(page).to_not have_link('Administration')
end
scenario 'Admin dashboard' do
create(:administrator, user: user)
login_as(user)
visit root_path
click_link 'Administration'
expect(current_path).to eq(admin_root_path)
expect(page).to have_css('#admin_menu')
expect(page).to_not have_css('#moderation_menu')
end
scenario 'Moderation dashboard' do
create(:moderator, user: user)
login_as(user)
visit root_path
click_link 'Moderation'
expect(current_path).to eq(moderation_root_path)
expect(page).to have_css('#moderation_menu')
expect(page).to_not have_css('#admin_menu')
end
end