mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 13:14:03 +00:00
fix test and add test for roles view
This commit is contained in:
parent
911143c006
commit
7d35fc2857
2 changed files with 30 additions and 4 deletions
|
|
@ -19,7 +19,7 @@ feature 'Has correct abilities' do
|
|||
sign_in user
|
||||
visit admin_conference_path(conference1.short_title)
|
||||
|
||||
expect(page).to have_selector( 'li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit")
|
||||
expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit")
|
||||
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials")
|
||||
|
|
@ -90,7 +90,7 @@ feature 'Has correct abilities' do
|
|||
sign_in user
|
||||
visit admin_conference_path(conference2.short_title)
|
||||
|
||||
expect(page).to have_selector( 'li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit")
|
||||
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit")
|
||||
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials")
|
||||
|
|
@ -161,7 +161,7 @@ feature 'Has correct abilities' do
|
|||
sign_in user
|
||||
visit admin_conference_path(conference3.short_title)
|
||||
|
||||
expect(page).to have_selector( 'li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_link('Basics', href: "/admin/conference/#{conference3.short_title}/edit")
|
||||
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit")
|
||||
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials")
|
||||
|
|
@ -233,7 +233,7 @@ feature 'Has correct abilities' do
|
|||
sign_in user
|
||||
visit admin_conference_path(conference4.short_title)
|
||||
|
||||
expect(page).to have_selector( 'li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_link('Basics', href: "/admin/conference/#{conference4.short_title}/edit")
|
||||
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference4.short_title}/contact/edit")
|
||||
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference4.short_title}/commercials")
|
||||
|
|
|
|||
26
spec/views/admin/conference/roles.html.haml_spec.rb
Normal file
26
spec/views/admin/conference/roles.html.haml_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/conference/roles' do
|
||||
let(:conference) { create(:conference) }
|
||||
let(:organizer_role) { create(:organizer_role, description: 'My description for organizer role', resource: conference) }
|
||||
let(:organizer) { create(:user, name: 'test name', email: 'test@email.com', role_ids: [organizer_role.id]) }
|
||||
|
||||
it 'renders the roles template for the conference' do
|
||||
assign :conference, conference
|
||||
assign :selection, 'organizer'
|
||||
assign :role, [organizer_role]
|
||||
assign :role_users, {'organizer' => [organizer]}
|
||||
render
|
||||
expect(rendered).to include('Show users for role:')
|
||||
expect(rendered).to include(organizer_role.description)
|
||||
expect(rendered).to include("Add role 'Organizer' to user:")
|
||||
expect(rendered).to include('Add role')
|
||||
expect(rendered).to include('Users with role Organizer')
|
||||
expect(rendered).to have_selector("table thead th:nth-of-type(1)", text: 'ID')
|
||||
expect(rendered).to have_selector("table thead th:nth-of-type(2)", text: 'Name')
|
||||
expect(rendered).to have_selector("table thead th:nth-of-type(3)", text: 'Email')
|
||||
expect(rendered).to have_selector("table tbody tr:nth-of-type(1) td:nth-of-type(1)", text: organizer.id)
|
||||
expect(rendered).to have_selector("table tbody tr:nth-of-type(1) td:nth-of-type(2)", text: 'test name')
|
||||
expect(rendered).to have_selector("table tbody tr:nth-of-type(1) td:nth-of-type(3)", text: 'test@email.com')
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue