Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ gem 'ndr_error', '~> 2.0'
gem 'ndr_import'
gem 'ndr_pseudonymise', '~> 0.4.1'
gem 'ndr_support', '~> 5.9'
gem 'ndr_ui', '~> 3.3'
gem 'ndr_ui', '~> 4.1'
gem 'ndr_workflow', '~> 1.2', '>= 1.2.2'

gem 'bootstrap-table-rails', '~> 1.20.2'
Expand Down
30 changes: 15 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,14 @@ GEM
msworddoc-extractor (0.2.0)
ruby-ole
multi_json (1.15.0)
ndr_authenticate (0.3.4)
ndr_authenticate (0.3.5)
devise
devise_saml_authenticatable (~> 1.9)
ndr_ui (>= 2.3)
net-ldap
rails (>= 7.0, < 7.3)
rails (>= 7.1, < 8.1)
yubikey
ndr_dev_support (7.3.4)
ndr_dev_support (7.3.5)
activesupport (>= 6.1, < 8.1)
brakeman (>= 4.7.1)
bundler-audit
Expand All @@ -298,16 +298,16 @@ GEM
simplecov
unicode-display_width (>= 1.3.3)
with_clean_rbenv
ndr_error (2.3.2)
ndr_ui
ndr_error (2.3.3)
ndr_ui (< 5.0)
net-imap
net-pop
net-smtp
rails (>= 6.1, < 7.3)
rails (>= 6.1, < 8.1)
will_paginate
ndr_import (11.2.1)
ndr_import (11.4.1)
activemodel
activesupport (>= 6.1, < 8.1)
activesupport (>= 7.1, < 8.1)
avro (~> 1.11.0)
bio-vcf (~> 0.9.5)
csv
Expand All @@ -324,13 +324,13 @@ GEM
spreadsheet (= 1.2.6)
ndr_pseudonymise (0.4.2)
activesupport
ndr_support (5.10.4)
activerecord (>= 7.0, < 8.1)
activesupport (>= 7.0, < 8.1)
ndr_ui (3.3.2)
ndr_support (5.10.5)
activerecord (>= 7.1, < 8.1)
activesupport (>= 7.1, < 8.1)
ndr_ui (4.1.3)
bootstrap-sass (~> 3.4.1)
jquery-rails (>= 4.1.0)
rails (>= 6.1, < 7.3)
jquery-rails (~> 4.6)
rails (>= 6.1, < 8.1)
sprockets (>= 4.0)
sprockets-rails (>= 3.0.0)
ndr_workflow (1.2.4)
Expand Down Expand Up @@ -627,7 +627,7 @@ DEPENDENCIES
ndr_import
ndr_pseudonymise (~> 0.4.1)
ndr_support (~> 5.9)
ndr_ui (~> 3.3)
ndr_ui (~> 4.1)
ndr_workflow (~> 1.2, >= 1.2.2)
nokogiri (~> 1.11)
paper_trail (~> 16.0)
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/concerns/workflow/mail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def render_default_template(format)

def transition_email(**options, &block)
# For translation lookup purposes. If not already set, infer from the calling method.
@i18n_prefix ||= caller_locations.first.label
@i18n_prefix ||= caller_locations.first.base_label

subject = t(
:subject,
Expand Down
4 changes: 1 addition & 3 deletions test/integration/application_project_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class ApplicationProjectTest < ActionDispatch::IntegrationTest

@project = projects(:test_application)

sign_in @user
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@user)
end

# TODO: Complete coverage
Expand Down
10 changes: 2 additions & 8 deletions test/integration/notification_recipients_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ def setup
project.project_comments.create(user: project.owner, project_node: node, comment: 'Justify!!')
end

sign_in project.owner

visit terms_and_conditions_path
click_link 'Accept'
login_and_accept_terms(project.owner)

visit project_path(project)

Expand All @@ -109,10 +106,7 @@ def setup
test 'project submitted to odr' do
project = projects(:pending_delegate_project)

sign_in users(:delegate_user1)

visit terms_and_conditions_path
click_link 'Accept'
login_and_accept_terms(users(:delegate_user1))

visit project_path(project)

Expand Down
52 changes: 14 additions & 38 deletions test/integration/project_core_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,23 @@ def setup
end

test 'sign in and visit project page, standard user' do
sign_in @user
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@user)
visit projects_path
assert page.has_content?('Notifications')
visit terms_and_conditions_path
assert page.has_content?('Terms and Conditions have been accepted')
end

test 'sign in and visit project page, odr user' do
sign_in @odr
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@odr)
visit projects_path
assert page.has_content?('Notifications')
visit terms_and_conditions_path
assert page.has_content?('Terms and Conditions have been accepted')
end

test 'sign in and visit project page, admin user' do
sign_in @admin
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@admin)
visit projects_path
assert page.has_content?('Notifications')
visit terms_and_conditions_path
Expand All @@ -43,19 +37,17 @@ def setup
test 'reset project approvals' do
project = projects(:pending_project)

sign_in @odr
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@odr)
visit project_path(project)
click_link('Project Details')

assert_changes -> { project.reload.details_approved } do
within('#approve_details_status') do
click_button 'Approve'

assert has_no_button? 'Approve'
assert has_text? 'APPROVED'
end
assert_text 'APPROVED'
assert has_no_button? 'Approve'
end

accept_prompt do
Expand All @@ -68,30 +60,23 @@ def setup

=begin
test 'soft delete a project' do
sign_in @admin
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@admin)
visit project_path(projects(:new_project))
click_on 'Delete'
assert page.has_content?('Project was successfully destroyed.')
end
=end

test 'should error if no permission to show project' do
sign_in users(:standard_user_multiple_teams)
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(users(:standard_user_multiple_teams))
@project = projects(:approved_project)
visit project_path(@project)
end

test 'successful project allocation' do
assigned_user = users(:application_manager_two)

sign_in @odr

visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@odr)

visit project_path(@eoi)

Expand All @@ -102,12 +87,12 @@ def setup
select 'Application Manager Two', from: 'Application Manager'
click_button 'Apply'
end
assert_text 'EOI was successfully assigned'
end
end
end

assert_current_path project_path(@eoi)
assert page.has_text? 'EOI was successfully assigned'
assert_equal assigned_user, @eoi.reload.assigned_user

open_email assigned_user.email
Expand All @@ -118,10 +103,7 @@ def setup
test 'unsuccessful project allocation' do
Project.any_instance.stubs(save: false)

sign_in @odr

visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@odr)

visit project_path(@eoi)

Expand All @@ -144,10 +126,7 @@ def setup

project = projects(:pending_delegate_project)

sign_in users(:delegate_user1)

visit terms_and_conditions_path
click_link 'Accept'
login_and_accept_terms(users(:delegate_user1))
visit project_path(project)

accept_prompt do
Expand All @@ -158,10 +137,7 @@ def setup
end

test 'should get dashboard page' do
sign_in @odr

visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@odr)

within '.navbar' do
assert_nothing_raised do
Expand All @@ -181,7 +157,7 @@ def setup
project.update!(parent: parent, owner: @user)
child.update!(parent: project, owner: @user)

sign_in @user
login_and_accept_terms(@user)

visit project_path(project)

Expand Down
13 changes: 4 additions & 9 deletions test/integration/project_dashboard_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ def setup
end

test 'sign in and visit project page, application manager' do
sign_in users(:application_manager_three)
cas_project = create_project(project_type: project_types(:cas),
owner: users(:application_manager_three))
cas_project2 = create_project(project_type: project_types(:cas),
owner: users(:standard_user))
eoi_project = create_project(project_type: project_types(:eoi), project_purpose: 'test',
owner: users(:application_manager_three))
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(users(:application_manager_three))
visit dashboard_projects_path
within('#projects-table', match: :first) do
assert has_content?('Project Title')
Expand Down Expand Up @@ -48,15 +46,14 @@ def setup
end

test 'sign in and visit project page, mbis delegate' do
sign_in users(:delegate_user1)

cas_project = create_project(project_type: project_types(:cas),
owner: users(:delegate_user1))
cas_project2 = create_project(project_type: project_types(:cas),
owner: users(:standard_user))
mbis_project = create_project(project_type: project_types(:project), project_purpose: 'test',
owner: users(:delegate_user1))
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(users(:delegate_user1))
visit dashboard_projects_path

assert has_content?('Unassigned Projects')
Expand Down Expand Up @@ -88,15 +85,13 @@ def setup
end

test 'sign in and visit project page, mbis applicant' do
sign_in users(:standard_user1)
cas_project = create_project(project_type: project_types(:cas),
owner: users(:standard_user1))
cas_project2 = create_project(project_type: project_types(:cas),
owner: users(:no_roles))
mbis_project = create_project(project_type: project_types(:project), project_purpose: 'test',
owner: users(:standard_user1))
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(users(:standard_user1))
visit dashboard_projects_path

assert has_content?('Unassigned Projects')
Expand Down
13 changes: 8 additions & 5 deletions test/integration/project_import_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
class ProjectImportTest < ActionDispatch::IntegrationTest
def setup
@user = users(:application_manager_one)

sign_in @user

visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@user)
end

test 'should not be able to import application PDF forms without an :application_manager role' do
Expand Down Expand Up @@ -66,6 +62,7 @@ def setup

click_button 'OK'
end
assert_no_text 'Could not import file!'
end

# Wrong file type...
Expand All @@ -82,6 +79,7 @@ def setup

click_button 'OK'
end
assert_no_text 'Could not import file!'
end

# Bad PDF...
Expand All @@ -99,6 +97,7 @@ def setup

click_button 'OK'
end
assert_no_text 'Could not import file!'
end
end

Expand Down Expand Up @@ -151,4 +150,8 @@ def setup

assert has_no_text?('Drag and drop PDF here')
end

def fixture_path
fixture_paths[0]
end
end
2 changes: 2 additions & 0 deletions test/integration/smoke_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def setup
test 'sign in and accept terms' do
sign_in @user
visit terms_and_conditions_path
assert_text @user.email
click_on 'Accept'
assert page.has_content?('Notifications')
visit terms_and_conditions_path
Expand All @@ -19,6 +20,7 @@ def setup
test 'sign in and reject terms' do
sign_in @user
visit terms_and_conditions_path
assert_text @user.email
click_on 'Reject'
assert page.has_content?('You have 2 attempts to approve the terms and then your account will be locked')
assert page.has_content?('Welcome to the Data Management System')
Expand Down
4 changes: 1 addition & 3 deletions test/integration/team_core_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ def setup
@admin = users(:admin_user)
@organisation = organisations(:test_organisation_one)

sign_in @admin
visit terms_and_conditions_path
click_on 'Accept'
login_and_accept_terms(@admin)
visit organisation_teams_path(@organisation)
end

Expand Down
Loading
Loading