mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:49:06 +08:00
DEV: clean up dependencies in spec
Follow up on zeitwork we needed to be a bit more explicit about a few dependencies internally. On certain orders the test suite could fail.
This commit is contained in:
parent
3f6af54fe1
commit
55ee9abecb
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "import_export/base_exporter"
|
||||
|
||||
module ImportExport
|
||||
class CategoryStructureExporter < BaseExporter
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user