Reports Darcs patch record times in local timezone
Closes ChangesInTheFuture_
| 44 | id.sub(/@.*$/, '') | id.sub(/@.*$/, '') | 44 |
|---|---|---|---|
| 45 | end | end | 45 |
| 46 | 46 | ||
private | 47 | ||
| 48 | |||
| 47 | def time_from_darcs_date(date) | def time_from_darcs_date(date) | 49 |
| 48 | md = date.match(/(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/) | md = date.match(/(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/) | 50 |
| 49 | nums = md[1..6].collect do |s| s.to_i end | ns = md[1..6].map {|s| s.to_i} | 51 |
| 50 | Time.utc(nums[0], nums[1], nums[2], nums[3], nums[4], nums[5], nums[6]) | Time.utc(ns[0], ns[1], ns[2], ns[3], ns[4], ns[5], ns[6]).localtime | 52 |
| 51 | end | end | 53 |
| 52 | 54 | ||
| 53 | private | ||
| 54 | |||
| 55 | def parse_headlines(xml_input) | def parse_headlines(xml_input) | 55 |
| 56 | patches = REXML::Document.new(xml_input).root.elements || [] | patches = REXML::Document.new(xml_input).root.elements || [] | 56 |
| 57 | patches.collect do |patch_info| | patches.collect do |patch_info| | 57 |
| 45 | hl.rid | hl.rid | 45 |
|---|---|---|---|
| 46 | assert_equal 'darcs', hl.reported_by | assert_equal 'darcs', hl.reported_by | 46 |
| 47 | end | end | 47 |
| 48 | |||
def test_extracts_record_time_in_local_timezone | 49 | ||
@darcs_changes = P1 | 50 | ||
hl = @reporter.latest_headline | 51 | ||
| 52 | |||
t = Time.utc(2006, 7, 17, 20, 9, 39).localtime | 53 | ||
assert_equal t.day, hl.happened_at.day | 54 | ||
assert_equal t.hour, hl.happened_at.hour | 55 | ||
end | 56 | ||
| 48 | 57 | ||
| 49 | def test_fetches_headline_details | def test_fetches_headline_details | 58 |
| 50 | @darcs_changes = P1 | @darcs_changes = P1 | 59 |