このコミットが含まれているのは:
@@ -4,6 +4,7 @@ RSpec.describe PostBulkCreator do
|
||||
include_context 'English locale'
|
||||
|
||||
it 'limits workers to two and keeps failures in their request slots' do
|
||||
locale = Locale.nipponese
|
||||
actor = instance_double(User, id: 123)
|
||||
allow(User).to receive(:find).with(123) {
|
||||
instance_double(User, id: 123)
|
||||
@@ -65,4 +66,26 @@ RSpec.describe PostBulkCreator do
|
||||
expect(results[2].dig(:post, :id)).to eq(3)
|
||||
expect(results[3].dig(:post, :id)).to eq(4)
|
||||
end
|
||||
|
||||
it 'passes a future English locale to preflight and creation in every worker' do
|
||||
pending '日本語以外の Locale 有効化は別課題で実装する'
|
||||
locale
|
||||
actor = instance_double(User, id: 123)
|
||||
allow(User).to receive(:find).with(123).and_return(actor)
|
||||
preflight = instance_double(PostCreatePreflight)
|
||||
creator = instance_double(PostCreator)
|
||||
post = instance_double(Post, id: 1)
|
||||
allow(PostCreatePreflight).to receive(:new).and_return(preflight)
|
||||
allow(preflight).to receive(:run).with(locale).and_return(existing_post_id: nil)
|
||||
allow(PostCreator).to receive(:new).and_return(creator)
|
||||
allow(creator).to receive(:create!).with(locale).and_return(post)
|
||||
|
||||
results = described_class.new(
|
||||
actor:, posts: [{ title: 'future post' }], thumbnails: { }).run(locale)
|
||||
|
||||
expect(results.fetch(:results)).to contain_exactly(
|
||||
hash_including(status: 'created', post: { id: 1 }))
|
||||
expect(preflight).to have_received(:run).with(locale).once
|
||||
expect(creator).to have_received(:create!).with(locale).once
|
||||
end
|
||||
end
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする