Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

If your CreateEvent has a compare URL, it's probably a commit. #11

Open
wants to merge 1 commit into from

2 participants

@pvande

This may be disproven in the future.

@dpiddy

Yeah! This is costing me! I'm ruined!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 2, 2011
  1. @pvande

    If your CreateEvent has a compare link, it probably counts.

    pvande authored
    This may be disproven in the future.
This page is out of date. Refresh to see the latest.
View
10 lib/seinfeld/feed.rb
@@ -93,8 +93,14 @@ def committed_days
# Returns true if the entry is a commit, and false if it isn't.
def self.committed?(item)
type = item['type']
- VALID_EVENTS.include?(type) || (
- type == 'CreateEvent' && item['payload'] && item['payload']['object'] == 'branch')
+
+ return true if VALID_EVENTS.include?(type)
+ if type == 'CreateEvent'
+ return true if item['payload'] && item['payload']['object'] == 'branch'
+ return true if item['url'] && item['url'] =~ %r[/compare/]
+ end
+
+ return false
end
def inspect
View
5 test/feed_test.rb
@@ -14,7 +14,7 @@ class FeedTest < ActiveSupport::TestCase
end
test "parses atom entries" do
- assert_equal 8, @feed.items.size
+ assert_equal 9, @feed.items.size
end
test "parses entry published timestamp" do
@@ -26,6 +26,7 @@ class FeedTest < ActiveSupport::TestCase
Date.civil(2009, 12, 19),
Date.civil(2009, 12, 17),
Date.civil(2009, 12, 16),
- Date.civil(2009, 12, 15)], @feed.committed_days
+ Date.civil(2009, 12, 15),
+ Date.civil(2009, 12, 12)], @feed.committed_days
end
end
View
5 test/feeds/simple.json
@@ -14,4 +14,7 @@
{"created_at":"2009/12/14 14:42:13 -0800",
"type":"PublicEvent"},
{"created_at":"2009/12/13 14:42:13 -0800",
- "type":"WikiEvent"}]
+ "type":"WikiEvent"},
+ {"created_at":"2009/12/12 14:42:13 -0800",
+ "url":"https://github.com/entp/seinfeld/compare/master",
+ "type":"CreateEvent"}]
View
5 test/updater_test.rb
@@ -33,7 +33,7 @@ class UpdaterTest < ActiveSupport::TestCase
end
test "parses atom entries" do
- assert_equal 8, @feed.items.size
+ assert_equal 9, @feed.items.size
end
test "parses entry published timestamp" do
@@ -45,6 +45,7 @@ class UpdaterTest < ActiveSupport::TestCase
Date.civil(2009, 12, 19),
Date.civil(2009, 12, 17),
Date.civil(2009, 12, 16),
- Date.civil(2009, 12, 15)], @feed.committed_days
+ Date.civil(2009, 12, 15),
+ Date.civil(2009, 12, 12)], @feed.committed_days
end
end
Something went wrong with that request. Please try again.