Skip to content

Commit a9f24be

Browse files
authored
Merge pull request #2694 from govuk-forms/remove-code-to-add-forms-to-default-group
Remove DefaultGroupService
2 parents 0139a4e + 9058e46 commit a9f24be

8 files changed

Lines changed: 0 additions & 251 deletions

File tree

app/controllers/account/names_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def update
1313
@name_input = NameInput.new(account_name_input_params(current_user))
1414

1515
if @name_input.submit
16-
DefaultGroupService.new.create_user_default_trial_group!(current_user)
1716
redirect_to next_path
1817
else
1918
render :edit, status: :unprocessable_content

app/controllers/account/organisations_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def update
1313
@organisation_input = OrganisationInput.new(account_organisation_input_params(current_user))
1414

1515
if @organisation_input.submit
16-
DefaultGroupService.new.create_user_default_trial_group!(current_user)
1716
redirect_to next_path
1817
else
1918
render :edit, status: :unprocessable_content

app/services/default_group_service.rb

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

lib/tasks/groups.rake

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
namespace :groups do
2-
desc "Create default trial group for user who has forms not in a group"
3-
task :create_user_default_trial_group, %i[user_id] => :environment do |_, args|
4-
usage_message = "usage: rake create_user_default_trial_group[<user_id>]".freeze
5-
abort usage_message if args[:user_id].blank?
6-
7-
user = User.find(args[:user_id])
8-
DefaultGroupService.new.create_user_default_trial_group!(user)
9-
end
10-
112
desc "Move all groups in one organisation to another"
123
task :move_all_groups_between_organisations, %i[source_organisation_id target_organisation_id] => :environment do |_, args|
134
task_name = "groups:move_all_groups_between_organisations"

spec/features/account/complete_user_account_spec.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
feature "Add account organisation to user without organisation", type: :feature do
44
let(:user) { create :user, :with_no_org, name: nil, terms_agreed_at: nil }
55
let!(:organisation) { create :organisation }
6-
let(:form_name) { "a form I created when I didn't have an organisation" }
76

87
before do
98
OmniAuth.config.test_mode = true
@@ -13,8 +12,6 @@
1312
)
1413

1514
allow(Settings).to receive(:auth_provider).and_return("auth0")
16-
17-
create(:form, creator_id: user.id, name: form_name, created_at: "2024-10-08T07:31:15.762Z")
1815
end
1916

2017
after do
@@ -33,8 +30,6 @@
3330
then_i_should_be_redirected_to_the_account_terms_of_use_page
3431
and_i_agree_to_the_terms_of_use
3532
then_i_should_be_redirected_to_my_original_destination
36-
and_i_open_my_default_group
37-
and_i_can_open_my_form
3833
end
3934

4035
private
@@ -77,13 +72,4 @@ def and_i_fill_in_my_name
7772
def then_i_should_be_redirected_to_my_original_destination
7873
expect(page).to have_current_path(groups_path)
7974
end
80-
81-
def and_i_open_my_default_group
82-
click_link("John Doe’s trial group")
83-
end
84-
85-
def and_i_can_open_my_form
86-
click_link("a form I created when I didn't have an organisation")
87-
expect(page.find("h1")).to have_text "a form I created when I didn't have an organisation"
88-
end
8975
end

spec/requests/account/names_controller_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@
3333
describe "PUT #update" do
3434
context "with valid params" do
3535
let(:valid_params) { { account_name_input: { name: "John Doe" } } }
36-
let(:default_group_service) { instance_spy(DefaultGroupService) }
3736

3837
before do
3938
# rubocop:disable RSpec/AnyInstance
4039
allow_any_instance_of(AfterSignInPathHelper).to receive(:after_sign_in_next_path).and_return("/next-path")
4140
# rubocop:enable RSpec/AnyInstance
42-
allow(DefaultGroupService).to receive(:new).and_return(default_group_service)
4341
end
4442

4543
it "updates the user's name" do
@@ -51,11 +49,6 @@
5149
put account_name_path, params: valid_params
5250
expect(response).to redirect_to("/next-path")
5351
end
54-
55-
it "calls create_user_default_trial_group!" do
56-
put account_name_path, params: valid_params
57-
expect(default_group_service).to have_received(:create_user_default_trial_group!)
58-
end
5952
end
6053

6154
context "with invalid params" do

spec/requests/account/organisations_controller_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@
3434
context "with valid parameters" do
3535
let(:organisation) { create(:organisation) }
3636
let(:valid_params) { { account_organisation_input: { organisation_id: organisation.id } } }
37-
let(:default_group_service) { instance_spy(DefaultGroupService) }
3837

3938
before do
4039
# rubocop:disable RSpec/AnyInstance
4140
allow_any_instance_of(AfterSignInPathHelper).to receive(:after_sign_in_next_path).and_return("/next-path")
4241
# rubocop:enable RSpec/AnyInstance
43-
allow(DefaultGroupService).to receive(:new).and_return(default_group_service)
4442
end
4543

4644
it "updates the user's organisation" do
@@ -52,11 +50,6 @@
5250
put account_organisation_path, params: valid_params
5351
expect(response).to redirect_to("/next-path")
5452
end
55-
56-
it "calls create_user_default_trial_group!" do
57-
put account_organisation_path, params: valid_params
58-
expect(default_group_service).to have_received(:create_user_default_trial_group!)
59-
end
6053
end
6154

6255
context "with invalid parameters" do

spec/services/default_group_service_spec.rb

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

0 commit comments

Comments
 (0)