Skip to content
Browse files

updated test

  • Loading branch information...
1 parent 4235361 commit 4eac96e4ae1413dd5ebfa0907e68abbbc8dda36b @paulca paulca committed Sep 25, 2008
Showing with 11 additions and 2 deletions.
  1. +1 −1 archived_latest.txt
  2. +6 −1 twitter2campfire.rb
  3. +4 −0 twitter2campfire_spec.rb
View
2 archived_latest.txt
@@ -1 +1 @@
-
+test
View
7 twitter2campfire.rb
@@ -20,6 +20,10 @@ def entries
(raw_feed/'entry').map { |e| OpenStruct.new(:from => (e/'name').inner_html, :text => (e/'title').inner_html, :link => (e/'link').first['href']) }
end
+ def new?
+ archived_latest == latest_tweet.text
+ end
+
def latest_tweet
entries.first
end
@@ -34,11 +38,12 @@ def archive_file
def archived_latest
archive_file >> (string ||= "")
+ string.strip
end
def publish_entries
+ return unless new?
entries.reverse.each do |entry|
- return if entry.text == archived_latest
room.speak "#{entry.from}: #{entry.text} #{entry.link}"
end
save_latest
View
4 twitter2campfire_spec.rb
@@ -16,4 +16,8 @@
it "should get the latest entry" do
(@t.raw_feed/'entry').first.should == 'stuff'
end
+
+ it "should get the archived latest" do
+ @t.archived_latest.should == 'test'
+ end
end

0 comments on commit 4eac96e

Please sign in to comment.
Something went wrong with that request. Please try again.