Skip to content

Commit

Permalink
[CRIMAPP-293] Remove work streams feature flag (#507)
Browse files Browse the repository at this point in the history
* Remove work streams ff

* Fix authorisation spec following rebase

* Fix linting error

* Remove work steam feature flag from spec file
  • Loading branch information
hiboabd authored Jan 4, 2024
1 parent a36dcb6 commit 1b86244
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 152 deletions.
6 changes: 1 addition & 5 deletions app/controllers/concerns/work_streamable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def require_app_work_stream
end

def work_stream_filter
if FeatureFlags.work_stream.enabled?
[current_work_stream]
else
WorkStream.all
end
[current_work_stream]
end
end
1 change: 0 additions & 1 deletion app/models/concerns/user_competence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def work_streams
def competencies
return Types::CompetencyType.values if supervisor?
return [] if data_analyst?
return Types::CompetencyType.values unless FeatureFlags.work_stream.enabled?

@competencies ||= Allocating.user_competencies(id)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
<td class="govuk-table__cell">
<%= crime_application.reference %>
</td>
<% if FeatureFlags.work_stream.enabled? %>
<td class="govuk-table__cell">
<%= label_text(crime_application.work_stream) %>
</td>
<% end %>
<td class="govuk-table__cell">
<%= label_text(crime_application.work_stream) %>
</td>
<td class="govuk-table__cell">
<%= l(crime_application.submitted_at) %>
</td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/casework/assigned_applications/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
head.with_row do |row|
row.with_cell(colname: :applicant_name)
row.with_cell(colname: :reference)
row.with_cell(colname: :work_stream) if FeatureFlags.work_stream.enabled?
row.with_cell(colname: :work_stream)
row.with_cell(colname: :submitted_at)
row.with_cell(colname: :submitted_at, text: sanitize(thead_text(:time_passed)))
end
Expand Down
29 changes: 12 additions & 17 deletions app/views/casework/crime_applications/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@
<%= t("casework.crime_applications.index.#{action_name}_heading") %>
</h1>

<% if FeatureFlags.work_stream.enabled? %>
<div class="govuk-tabs">
<ul class="govuk-tabs__list" role="tablist">
<% current_user.work_streams.each do |work_stream| %>
<% css_class = %w[govuk-tabs__list-item govuk-tabs__list-item--selected] %>
<%= content_tag(:li, class: work_stream == current_work_stream ? css_class : css_class.first) do %>
<%= link_to(work_stream.label, url_for(work_stream:), class: 'govuk-tabs__tab') %>
<% end %>
<div class="govuk-tabs">
<ul class="govuk-tabs__list" role="tablist">
<% current_user.work_streams.each do |work_stream| %>
<% css_class = %w[govuk-tabs__list-item govuk-tabs__list-item--selected] %>
<%= content_tag(:li, class: work_stream == current_work_stream ? css_class : css_class.first) do %>
<%= link_to(work_stream.label, url_for(work_stream:), class: 'govuk-tabs__tab') %>
<% end %>
</ul>
<% end %>
</ul>

<div class=govuk-tabs__panel>
<%= render partial: 'open_closed_applications',
locals: { action_name: action_name, search: @search, report_type: @report_type } %>
</div>
<div class=govuk-tabs__panel>
<%= render partial: 'open_closed_applications',
locals: { action_name: action_name, search: @search, report_type: @report_type } %>
</div>
<% else %>
<%= render partial: 'open_closed_applications',
locals: { action_name: action_name, search: @search, report_type: @report_type } %>
<% end %>
</div>
4 changes: 0 additions & 4 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ feature_flags:
local: false
staging: true
production: false # user managers should not access the service in production
work_stream:
local: true
staging: true
production: true
means_journey:
local: true
staging: true
Expand Down
12 changes: 0 additions & 12 deletions spec/models/concerns/user_competence_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@
expect(competencies).to be_empty
end
end

context 'when work stream feature flag is disabled' do
before do
allow(FeatureFlags).to receive(:work_stream) {
instance_double(FeatureFlags::EnabledFeature, enabled?: false)
}
end

it 'returns all work_streams regardless of competencies' do
expect(competencies).to eq %w[criminal_applications_team criminal_applications_team_2 extradition]
end
end
end
end
end
6 changes: 0 additions & 6 deletions spec/requests/authorisation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@

include Devise::Test::IntegrationHelpers

before do
allow(FeatureFlags).to receive(:work_stream) {
instance_double(FeatureFlags::EnabledFeature, enabled?: false)
}
end

def expected_status(route_name)
case route_name
when 'users_auth_failure', 'forbidden'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,6 @@
expect(page).to have_content 'Open applications'
expect(page).to have_current_path '/applications/open'
end

context 'when work stream feature flag in is not enabled' do
before do
allow(FeatureFlags).to receive(:work_stream) {
instance_double(FeatureFlags::EnabledFeature, enabled?: false)
}
visit '/'
end

it 'takes you to open applications path when you click "open applications"' do
click_on('Open applications')
expect(page).to have_current_path '/applications/open'
end
end
end

context 'when an assigned application is not found on the datastore' do
Expand Down
70 changes: 24 additions & 46 deletions spec/system/casework/closed_applications_dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,12 @@
]
end

let(:work_stream_flag_enabled) { true }

let(:user_id) { current_user_id }

before do
visit '/'
click_on 'open applications'

allow(FeatureFlags).to receive(:work_stream) {
instance_double(FeatureFlags::EnabledFeature, enabled?: work_stream_flag_enabled)
}

return_details = ReturnDetails.new(
reason: ReturnDetails::RETURN_REASONS.first,
details: 'Detailed reason'
Expand All @@ -47,18 +41,6 @@
click_on 'Closed applications'
end

context 'when work stream feature flag disabled' do
let(:work_stream_flag_enabled) { false }

it 'shows only closed applications' do
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['closed'],
work_stream: %w[criminal_applications_team criminal_applications_team_2 extradition] },
sorting: ApplicationSearchSorting.new(sort_by: 'reviewed_at', sort_direction: 'descending')
)
end
end

it 'includes the page title' do
expect(page).to have_content I18n.t('casework.crime_applications.index.closed_title')
end
Expand Down Expand Up @@ -104,40 +86,36 @@
end

context 'when work stream feature flag is enabled' do
let(:work_stream_flag_enabled) { true }

it 'includes tabs for work streams' do
tabs = find(:xpath, "//div[@class='govuk-tabs']")

expect(tabs).to have_content 'CAT 1 CAT 2 Extradition'
end

context 'when viewing closed applications by work stream' do
it 'searches for extradition closed applications' do
click_on 'Extradition'
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['closed'], work_stream: %w[extradition] },
sorting: ApplicationSearchSorting.new(sort_by: 'reviewed_at', sort_direction: 'descending')
)
end

it 'searches for CAT 2 closed applications' do
click_on 'CAT 2'
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['closed'], work_stream: %w[criminal_applications_team_2] },
sorting: ApplicationSearchSorting.new(sort_by: 'reviewed_at', sort_direction: 'descending')
)
end

it 'searches for CAT 1 closed applications' do
click_on 'CAT 1'
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['closed'],
work_stream: %w[criminal_applications_team] },
sorting: ApplicationSearchSorting.new(sort_by: 'reviewed_at', sort_direction: 'descending'),
number_of_times: 2
)
end
it 'searches for extradition closed applications' do
click_on 'Extradition'
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['closed'], work_stream: %w[extradition] },
sorting: ApplicationSearchSorting.new(sort_by: 'reviewed_at', sort_direction: 'descending')
)
end

it 'searches for CAT 2 closed applications' do
click_on 'CAT 2'
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['closed'], work_stream: %w[criminal_applications_team_2] },
sorting: ApplicationSearchSorting.new(sort_by: 'reviewed_at', sort_direction: 'descending')
)
end

it 'searches for CAT 1 closed applications' do
click_on 'CAT 1'
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['closed'],
work_stream: %w[criminal_applications_team] },
sorting: ApplicationSearchSorting.new(sort_by: 'reviewed_at', sort_direction: 'descending'),
number_of_times: 2
)
end
end
end
4 changes: 0 additions & 4 deletions spec/system/casework/no_competencies_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

before do
visit '/'

allow(FeatureFlags).to receive(:work_stream) {
instance_double(FeatureFlags::EnabledFeature, enabled?: true)
}
end

context 'when navigating to application pages' do
Expand Down
18 changes: 0 additions & 18 deletions spec/system/casework/open_applications_dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,16 @@

RSpec.describe 'Open Applications' do
include_context 'with stubbed search'
let(:work_stream_flag_enabled) { true }
let(:report_turbo_link_work_stream_params) do
report_link = URI(page.find('turbo-frame#current_workload_report', visible: false)['src'])
CGI.parse(report_link.query)['work_streams[]']
end

before do
allow(FeatureFlags).to receive(:work_stream) {
instance_double(FeatureFlags::EnabledFeature, enabled?: work_stream_flag_enabled)
}

visit '/'
click_on 'Open applications'
end

context 'when work stream feature flag disabled' do
let(:work_stream_flag_enabled) { false }

it 'shows open applications from all streams' do
expect_datastore_to_have_been_searched_with(
{ review_status: Types::REVIEW_STATUS_GROUPS['open'],
work_stream: %w[criminal_applications_team criminal_applications_team_2 extradition] },
sorting: ApplicationSearchSorting.new(sort_by: 'submitted_at', sort_direction: 'ascending')
)
expect(report_turbo_link_work_stream_params).to eq %w[cat_1 cat_2 extradition]
end
end

it 'includes the page title' do
expect(page).to have_content I18n.t('casework.crime_applications.index.open_title')
end
Expand Down
19 changes: 0 additions & 19 deletions spec/system/casework/primary_nav_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,4 @@
expect(heading_text).to eq('Closed applications')
expect(page).to have_current_path '/applications/closed'
end

context 'when work stream feature flag in is not enabled' do
before do
allow(FeatureFlags).to receive(:work_stream) {
instance_double(FeatureFlags::EnabledFeature, enabled?: false)
}
visit '/'
end

it 'takes you to the open applications path when you click "Open applications"' do
click_on('Open applications')
expect(page).to have_current_path '/applications/open'
end

it 'takes you to the closed applications path when you click "Closed applications"' do
click_on('Closed applications')
expect(page).to have_current_path '/applications/closed'
end
end
end

0 comments on commit 1b86244

Please sign in to comment.