Skip to content

Commit

Permalink
Fix twitter message length
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick Francois committed Oct 4, 2013
1 parent f6aa538 commit 677da43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/note.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions spec/models/note_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 677da43

Please sign in to comment.