Commit a0684a63 authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou
Browse files

new assignment button not visible by volunteer

parent 4c9f369f
......@@ -6,12 +6,12 @@ nav.navbar.section-navigation
ul.list-inline
- if policy(Volunteer).supervisor?
li = render 'journals/journal_block', journaled_for: @volunteer
ul.list-inline
- if @volunteer.seeking_clients?
li = button_link t_title(:new, Assignment), new_assignment_path(volunteer_id: @volunteer)
- if @volunteer.assignments.any?
li = button_link t_title(:new, BillingExpense), new_volunteer_billing_expense_path(@volunteer)
li = button_link t_title(:index, BillingExpense), volunteer_billing_expenses_path(@volunteer)
ul.list-inline
- if @volunteer.seeking_clients?
li = button_link t_title(:new, Assignment), new_assignment_path(volunteer_id: @volunteer)
- if @volunteer.assignments.any?
li = button_link t_title(:new, BillingExpense), new_volunteer_billing_expense_path(@volunteer)
li = button_link t_title(:index, BillingExpense), volunteer_billing_expenses_path(@volunteer)
ul.list-inline
- if @volunteer.assignments.any?
li = button_link t_title(:new, Hour), new_volunteer_hour_url(@volunteer)
......
......@@ -3,7 +3,6 @@ require 'application_system_test_case'
class AssignmentsTest < ApplicationSystemTestCase
setup do
@user = create :user, email: 'superadmin@example.com'
login_as @user
Assignment.with_deleted.map(&:really_destroy!)
@volunteer_user = create :user, role: 'volunteer'
@client = create :client, user: @user
......@@ -11,6 +10,7 @@ class AssignmentsTest < ApplicationSystemTestCase
end
test 'new assignment form with preselected fields' do
login_as @user
visit new_assignment_path
within '.assignment_client' do
select(@client.contact.full_name, from: 'Client')
......@@ -27,6 +27,7 @@ class AssignmentsTest < ApplicationSystemTestCase
end
test 'assign unassigned client - client side' do
login_as @user
visit clients_path
first(:link, 'Need accompanying').click
click_link 'Find volunteer'
......@@ -41,6 +42,7 @@ class AssignmentsTest < ApplicationSystemTestCase
end
test 'assign unassigned client - volunteer side' do
login_as @user
visit seeking_clients_volunteers_path
page.find('a', text: 'Find client').trigger('click')
page.find('a', text: 'Reserve').trigger('click')
......@@ -54,6 +56,7 @@ class AssignmentsTest < ApplicationSystemTestCase
end
test 'creating a pdf with a user that has no profile will not crash' do
login_as @user
user = create :user, profile: nil
refute user.profile.present?
......@@ -71,4 +74,10 @@ class AssignmentsTest < ApplicationSystemTestCase
end
assert page.has_text? @client.contact.full_name
end
test 'volunteer can not see new assignment button' do
login_as @volunteer_user
visit volunteer_path(@volunteer)
refute page.has_link? 'New Assignment'
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment