From 9e1c706ddb032d72936deb03dc625b706d07337f Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:28:55 +0100 Subject: [PATCH] Update tests --- .../lib/tasks/log_variable_definitions_spec.rb | 4 ++-- .../variable_definitions_service_spec.rb | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/spec/lib/tasks/log_variable_definitions_spec.rb b/spec/lib/tasks/log_variable_definitions_spec.rb index 57b379b1f..7fdeb66e4 100644 --- a/spec/lib/tasks/log_variable_definitions_spec.rb +++ b/spec/lib/tasks/log_variable_definitions_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "log_variable_definitions" do end it "adds CsvVariableDefinition records from each file in the specified directory" do - expect { task.invoke(path) }.to change(CsvVariableDefinition, :count).by(419) + expect { task.invoke(path) }.to change(CsvVariableDefinition, :count).by(416) end it "handles an empty directory without errors" do @@ -34,7 +34,7 @@ RSpec.describe "log_variable_definitions" do task.invoke(path) second_run_count = CsvVariableDefinition.count - expect(first_run_count).to eq(initial_count + 419) + expect(first_run_count).to eq(initial_count + 416) expect(second_run_count).to eq(first_run_count) end end diff --git a/spec/services/imports/variable_definitions_service_spec.rb b/spec/services/imports/variable_definitions_service_spec.rb index 3efcb0790..d509bb4ae 100644 --- a/spec/services/imports/variable_definitions_service_spec.rb +++ b/spec/services/imports/variable_definitions_service_spec.rb @@ -40,23 +40,5 @@ RSpec.describe Imports::VariableDefinitionsService, type: :service do }.to change(CsvVariableDefinition, :count).by(3) end end - - context "when existing record with user_type support" do - let!(:existing_record) { create(:csv_variable_definition, variable: "id", definition: "Log ID", log_type: "lettings", user_type: "support") } - - it "updates the user_type to user" do - service.send(:process_file, file) - expect(existing_record.reload.user_type).to eq("user") - end - end - - context "when existing record with user_type user" do - let!(:existing_record) { create(:csv_variable_definition, variable: "id", definition: "Log ID", log_type: "lettings", user_type: "user") } - - it "does not update the user_type" do - service.send(:process_file, file) - expect(existing_record.reload.user_type).to eq("user") - end - end end end