diff --git a/app/models/note.rb b/app/models/note.rb index fafce8121c..b2311ce6f1 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -53,7 +53,7 @@ def initialize(*args) end def twitter_message_max_length - 140 - (5 + self.redirects.first.to_url.length) + 140 - (7 + self.redirects.first.to_url.length) end def twitter_message diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index dd316de165..56b2be8a54 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -129,6 +129,7 @@ let(:tweet) { "\"JSFuck is an esoteric and educational programming style based on the atomic parts of JavaScript. It uses only six different characters to write and execute code.\" http://www.jsfuck.com/ " } it { expect(note.twitter_message).to start_with(tweet[0..note.twitter_message_max_length]) } + it { expect(note.twitter_message.length).to be <= 140 } it { expect(note.twitter_message).to end_with(" (#{note.redirects.first.to_url})") } end end