]> cat aescling's git repositories - mastodon.git/blobdiff - spec/validators/status_length_validator_spec.rb
Update twitter-text from 1.14 to 3.1.0 and fix toot character counting (#15382)
[mastodon.git] / spec / validators / status_length_validator_spec.rb
index 11e55f9335f184e73a6d4a81c30de8974107db2e..bef3f29f50c915b8c92a10c2a0ddef20d0c271a5 100644 (file)
@@ -42,6 +42,14 @@ describe StatusLengthValidator do
       expect(status.errors).to_not have_received(:add)
     end
 
+    it 'does not count non-autolinkable URLs as 23 characters flat' do
+      text   = ('a' * 476) + "http://#{'b' * 30}.com/example"
+      status = double(spoiler_text: '', text: text, errors: double(add: nil), local?: true, reblog?: false)
+
+      subject.validate(status)
+      expect(status.errors).to have_received(:add)
+    end
+
     it 'counts only the front part of remote usernames' do
       text   = ('a' * 475) + " @alice@#{'b' * 30}.com"
       status = double(spoiler_text: '', text: text, errors: double(add: nil), local?: true, reblog?: false)
This page took 0.030428 seconds and 3 git commands to generate.