Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Default transcript date to today
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravi Gadad committed Apr 6, 2013
1 parent 8eeb35b commit 9e6ea1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tinder/room.rb
Expand Up @@ -197,7 +197,7 @@ def stop_listening
# Get the transcript for the given date (returns an array of messages parsed
# via #parse_message, see #parse_message for format of returned message)
#
def transcript(transcript_date)
def transcript(transcript_date = Date.today)
url = "/room/#{@id}/transcript/#{transcript_date.to_date.strftime('%Y/%m/%d')}.json"
connection.get(url)['messages'].map do |message|
parse_message(message)
Expand Down
9 changes: 9 additions & 0 deletions spec/tinder/room_spec.rb
Expand Up @@ -89,6 +89,15 @@ module EventMachine; def self.run; yield end end
@room.should_receive(:parse_message).exactly(2).times
@room.transcript(Date.parse('2012-10-15'))
end

it "should default to today's date" do
stub_connection(@connection) do |stub|
stub.get('/room/80749/transcript/1981/03/21.json') {[200, {}, fixture("rooms/recent.json")]}
end
Date.stub(:today).and_return(Date.parse('1981-03-21'))
@room.should_receive(:parse_message).exactly(2).times
@room.transcript
end
end

describe "unlock" do
Expand Down

0 comments on commit 9e6ea1b

Please sign in to comment.