Skip to content

Commit

Permalink
fixup! Update Notable#all_notes
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Nov 20, 2024
1 parent ee40815 commit 6c53468
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions spec/models/concerns/notable_and_taggable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,31 @@
describe '#all_notes' do
subject { record.all_notes }

before { record.tag_string = 'foo:1' }

let!(:tagged_note) { FactoryBot.create(:note, notable_tag: 'foo') }
let!(:other_tagged_note) { FactoryBot.create(:note, notable_tag: 'bar') }

let!(:tagged_note_with_value) do
FactoryBot.create(:note, notable_tag: 'foo:1')
end

let!(:tagged_note_with_other_value) do
FactoryBot.create(:note, notable_tag: 'foo:2')
end

it { is_expected.to include tagged_note }
it { is_expected.to include tagged_note_with_value }
it { is_expected.to_not include other_tagged_note }
it { is_expected.to_not include tagged_note_with_other_value }
context 'with name tag' do
before { record.tag_string = 'foo' }
it { is_expected.to include tagged_note }
it { is_expected.to_not include tagged_note_with_value }
it { is_expected.to_not include other_tagged_note }
it { is_expected.to_not include tagged_note_with_other_value }
end

context 'with name:value tag' do
before { record.tag_string = 'foo:1' }
it { is_expected.to include tagged_note }
it { is_expected.to include tagged_note_with_value }
it { is_expected.to_not include other_tagged_note }
it { is_expected.to_not include tagged_note_with_other_value }
end
end
end

0 comments on commit 6c53468

Please sign in to comment.