Skip to content

Commit

Permalink
Test: ハッシュタグ使用量
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Oct 19, 2023
1 parent 72b9e81 commit 7a4712d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions spec/lib/activitypub/activity/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,49 @@
end
end
end

context 'when hashtags limit is set' do
let(:post_hash_tags_max) { 2 }
let(:custom_before) { true }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
tag: [
{
type: 'Hashtag',
href: 'http://example.com/blah',
name: '#test',
},
{
type: 'Hashtag',
href: 'http://example.com/blah2',
name: '#test2',
},
],
}
end

before do
Form::AdminSettings.new(post_hash_tags_max: post_hash_tags_max).save
subject.perform
end

context 'when limit is enough' do
it 'creates status' do
expect(sender.statuses.first).to_not be_nil
end
end

context 'when limit is over' do
let(:post_hash_tags_max) { 1 }

it 'creates status' do
expect(sender.statuses.first).to be_nil
end
end
end
end

context 'with an encrypted message' do
Expand Down

0 comments on commit 7a4712d

Please sign in to comment.