Commit 93f08ba0 authored by Robert Speicher's avatar Robert Speicher

Combine multiple expectations into one for shared system note example

These are all performing unique checks on the same object, so there's no
benefit to isolating them.
parent 24244d03
...@@ -13,37 +13,16 @@ describe SystemNoteService do ...@@ -13,37 +13,16 @@ describe SystemNoteService do
let(:expected_noteable) { noteable } let(:expected_noteable) { noteable }
let(:commit_count) { nil } let(:commit_count) { nil }
it 'is valid' do it 'has the correct attributes', :aggregate_failures do
expect(subject).to be_valid expect(subject).to be_valid
end expect(subject).to be_system
it 'sets the noteable model' do
expect(subject.noteable).to eq expected_noteable expect(subject.noteable).to eq expected_noteable
end
it 'sets the project' do
expect(subject.project).to eq project expect(subject.project).to eq project
end
it 'sets the author' do
expect(subject.author).to eq author expect(subject.author).to eq author
end
it 'is a system note' do expect(subject.system_note_metadata.action).to eq(action)
expect(subject).to be_system expect(subject.system_note_metadata.commit_count).to eq(commit_count)
end
context 'metadata' do
it 'creates a new system note metadata record' do
expect { subject }.to change { SystemNoteMetadata.count }.from(0).to(1)
end
it 'creates a record correctly' do
metadata = subject.system_note_metadata
expect(metadata.commit_count).to eq(commit_count)
expect(metadata.action).to eq(action)
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment