require 'spec_helper' module CampfireExport describe Message do include TimeZone before :each do @messages = Nokogiri::XML < 2012-05-11T17:45:00Z 111 222 TimestampMessage 2012-05-11T17:47:20Z 333 222 555 This is a tweet TweetMessage 20100487385931234 This is a tweet twitter_user avatar.jpg 2012-05-11T17:47:23Z 666 222 555 Regular message TextMessage XML Account.timezone = find_tzinfo("America/Los_Angeles") end context "when it is created" do it "sets up basic properties" do message = Message.new(@messages.xpath('/messages/message[3]')[0], nil, nil) message.body.should == "Regular message" message.id.should == "666" message.timestamp.should == "10:47 AM" end it "handles tweets correctly" do message = Message.new(@messages.xpath('/messages/message[2]'), nil, nil) message.body.should == "This is a tweet" message.id.should == "333" end end end end