Permalink
Browse files

random method spec

  • Loading branch information...
1 parent 15f5ac2 commit 6c81c466f524a6c08d06e4bb052788610a69b826 @zapnap zapnap committed Feb 1, 2009
Showing with 7 additions and 0 deletions.
  1. +7 −0 spec/status_spec.rb
View
@@ -57,6 +57,13 @@
Status.first.twitter_id.should == 1002
end
+ specify 'should return random records' do
+ @statuses = [mock('Status 1'), mock('Status 2'), mock('Status 3')]
+ Status.should_receive(:all).with(:limit => 3).and_return(@statuses)
+ @statuses.should_receive(:randomize).and_return(@statuses.reverse)
+ Status.random(2, :limit => 3).should == @statuses.reverse.slice(0,2)
+ end
+
describe 'when updating from Twitter' do
before(:each) do
Twitter::Search.stub!(:new).and_return([@status_data = status_data])

0 comments on commit 6c81c46

Please sign in to comment.