Skip to content

Commit

Permalink
Add specs for Chewy importers (mastodon#24204)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Mar 22, 2023
1 parent 148c3d5 commit b179ff8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/lib/importer/accounts_index_importer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require 'rails_helper'

describe Importer::AccountsIndexImporter do
describe 'import!' do
let(:pool) { Concurrent::FixedThreadPool.new(5) }
let(:importer) { described_class.new(batch_size: 123, executor: pool) }

before { Fabricate(:account) }

it 'indexes relevant accounts' do
expect { importer.import! }.to update_index(AccountsIndex)
end
end
end
16 changes: 16 additions & 0 deletions spec/lib/importer/statuses_index_importer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require 'rails_helper'

describe Importer::StatusesIndexImporter do
describe 'import!' do
let(:pool) { Concurrent::FixedThreadPool.new(5) }
let(:importer) { described_class.new(batch_size: 123, executor: pool) }

before { Fabricate(:status) }

it 'indexes relevant statuses' do
expect { importer.import! }.to update_index(StatusesIndex)
end
end
end
16 changes: 16 additions & 0 deletions spec/lib/importer/tags_index_importer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require 'rails_helper'

describe Importer::TagsIndexImporter do
describe 'import!' do
let(:pool) { Concurrent::FixedThreadPool.new(5) }
let(:importer) { described_class.new(batch_size: 123, executor: pool) }

before { Fabricate(:tag) }

it 'indexes relevant tags' do
expect { importer.import! }.to update_index(TagsIndex)
end
end
end

0 comments on commit b179ff8

Please sign in to comment.