gitalytics 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,86 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'test_helper.rb')
2
- require 'minitest/autorun'
3
- require 'gitalytics/user'
4
- require 'gitalytics/commit'
5
- require 'date'
6
-
7
- class TestUser < MiniTest::Unit::TestCase
8
-
9
- def setup
10
- @user = User.new('John Doe', 'john@doe.com')
11
- end
12
-
13
- def create_commit(hash, date, summary_data)
14
- Commit.new(hash).tap do |commit|
15
- commit.date = Date.parse(date)
16
- summary_data.each { |summary| commit.summary << summary }
17
- end
18
- end
19
-
20
- def create_commits(user)
21
- user.commits << create_commit('abcdef', '2000-01-10', [{ # weekday: 1
22
- filename: 'a.rb',
23
- insertions: 1,
24
- deletions: 0,
25
- }])
26
- user.commits << create_commit('abcdef', '2000-01-01', [{ # weekday: 6
27
- filename: 'c.rb',
28
- insertions: 0,
29
- deletions: 1,
30
- }])
31
- user.commits << create_commit('abcdef', '2000-01-01', [{ # weekday: 6
32
- filename: 'd.rb',
33
- insertions: 4,
34
- deletions: 5
35
- }])
36
- user.commits << create_commit('abcdef', '2000-01-08', [{ # weekday: 6
37
- filename: 'e.rb',
38
- insertions: 1,
39
- deletions: 1
40
- }])
41
- end
42
-
43
- def test_initial_color
44
- assert_match(/\d{1,3}, \d{1,3}, \d{1,3}/, @user.colors)
45
- end
46
-
47
- def test_gravatar_is_md5
48
- assert_match(/[a-f0-9]{32}/, @user.gravatar)
49
- end
50
-
51
- def test_first_commit
52
- create_commits(@user)
53
-
54
- assert_equal(Date.parse('2000-1-1'), @user.first_commit.date)
55
- end
56
-
57
- def test_last_commit
58
- create_commits(@user)
59
-
60
- assert_equal(Date.parse('2000-1-10'), @user.last_commit.date)
61
- end
62
-
63
- def test_working_days
64
- create_commits(@user)
65
-
66
- assert_equal(3, @user.working_days)
67
- end
68
-
69
- def test_weekday_commits
70
- create_commits(@user)
71
-
72
- assert_equal([0, 1, 0, 0, 0, 0, 3], @user.weekday_commits)
73
- end
74
-
75
- def test_total_insertions
76
- create_commits(@user)
77
-
78
- assert_equal(6, @user.total_insertions)
79
- end
80
-
81
- def test_total_deletions
82
- create_commits(@user)
83
-
84
- assert_equal(7, @user.total_deletions)
85
- end
86
- end
data/test/test_helper.rb DELETED
@@ -1,2 +0,0 @@
1
- require 'coveralls'
2
- Coveralls.wear!