Skip to content

Commit ce9984e

Browse files
Merge pull request #2394 from NCCE/3028-improving-test-coverage-post-april-1st
Improving Test Coverage
2 parents aba3719 + 662272f commit ce9984e

File tree

21 files changed

+262
-203
lines changed

21 files changed

+262
-203
lines changed

.env.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
ACHIEVER_V2_PASSWORD=password
22
ACHIEVER_V2_USERNAME=username
33
ACHIEVER_V2_ENDPOINT=https://stemraspberrypiapi.dev3.smartmembership.net/smartconnector.smartconnector.svc/JSON/
4+
ACHIEVER_F2F_METHOD=CourseListingFutureByProgrammeIdV2ConciseHfW
5+
ACHIEVER_ONLINE_METHOD=FutureOnlineCoursesByProgrammeIdV2ConciseHfW
6+
ACHIEVER_LOCAL_TEMPLATE_PATH='spec/support/achiever/local_templates'
7+
48
DYNAMICS_WEBHOOK_TOKEN=token
59

610
FLAG_IBELONG_PROGRAMME=on

app/components/bordered_list_cards_component.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/components/bordered_list_cards_component/bordered_list_cards_component.html.erb

Lines changed: 0 additions & 26 deletions
This file was deleted.

app/helpers/certificate_helper.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,4 @@ def add_groups_complete_icon_class(current_user, groups)
77
complete = groups.all? { |group| group.user_complete?(current_user) }
88
complete ? "ncce-activity-list__title--complete" : ""
99
end
10-
11-
def sort_complete_first(activities:, complete: false)
12-
return activities unless complete
13-
14-
activities.sort_by { |a| current_user.achievements.find_by(activity_id: a.activity_id)&.complete? ? 0 : 1 }
15-
end
1610
end

app/views/certificates/pathways/show.html.erb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@
7777
<p class="govuk-body-s govuk-!-margin-top-5"><%= group.web_copy_course_requirements %></p>
7878
<% group.programme_activities.includes(:activity).where(activity: { id: @recommended_community_activity_ids }).each do |programme_activity| %>
7979
<div class="ncce-pathway-courses__course">
80-
<p class="ncce-pathway-courses__link">
81-
<%= link_to strip_tags(programme_activity.activity.title), programme_activity.activity.public_copy_title_url, class: 'ncce-link govuk-heading-s' %>
82-
</p>
80+
<% if programme_activity.activity.public_copy_title_url %>
81+
<p class="ncce-pathway-courses__link">
82+
<%= link_to strip_tags(programme_activity.activity.title), programme_activity.activity.public_copy_title_url, class: 'ncce-link govuk-heading-s' %>
83+
</p>
84+
<% else %>
85+
<p class="govuk-heading-s"><%= strip_tags(programme_activity.activity.title) %></p>
86+
<% end %>
8387
<p class="govuk-body-s">
8488
<%= sanitize programme_activity.activity.public_copy_description %>
8589
</p>

app/views/components/_hero.html.erb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
<span class="govuk-body-m hero__status"><%= status_message %></span>
99
<% end %>
1010
<div class="i-belong-hero__wrapper hero__heading-wrapper hero__heading-wrapper--full-width">
11-
<div class="i-belong-hero__area--text">
12-
<h1 class="<%= local_assigns[:small_title] ? 'govuk-heading-l' : 'govuk-heading-xl'%> hero__heading"><%= hero_title %></h1>
13-
<% unless local_assigns[:subtitle].nil? %>
14-
<p class="govuk-body hero__text"><%= subtitle %></p>
15-
<% end %>
16-
</div>
17-
<div class="i-belong-hero__area--logo">
18-
<%= render(IBelongFlagComponent.new(label: false)) %>
19-
</div>
11+
<div class="i-belong-hero__area--text">
12+
<h1 class="<%= local_assigns[:small_title] ? 'govuk-heading-l' : 'govuk-heading-xl'%> hero__heading"><%= hero_title %></h1>
13+
<% unless local_assigns[:subtitle].nil? %>
14+
<p class="govuk-body hero__text"><%= subtitle %></p>
15+
<% end %>
16+
</div>
17+
<div class="i-belong-hero__area--logo">
18+
<%= render(IBelongFlagComponent.new(label: false)) %>
19+
</div>
2020
</div>
2121
</div>
2222
</div>

app/views/courses/programme_courses.html.erb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,6 @@
1212
<% end %>
1313
<% end %>
1414

15-
<% if @filter_params[:hub_id].present? %>
16-
<div class="ncce-courses__hub-container" data-course-filter-target="hubMessage">
17-
<%= render GovGridRowComponent.new(additional_classes: ['ncce-courses__hub-wrapper']) do |row| %>
18-
<%= row.with_column(:full) do %>
19-
<h3 class="govuk-heading-s ncce-courses__hub-heading">
20-
<% if @course_filter.current_hub == :no_courses %>
21-
There are no courses to show from this Computing Hub
22-
<% else %>
23-
Showing courses run by <span class='ncce-courses__hub-heading-name'><%= @course_filter.current_hub %></span>
24-
<% end %>
25-
<%= link_to 'show all results',
26-
courses_path(anchor: 'results-top'),
27-
class: 'govuk-link ncce-link govuk-body-m ncce-courses__clear-filters-text ncce-courses__clear-filters-text--hub',
28-
data: {
29-
event_action: 'click',
30-
event_category: 'Courses',
31-
event_label: 'Clear hub filter'
32-
}
33-
%>
34-
</h3>
35-
<% end %>
36-
<% end %>
37-
</div>
38-
<% end %>
39-
4015
<%= form_with url: course_filter_path, method: :get, class: 'ncce-courses__filter-form', data: { action: "ajax:success->course-filter#handleResults", 'course-filter-target': "form" } do %>
4116
<div class="govuk-width-container ncce-courses__container" data-course-filter-target="resultsContainer" id="results-top">
4217
<div class="govuk-main-wrapper ncce-courses__results-wrapper">

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@
151151
get "/hubs", to: redirect("/")
152152
get "/bursary", to: redirect("/")
153153
get "/funding", to: redirect("/")
154+
get "/courses/hubs/:hub_id", to: redirect("/courses"), as: "hub"
154155

155156
get "/courses", action: :index, controller: "courses", as: "courses"
156157
get "/courses/filter", action: :filter, controller: "courses", as: "course_filter"
157-
get "/courses/hubs/:hub_id", to: redirect("/courses"), as: "hub"
158158
get "/courses/:id(/:name)", action: :show, controller: "courses", as: "course"
159159

160160
get "/curriculum", to: "curriculum/key_stages#index", as: :curriculum_key_stages

lib/tasks/refresh_achiever_local_templates.rake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ namespace :achiever do
3232
end
3333

3434
resources = [
35-
{path: Achiever::Course::Template::RESOURCE_PATH, params: Achiever::Course::Template::QUERY_STRINGS},
36-
{path: Achiever::Course::Occurrence::FACE_TO_FACE_RESOURCE_PATH, params: Achiever::Course::Occurrence::QUERY_STRINGS},
37-
{path: Achiever::Course::Occurrence::ONLINE_RESOURCE_PATH, params: Achiever::Course::Occurrence::QUERY_STRINGS},
35+
{path: Achiever::Course::Template::RESOURCE_PATH, params: Achiever::Course::Template::QUERY_STRINGS.merge(ProgrammeName: "ncce")},
36+
{path: Achiever::Course::Occurrence::FACE_TO_FACE_RESOURCE_PATH, params: Achiever::Course::Occurrence::QUERY_STRINGS.merge(ProgrammeName: "ncce", Date: Time.zone.today.strftime("%F"))},
37+
{path: Achiever::Course::Occurrence::ONLINE_RESOURCE_PATH, params: Achiever::Course::Occurrence::QUERY_STRINGS.merge(ProgrammeName: "ncce")},
3838
{path: Achiever::Course::OccurrenceDetails::RESOURCE_PATH, params: {
39-
Page: "1", RecordCount: "1000", ProgrammeName: "ncce", ID: "5e91e211-cd0a-ea11-a811-000d3a86d545"
39+
Page: "1", RecordCount: "1000", ID: "5e91e211-cd0a-ea11-a811-000d3a86d545"
4040
}}, # this is a random course
4141
{path: Achiever::Course::Delegate::RESOURCE_PATH, params: {
4242
Page: "1", RecordCount: "1000", ProgrammeName: "ncce", CONTACTNO: "89085e3f-d60e-eb11-a813-000d3a86f6ce"

spec/components/bordered_list_cards_component_spec.rb

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)