Sha256: ce0ffa6c61cccc294cbb2d3f3496900400f147339c1c055a197994af0b1c00f2

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

require 'rails_helper'

feature WebAdmin::Permission do
  scenario "verify permission to user" do
    user = create(:web_admin_user)
    user.permissions = [
      create(:manage_post, permission_type: WebAdmin::PermissionType::DENY),
      create(:manage_user, permission_type: WebAdmin::PermissionType::ACCESS),
      create(:manage_video, permission_type: WebAdmin::PermissionType::READ),
      create(:manage_album, permission_type: WebAdmin::PermissionType::ACCESS),
      create(:manage_image, permission_type: WebAdmin::PermissionType::ACCESS),
      create(:manage_institutional, permission_type: WebAdmin::PermissionType::MODIFY),
      create(:manage_event, permission_type: WebAdmin::PermissionType::ACCESS),
    ]

    visit web_admin.root_path
    fill_in 'Email', with: user.email
    fill_in 'Senha', with: user.password

    click_button 'Entrar'

    expect(page).to_not have_link 'Notícias'
    expect(page).to have_link 'Institucionais'
    expect(page).to have_link 'Vídeos'
    expect(page).to have_link 'Álbuns'
    expect(page).to have_link 'Usuários'
    expect(page).to have_link 'Eventos'

    visit '/web_admin/posts'
    expect(page).to have_content "Você não tem acesso a essa página. Contate o administrador do sistema, para maiores informações."

    visit web_admin.root_path

    click_link 'Institucionais'

    expect(page).to have_content "Cadastro de institucionais"
    expect(page).to_not have_link 'Novo'

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
web_admin-0.1.0 spec/features/admin_web/permissions_spec.rb
web_admin-0.0.2 spec/features/admin_web/permissions_spec.rb
web_admin-0.0.1 spec/features/admin_web/permissions_spec.rb