From 5f19e7e7993d90ef0de37c25f06122499469465a Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 21 Feb 2024 11:57:45 -0500 Subject: [PATCH] Add basic coverage for `ProcessHashtagsService` class (#29320) --- spec/services/process_hashtags_service_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 spec/services/process_hashtags_service_spec.rb diff --git a/spec/services/process_hashtags_service_spec.rb b/spec/services/process_hashtags_service_spec.rb new file mode 100644 index 000000000..a0d5ef346 --- /dev/null +++ b/spec/services/process_hashtags_service_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe ProcessHashtagsService do + describe '#call' do + let(:status) { Fabricate(:status, visibility: :public, text: 'With tags #one #two') } + + it 'applies the tags from the status text' do + expect { subject.call(status) } + .to change(Tag, :count).by(2) + expect(status.reload.tags.map(&:name)) + .to contain_exactly('one', 'two') + end + end +end