Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

Open
wants to merge 1 commit into from

2 participants

Pieter van de Bruggen Dan Peterson
Pieter van de Bruggen
pvande commented

This may be disproven in the future.

Dan Peterson
dpiddy commented

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

Showing 1 unique commit by 1 author.

Jun 02, 2011
Pieter van de Bruggen pvande If your CreateEvent has a compare link, it probably counts.
This may be disproven in the future.
5eb5115
This page is out of date. Refresh to see the latest.
10 lib/seinfeld/feed.rb
@@ -93,8 +93,14 @@ def committed_days
93 93 # Returns true if the entry is a commit, and false if it isn't.
94 94 def self.committed?(item)
95 95 type = item['type']
96   - VALID_EVENTS.include?(type) || (
97   - type == 'CreateEvent' && item['payload'] && item['payload']['object'] == 'branch')
  96 +
  97 + return true if VALID_EVENTS.include?(type)
  98 + if type == 'CreateEvent'
  99 + return true if item['payload'] && item['payload']['object'] == 'branch'
  100 + return true if item['url'] && item['url'] =~ %r[/compare/]
  101 + end
  102 +
  103 + return false
98 104 end
99 105
100 106 def inspect
5 test/feed_test.rb
@@ -14,7 +14,7 @@ class FeedTest < ActiveSupport::TestCase
14 14 end
15 15
16 16 test "parses atom entries" do
17   - assert_equal 8, @feed.items.size
  17 + assert_equal 9, @feed.items.size
18 18 end
19 19
20 20 test "parses entry published timestamp" do
@@ -26,6 +26,7 @@ class FeedTest < ActiveSupport::TestCase
26 26 Date.civil(2009, 12, 19),
27 27 Date.civil(2009, 12, 17),
28 28 Date.civil(2009, 12, 16),
29   - Date.civil(2009, 12, 15)], @feed.committed_days
  29 + Date.civil(2009, 12, 15),
  30 + Date.civil(2009, 12, 12)], @feed.committed_days
30 31 end
31 32 end
5 test/feeds/simple.json
@@ -14,4 +14,7 @@
14 14 {"created_at":"2009/12/14 14:42:13 -0800",
15 15 "type":"PublicEvent"},
16 16 {"created_at":"2009/12/13 14:42:13 -0800",
17   - "type":"WikiEvent"}]
  17 + "type":"WikiEvent"},
  18 + {"created_at":"2009/12/12 14:42:13 -0800",
  19 + "url":"https://github.com/entp/seinfeld/compare/master",
  20 + "type":"CreateEvent"}]
5 test/updater_test.rb
@@ -33,7 +33,7 @@ class UpdaterTest < ActiveSupport::TestCase
33 33 end
34 34
35 35 test "parses atom entries" do
36   - assert_equal 8, @feed.items.size
  36 + assert_equal 9, @feed.items.size
37 37 end
38 38
39 39 test "parses entry published timestamp" do
@@ -45,6 +45,7 @@ class UpdaterTest < ActiveSupport::TestCase
45 45 Date.civil(2009, 12, 19),
46 46 Date.civil(2009, 12, 17),
47 47 Date.civil(2009, 12, 16),
48   - Date.civil(2009, 12, 15)], @feed.committed_days
  48 + Date.civil(2009, 12, 15),
  49 + Date.civil(2009, 12, 12)], @feed.committed_days
49 50 end
50 51 end

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.