gitalytics 1.3.1 → 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,97 +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
- def setup
9
- @user = User.new('John ñ Doe', 'john@doe.com')
10
- end
11
-
12
- def create_commit(hash, date, summary_data)
13
- Commit.new(hash).tap do |commit|
14
- commit.date = Date.parse(date)
15
- summary_data.each { |summary| commit.summary << summary }
16
- end
17
- end
18
-
19
- def create_commits(user)
20
- user.commits << create_commit(
21
- 'abcdef',
22
- '2000-01-10',
23
- [{ filename: 'a.rb', insertions: 1, deletions: 0 }])
24
- user.commits << create_commit(
25
- 'abcdef',
26
- '2000-01-01',
27
- [{ filename: 'c.rb', insertions: 0, deletions: 1 }])
28
- user.commits << create_commit(
29
- 'abcdef',
30
- '2000-01-01',
31
- [{ filename: 'd.rb', insertions: 4, deletions: 5 }])
32
- user.commits << create_commit(
33
- 'abcdef',
34
- '2000-01-08',
35
- [{ filename: 'e.rb', insertions: 1, deletions: 1 }])
36
- end
37
-
38
- def test_initial_color
39
- assert_match(/\d{1,3}, \d{1,3}, \d{1,3}/, @user.colors)
40
- end
41
-
42
- def test_gravatar_is_md5
43
- assert_match(/[a-f0-9]{32}/, @user.gravatar)
44
- end
45
-
46
- def test_first_commit
47
- create_commits(@user)
48
-
49
- assert_equal(Date.parse('2000-1-1'), @user.first_commit.date)
50
- end
51
-
52
- def test_last_commit
53
- create_commits(@user)
54
-
55
- assert_equal(Date.parse('2000-1-10'), @user.last_commit.date)
56
- end
57
-
58
- def test_commits_period
59
- create_commits(@user)
60
-
61
- assert_equal(10, @user.commits_period)
62
- end
63
-
64
- def test_working_days
65
- create_commits(@user)
66
-
67
- assert_equal(3, @user.working_days)
68
- end
69
-
70
- def test_weekday_commits
71
- create_commits(@user)
72
-
73
- assert_equal([0, 1, 0, 0, 0, 0, 3], @user.weekday_commits)
74
- end
75
-
76
- def test_total_insertions
77
- create_commits(@user)
78
-
79
- assert_equal(6, @user.total_insertions)
80
- end
81
-
82
- def test_total_deletions
83
- create_commits(@user)
84
-
85
- assert_equal(7, @user.total_deletions)
86
- end
87
-
88
- def test_total_changes
89
- create_commits(@user)
90
-
91
- assert_equal(13, @user.total_changes)
92
- end
93
-
94
- def test_rgba
95
- assert_match(/rgba\(([\d]{,3}, ){3}1\)/, @user.rgba)
96
- end
97
- end
data/test/test_helper.rb DELETED
@@ -1,2 +0,0 @@
1
- require 'coveralls'
2
- Coveralls.wear!