aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-05-20 15:48:24 +0200
committerGareth Rees <gareth@mysociety.org>2015-05-20 15:48:24 +0200
commit7c78a102bc83a5d52c3bb477676035e3b4db7dfc (patch)
tree8b3204a08ecf658381297056a868143ffcfcab5e /spec
parentda706b6c05ee7d0be15b59cf0fdec7f6d3ed58ec (diff)
Add Comment#first_three_wordsuser_comment
This was a demo method for AlaveteliCon 2015
Diffstat (limited to 'spec')
-rw-r--r--spec/models/comment_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
new file mode 100644
index 000000000..804ce608f
--- /dev/null
+++ b/spec/models/comment_spec.rb
@@ -0,0 +1,14 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe Comment do
+
+ describe :first_three_words do
+
+ it 'returns the first three words of the comment body' do
+ comment = Comment.new(:body => 'Hello there Alaveteli technical people')
+ comment.first_three_words.should == 'Hello there Alaveteli'
+ end
+
+ end
+
+end