0
0
Fork 0

Reduce RSpec/MultipleExpectations cop max to 8 (#25313)

This commit is contained in:
Matt Jankowski 2023-06-10 12:38:22 -04:00 committed by GitHub
parent b5675e265e
commit 62c996b52d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 172 additions and 106 deletions

View file

@ -152,22 +152,31 @@ RSpec.describe TranslateStatusService, type: :service do
describe 'status has poll' do
let(:poll) { Fabricate(:poll, options: %w(Blue Green)) }
it 'returns formatted poll options' do
source_texts = service.send(:source_texts)
expect(source_texts.size).to eq 3
expect(source_texts.values).to eq %w(<p>Hello</p> Blue Green)
context 'with source texts from the service' do
let!(:source_texts) { service.send(:source_texts) }
expect(source_texts.keys.first).to eq :content
it 'returns formatted poll options' do
expect(source_texts.size).to eq 3
expect(source_texts.values).to eq %w(<p>Hello</p> Blue Green)
end
option1 = source_texts.keys.second
expect(option1).to be_a Poll::Option
expect(option1.id).to eq '0'
expect(option1.title).to eq 'Blue'
it 'has a first key with content' do
expect(source_texts.keys.first).to eq :content
end
option2 = source_texts.keys.third
expect(option2).to be_a Poll::Option
expect(option2.id).to eq '1'
expect(option2.title).to eq 'Green'
it 'has the first option in the second key with correct options' do
option1 = source_texts.keys.second
expect(option1).to be_a Poll::Option
expect(option1.id).to eq '0'
expect(option1.title).to eq 'Blue'
end
it 'has the second option in the third key with correct options' do
option2 = source_texts.keys.third
expect(option2).to be_a Poll::Option
expect(option2.id).to eq '1'
expect(option2.title).to eq 'Green'
end
end
end