Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix timing in specs

  • Loading branch information...
commit 0d96c9b591dc64b776efbf7238ba477f9e279b2d 1 parent f734135
@jamesu authored
View
2  parsers/talker_parser.rb
@@ -30,7 +30,7 @@ def parse_event(event)
room = event['room']
user = event['user']
base = {
- :occurred => Time.at(event['time'].to_i),
+ :occurred => Time.at(event['time'].to_i).utc,
:type => EVENTYPE_MAP[event['type']]||:event,
:source => "talker://#{room['name']}",
:content => event['content'],
View
10 spec/bip_spec.rb
@@ -20,7 +20,7 @@
event = @parser.parse_line("01-04-2010 11:41:28 < woot!~47e0bd37@someclient1: hello folks")
event[:type].should == :message
event[:content].should == "hello folks"
- event[:occurred].to_s.should == "Thu Apr 01 11:41:28 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 4, 1, 11, 41, 28).to_s
event[:sender][:ident].should == "~47e0bd37"
event[:sender][:host].should == "someclient1"
event[:sender][:name].should == "woot"
@@ -28,7 +28,7 @@
event = @parser.parse_line("01-04-2010 12:26:44 > Myself: haha")
event[:type].should == :message
event[:content].should == "haha"
- event[:occurred].to_s.should == "Thu Apr 01 12:26:44 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 4, 1, 12, 26, 44).to_s
event[:sender][:ident].should == "Myself"
event[:sender][:host].should == nil
event[:sender][:name].should == "Myself"
@@ -38,7 +38,7 @@
event = @parser.parse_line("01-04-2010 00:04:49 -!- LongWind!~long@some.other.server has quit [Quit: Leaving]")
event[:type].should == :userDisconnected
event[:content].should == "has quit [Quit: Leaving]"
- event[:occurred].to_s.should == "Thu Apr 01 00:04:49 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 4, 1, 0, 4, 49).to_s
event[:sender][:ident].should == "~long"
event[:sender][:host].should == "some.other.server"
event[:sender][:name].should == "LongWind"
@@ -46,7 +46,7 @@
event = @parser.parse_line("01-04-2010 11:08:12 -!- SoGot!|SoGot!~chatzilla@some.server.net has quit [Client closed connection]")
event[:type].should == :userDisconnected
event[:content].should == "has quit [Client closed connection]"
- event[:occurred].to_s.should == "Thu Apr 01 11:08:12 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 4, 1, 11, 8, 12).to_s
event[:sender][:ident].should == "|SoGot!~chatzilla"
event[:sender][:host].should == "some.server.net"
event[:sender][:name].should == "SoGot"
@@ -56,7 +56,7 @@
event = @parser.parse_line("01-04-2010 01:14:48 -!- wooter!~wooter@pool-party.net has joined #letstalk")
event[:type].should == :userAvailable
event[:content].should == "has joined #letstalk"
- event[:occurred].to_s.should == "Thu Apr 01 01:14:48 UTC 2010"
+ event[:occurred].to_s.should == Time.utc(2010, 4, 1, 1, 14, 48).to_s
event[:sender][:ident].should == "~wooter"
event[:sender][:host].should == "pool-party.net"
event[:sender][:name].should == "wooter"
View
4 spec/colloquy_spec.rb
@@ -25,7 +25,7 @@
event = @parser.parse_node(doc.children[0])
event[:type].should == :userDisconnected
event[:content].should == "JohnSmith disconnected from the server."
- event[:occurred].to_s.should == "Thu Sep 02 12:49:53 +0100 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 9, 2, 11, 49, 53).to_s
event[:sender].should == nil
end
@@ -34,7 +34,7 @@
event = @parser.parse_node(doc.children[0])
event[:type].should == :userAvailable
event[:content].should == "JohnSmith is now available."
- event[:occurred].to_s.should == "Thu Sep 02 16:30:17 +0100 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 9, 2, 15, 30, 17).to_s
event[:sender].should == nil
end
end
View
14 spec/ircii_spec.rb
@@ -24,7 +24,7 @@
event = @parser.parse_line("16:19 < Myself> yo woot")
event[:type].should == :message
event[:content].should == "yo woot"
- event[:occurred].to_s.should == "Wed Jan 06 16:19:00 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 1, 6, 16, 19, 0).to_s
event[:sender][:ident].should == "Myself"
event[:sender][:host].should == nil
event[:sender][:name].should == "Myself"
@@ -32,7 +32,7 @@
event = @parser.parse_line("16:23 < woot> lol why is that? what did you expect?")
event[:type].should == :message
event[:content].should == "lol why is that? what did you expect?"
- event[:occurred].to_s.should == "Wed Jan 06 16:23:00 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 1, 6, 16, 23, 0).to_s
event[:sender][:ident].should == "woot"
event[:sender][:host].should == nil
event[:sender][:name].should == "woot"
@@ -41,15 +41,15 @@
it "should change the date according to the input" do
@parser.parse_line("--- Log opened Tue Jan 06 13:15:17 2009").should == nil
event = @parser.parse_line("16:19 < Myself> yo woot")
- event[:occurred].to_s.should == "Tue Jan 06 16:19:00 UTC 2009"
+ event[:occurred].utc.to_s.should == Time.utc(2009, 1, 6, 16, 19, 0).to_s
@parser.parse_line("--- Day changed Thu Jan 07 2010").should == nil
event = @parser.parse_line("16:23 < woot> lol why is that? what did you expect?")
- event[:occurred].to_s.should == "Thu Jan 07 16:23:00 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 1, 7, 16, 23, 0).to_s
@parser.parse_line("--- Log closed Wed Feb 24 21:15:50 2011").should == nil
event = @parser.parse_line("16:23 < woot> gonna go back to the future!")
- event[:occurred].to_s.should == "Thu Feb 24 16:23:00 UTC 2011"
+ event[:occurred].utc.to_s.should == Time.utc(2011, 2, 24, 16, 23, 0).to_s
end
it "should accept quit messages" do
@@ -57,7 +57,7 @@
event = @parser.parse_line("15:01 -!- Sick [~Sick@192.168.0.1] has quit [Ping timeout]")
event[:type].should == :userDisconnected
event[:content].should == "has quit [Ping timeout]"
- event[:occurred].to_s.should == "Wed Jan 06 15:01:00 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 1, 6, 15, 1, 0).to_s
event[:sender][:ident].should == "~Sick"
event[:sender][:host].should == "192.168.0.1"
event[:sender][:name].should == "Sick"
@@ -68,7 +68,7 @@
event = @parser.parse_line("15:16 -!- Sick [~Sick@192.168.0.1] has joined #letstalk")
event[:type].should == :userAvailable
event[:content].should == "has joined #letstalk"
- event[:occurred].to_s.should == "Wed Jan 06 15:16:00 UTC 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 1, 6, 15, 16, 0).to_s
event[:sender][:ident].should == "~Sick"
event[:sender][:host].should == "192.168.0.1"
event[:sender][:name].should == "Sick"
View
4 spec/talker_spec.rb
@@ -31,7 +31,7 @@
event[:type].should == :userDisconnected
event[:source].should == "talker://Main"
event[:content].should == "joined"
- event[:occurred].to_s.should == "Fri Apr 02 09:23:16 +0100 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 4, 2, 8, 23, 16).to_s
event[:sender][:name].should == 'fred'
end
@@ -42,7 +42,7 @@
event[:type].should == :userAvailable
event[:source].should == "talker://Main"
event[:content].should == "left"
- event[:occurred].to_s.should == "Fri Apr 02 09:20:30 +0100 2010"
+ event[:occurred].utc.to_s.should == Time.utc(2010, 4, 2, 8, 20, 30).to_s
event[:sender][:name].should == 'frodo'
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.