Skip to content

A platform for community discussion. Free, open, simple.

DEV: clean up dependencies in spec

Sam Saffron55ee9abecbac
diff --git a/lib/import_export.rb b/lib/import_export.rb
index f5abe5f1aa4..f86600253db 100644
--- a/lib/import_export.rb
+++ b/lib/import_export.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require "import_export/importer"
+require "import_export/base_exporter"
require "import_export/category_structure_exporter"
require "import_export/category_exporter"
require "import_export/topic_exporter"
diff --git a/lib/import_export/base_exporter.rb b/lib/import_export/base_exporter.rb
index 9c63af42cb2..87ad104d5d0 100644
--- a/lib/import_export/base_exporter.rb
+++ b/lib/import_export/base_exporter.rb
@@ -2,7 +2,6 @@
module ImportExport
class BaseExporter
-
attr_reader :export_data, :categories
CATEGORY_ATTRS = [:id, :name, :color, :created_at, :user_id, :slug, :description, :text_color,
diff --git a/lib/import_export/category_structure_exporter.rb b/lib/import_export/category_structure_exporter.rb
index aa9e50c983e..ce33de39d39 100644
--- a/lib/import_export/category_structure_exporter.rb
+++ b/lib/import_export/category_structure_exporter.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "import_export/base_exporter"
-
module ImportExport
class CategoryStructureExporter < BaseExporter
diff --git a/spec/import_export/category_exporter_spec.rb b/spec/import_export/category_exporter_spec.rb
index 88657f646b5..07c63ec792f 100644
--- a/spec/import_export/category_exporter_spec.rb
+++ b/spec/import_export/category_exporter_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require "rails_helper"
-require "import_export/category_exporter"
+require "import_export"
describe ImportExport::CategoryExporter do
@@ -24,7 +24,7 @@ describe ImportExport::CategoryExporter do
end
it 'export the category with permission groups' do
- category_group = Fabricate(:category_group, category: category, group: group)
+ _category_group = Fabricate(:category_group, category: category, group: group)
data = ImportExport::CategoryExporter.new([category.id]).perform.export_data
expect(data[:categories].count).to eq(1)
@@ -33,7 +33,7 @@ describe ImportExport::CategoryExporter do
it 'export multiple categories' do
category2 = Fabricate(:category)
- category_group = Fabricate(:category_group, category: category, group: group)
+ _category_group = Fabricate(:category_group, category: category, group: group)
data = ImportExport::CategoryExporter.new([category.id, category2.id]).perform.export_data
expect(data[:categories].count).to eq(2)
@@ -45,8 +45,8 @@ describe ImportExport::CategoryExporter do
Fabricate(:post, topic: topic1, user: User.find(-1), post_number: 1)
topic2 = Fabricate(:topic, category: category, user: user)
Fabricate(:post, topic: topic2, user: user, post_number: 1)
- reply1 = Fabricate(:post, topic: topic2, user: user2, post_number: 2)
- reply2 = Fabricate(:post, topic: topic2, user: user3, post_number: 3)
+ _reply1 = Fabricate(:post, topic: topic2, user: user2, post_number: 2)
+ _reply2 = Fabricate(:post, topic: topic2, user: user3, post_number: 3)
data = ImportExport::CategoryExporter.new([category.id]).perform.export_data
expect(data[:categories].count).to eq(1)
diff --git a/spec/import_export/importer_spec.rb b/spec/import_export/importer_spec.rb
index 14e747eca57..259821db8b7 100644
--- a/spec/import_export/importer_spec.rb
+++ b/spec/import_export/importer_spec.rb
@@ -1,9 +1,7 @@
# frozen_string_literal: true
require "rails_helper"
-require "import_export/category_exporter"
-require "import_export/category_structure_exporter"
-require "import_export/importer"
+require "import_export"
describe ImportExport::Importer do
@@ -13,7 +11,7 @@ describe ImportExport::Importer do
let(:import_data) do
import_file = Rack::Test::UploadedFile.new(file_from_fixtures("import-export.json", "json"))
- data = ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(import_file.read))
+ ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(import_file.read))
end
def import(data)
diff --git a/spec/import_export/topic_exporter_spec.rb b/spec/import_export/topic_exporter_spec.rb
index d216846fa80..134b910065b 100644
--- a/spec/import_export/topic_exporter_spec.rb
+++ b/spec/import_export/topic_exporter_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require "rails_helper"
-require "import_export/topic_exporter"
+require "import_export"
describe ImportExport::TopicExporter do
@@ -25,7 +25,7 @@ describe ImportExport::TopicExporter do
it 'export multiple topics' do
topic2 = Fabricate(:topic, user: user)
- post2 = Fabricate(:post, user: user, topic: topic2)
+ _post2 = Fabricate(:post, user: user, topic: topic2)
data = ImportExport::TopicExporter.new([topic.id, topic2.id]).perform.export_data
expect(data[:categories].blank?).to eq(true)
diff --git a/spec/lib/backup_restore/s3_backup_store_spec.rb b/spec/lib/backup_restore/s3_backup_store_spec.rb
index 312c396fa38..fb9e16f1c34 100644
--- a/spec/lib/backup_restore/s3_backup_store_spec.rb
+++ b/spec/lib/backup_restore/s3_backup_store_spec.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'rails_helper'
+require 's3_helper'
require 'backup_restore/s3_backup_store'
require_relative 'shared_examples_for_backup_store'