ohloh_scm 4.0.4 → 5.0.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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +14 -3
  3. data/.ruby-version +1 -1
  4. data/Dockerfile +8 -8
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +48 -33
  7. data/lib/ohloh_scm/activity.rb +1 -1
  8. data/lib/ohloh_scm/bzr/activity.rb +12 -12
  9. data/lib/ohloh_scm/bzr/validation.rb +1 -1
  10. data/lib/ohloh_scm/commit.rb +2 -4
  11. data/lib/ohloh_scm/core.rb +2 -1
  12. data/lib/ohloh_scm/cvs/activity.rb +74 -60
  13. data/lib/ohloh_scm/cvs/scm.rb +12 -12
  14. data/lib/ohloh_scm/cvs/status.rb +1 -1
  15. data/lib/ohloh_scm/cvs/validation.rb +5 -5
  16. data/lib/ohloh_scm/diff.rb +1 -1
  17. data/lib/ohloh_scm/factory.rb +7 -1
  18. data/lib/ohloh_scm/git/activity.rb +111 -55
  19. data/lib/ohloh_scm/git/scm.rb +6 -8
  20. data/lib/ohloh_scm/git/status.rb +1 -1
  21. data/lib/ohloh_scm/git/validation.rb +1 -1
  22. data/lib/ohloh_scm/git_svn/activity.rb +5 -5
  23. data/lib/ohloh_scm/git_svn/scm.rb +5 -5
  24. data/lib/ohloh_scm/hg/activity.rb +13 -13
  25. data/lib/ohloh_scm/hg/scm.rb +3 -3
  26. data/lib/ohloh_scm/hg/validation.rb +1 -1
  27. data/lib/ohloh_scm/parser/branch_number.rb +7 -6
  28. data/lib/ohloh_scm/parser/bzr_xml_parser.rb +15 -15
  29. data/lib/ohloh_scm/parser/cvs_parser.rb +7 -6
  30. data/lib/ohloh_scm/parser/git_parser.rb +18 -15
  31. data/lib/ohloh_scm/parser/hg_parser.rb +8 -6
  32. data/lib/ohloh_scm/parser/svn_parser.rb +7 -6
  33. data/lib/ohloh_scm/py_bridge/hg_client.rb +1 -1
  34. data/lib/ohloh_scm/svn/activity.rb +17 -18
  35. data/lib/ohloh_scm/svn/scm.rb +4 -6
  36. data/lib/ohloh_scm/svn/validation.rb +2 -2
  37. data/lib/ohloh_scm/system.rb +1 -1
  38. data/lib/ohloh_scm/validation.rb +4 -6
  39. data/lib/ohloh_scm/version.rb +1 -1
  40. data/ohloh_scm.gemspec +5 -5
  41. data/security.md +30 -0
  42. data/spec/.rubocop.yml +2 -5
  43. data/spec/benchmarks/process_spawn_benchmark.rb +1 -1
  44. data/spec/helpers/assert_scm_attr_helper.rb +4 -4
  45. data/spec/helpers/generic_helper.rb +2 -2
  46. data/spec/helpers/repository_helper.rb +1 -1
  47. data/spec/ohloh_scm/activity_spec.rb +2 -2
  48. data/spec/ohloh_scm/bzr/activity_spec.rb +60 -60
  49. data/spec/ohloh_scm/bzr/validation_spec.rb +1 -1
  50. data/spec/ohloh_scm/cvs/activity_spec.rb +20 -21
  51. data/spec/ohloh_scm/cvs/scm_spec.rb +36 -36
  52. data/spec/ohloh_scm/cvs/validation_spec.rb +4 -4
  53. data/spec/ohloh_scm/factory_spec.rb +2 -2
  54. data/spec/ohloh_scm/git/activity_spec.rb +111 -110
  55. data/spec/ohloh_scm/git/scm_spec.rb +11 -11
  56. data/spec/ohloh_scm/git/status_spec.rb +3 -3
  57. data/spec/ohloh_scm/git/validation_spec.rb +7 -7
  58. data/spec/ohloh_scm/git_svn/activity_spec.rb +14 -14
  59. data/spec/ohloh_scm/git_svn/scm_spec.rb +1 -1
  60. data/spec/ohloh_scm/hg/activity_spec.rb +99 -99
  61. data/spec/ohloh_scm/hg/scm_spec.rb +5 -5
  62. data/spec/ohloh_scm/hg/validation_spec.rb +1 -1
  63. data/spec/ohloh_scm/parser/array_writer_spec.rb +7 -7
  64. data/spec/ohloh_scm/parser/branch_number_spec.rb +3 -3
  65. data/spec/ohloh_scm/parser/cvs_parser_spec.rb +31 -31
  66. data/spec/ohloh_scm/parser/git_parser_spec.rb +29 -32
  67. data/spec/ohloh_scm/parser/hg_parser_spec.rb +60 -60
  68. data/spec/ohloh_scm/svn/activity_spec.rb +11 -12
  69. data/spec/ohloh_scm/svn/scm_spec.rb +24 -24
  70. data/spec/ohloh_scm/svn/validation_spec.rb +6 -6
  71. data/spec/ohloh_scm/svn_parser_spec.rb +29 -29
  72. data/spec/ohloh_scm/system_spec.rb +5 -5
  73. data/spec/ohloh_scm/version_spec.rb +1 -1
  74. data/spec/string_encoder_spec.rb +4 -4
  75. metadata +8 -81
@@ -9,7 +9,7 @@ describe 'Git::Activity' do
9
9
  git.activity.export(dir)
10
10
  entries = ['.', '..', '.gitignore', 'COPYING', 'Gemfile.lock', 'Godeps', 'README',
11
11
  'helloworld.c', 'makefile', 'nested', 'ohloh_token']
12
- Dir.entries(dir).sort.must_equal entries
12
+ assert_equal Dir.entries(dir).sort, entries
13
13
  end
14
14
  end
15
15
  end
@@ -17,16 +17,16 @@ describe 'Git::Activity' do
17
17
  it 'export must work the same for tag or commit_sha' do
18
18
  with_git_repository('git') do |git|
19
19
  tag_sha = 'f6e5a894ac4173f8f2a200f2c36df38a1e61121a'
20
- commit_sha = `cd #{ git.scm.url } && git show #{ tag_sha }`.slice(/commit (.+)$/, 1)
20
+ commit_sha = `cd #{git.scm.url} && git show #{tag_sha}`.slice(/commit (.+)$/, 1)
21
21
 
22
22
  Dir.mktmpdir('oh_scm_tag_') do |tag_dir|
23
23
  git.activity.export(tag_dir, tag_sha)
24
24
 
25
25
  Dir.mktmpdir('oh_scm_commit_') do |commit_dir|
26
26
  git.activity.export(commit_dir, commit_sha)
27
- `diff -rq #{ tag_dir } #{ commit_dir }`.must_be :empty?
28
- Dir.entries(commit_dir).sort.must_equal ['.', '..', '.gitignore', 'helloworld.c',
29
- 'makefile', 'ohloh_token']
27
+ assert_empty `diff -rq #{tag_dir} #{commit_dir}`
28
+ assert_equal Dir.entries(commit_dir).sort, ['.', '..', '.gitignore', 'helloworld.c',
29
+ 'makefile', 'ohloh_token']
30
30
  end
31
31
  end
32
32
  end
@@ -41,18 +41,18 @@ describe 'Git::Activity' do
41
41
  describe 'tags' do
42
42
  it 'scm test fixture must have dereferenced tags' do
43
43
  with_git_repository('git') do |git|
44
- tag_shas = `cd #{git.scm.url} && git tag --format='%(objectname)' | sed 's/refs\\/tags\\///'`.split(/\n/)
44
+ tag_shas = `cd #{git.scm.url} && git tag --format='%(objectname)' | sed 's/refs\\/tags\\///'`.split("\n")
45
45
  assert(tag_shas.any? { |sha| !git.activity.commit_tokens.include?(sha) })
46
46
  end
47
47
  end
48
48
 
49
49
  it 'must return repository tags' do
50
50
  with_git_repository('git') do |git|
51
- git.activity.tags.must_equal(
52
- [['v1.0.0', 'b6e9220c3cabe53a4ed7f32952aeaeb8a822603d', Time.parse('2016-07-31T07:58:30+05:30')],
53
- ['v1.1.0-lw', '2e9366dd7a786fdb35f211fff1c8ea05c51968b1', Time.parse('2006-06-11T11:34:17-07:00')],
54
- ['v2.1.0', '1df547800dcd168e589bb9b26b4039bff3a7f7e4', Time.parse('2006-07-14T16:07:15-07:00')]]
55
- )
51
+ assert_equal git.activity.tags,
52
+ [['v1.0.0', 'b6e9220c3cabe53a4ed7f32952aeaeb8a822603d', Time.parse('2016-07-31T07:58:30+05:30')],
53
+ ['v1.1.0-lw', '2e9366dd7a786fdb35f211fff1c8ea05c51968b1',
54
+ Time.parse('2006-06-11T11:34:17-07:00')],
55
+ ['v2.1.0', '1df547800dcd168e589bb9b26b4039bff3a7f7e4', Time.parse('2006-07-14T16:07:15-07:00')]]
56
56
  end
57
57
  end
58
58
 
@@ -65,14 +65,14 @@ describe 'Git::Activity' do
65
65
 
66
66
  it 'must be empty for repository with no tags' do
67
67
  with_git_repository('git_walk') do |git|
68
- git.activity.tags.must_be :empty?
68
+ assert_empty git.activity.tags
69
69
  end
70
70
  end
71
71
 
72
72
  it 'must work for a tag named master' do
73
73
  with_git_repository('git_with_master_tag') do |git|
74
- git.activity.tags.must_equal [['master', '4e95717ac8cff8cdb10d83398d3ac667a2cca341',
75
- Time.parse('2018-02-01T12:56:48+0530')]]
74
+ assert_equal git.activity.tags, [['master', '4e95717ac8cff8cdb10d83398d3ac667a2cca341',
75
+ Time.parse('2018-02-01T12:56:48+0530')]]
76
76
  end
77
77
  end
78
78
  end
@@ -80,8 +80,8 @@ describe 'Git::Activity' do
80
80
  it 'must return correct head' do
81
81
  with_git_repository('git') do |git|
82
82
  assert git.status.exist?
83
- git.activity.head_token.must_equal 'a2690f4471a0852723f0f0e95d97f7f1f3981639'
84
- git.activity.head.token.must_equal 'a2690f4471a0852723f0f0e95d97f7f1f3981639'
83
+ assert_equal git.activity.head_token, 'a2690f4471a0852723f0f0e95d97f7f1f3981639'
84
+ assert_equal git.activity.head.token, 'a2690f4471a0852723f0f0e95d97f7f1f3981639'
85
85
  assert git.activity.head.diffs.any?
86
86
  end
87
87
  end
@@ -94,53 +94,53 @@ describe 'Git::Activity' do
94
94
 
95
95
  it 'commit_count' do
96
96
  with_git_repository('git') do |git|
97
- git.activity.commit_count.must_equal 5
98
- git.activity.commit_count(after: 'b6e9220c3cabe53a4ed7f32952aeaeb8a822603d').must_equal 3
99
- git.activity.commit_count(after: '1df547800dcd168e589bb9b26b4039bff3a7f7e4').must_equal 1
97
+ assert_equal git.activity.commit_count, 5
98
+ assert_equal git.activity.commit_count(after: 'b6e9220c3cabe53a4ed7f32952aeaeb8a822603d'), 3
99
+ assert_equal git.activity.commit_count(after: '1df547800dcd168e589bb9b26b4039bff3a7f7e4'), 1
100
100
  end
101
101
  end
102
102
 
103
103
  it 'commit_tokens' do
104
104
  with_git_repository('git') do |git|
105
- git.activity.commit_tokens.must_equal %w[089c527c61235bd0793c49109b5bd34d439848c6
106
- b6e9220c3cabe53a4ed7f32952aeaeb8a822603d
107
- 2e9366dd7a786fdb35f211fff1c8ea05c51968b1
108
- 1df547800dcd168e589bb9b26b4039bff3a7f7e4
109
- a2690f4471a0852723f0f0e95d97f7f1f3981639]
105
+ assert_equal git.activity.commit_tokens, %w[089c527c61235bd0793c49109b5bd34d439848c6
106
+ b6e9220c3cabe53a4ed7f32952aeaeb8a822603d
107
+ 2e9366dd7a786fdb35f211fff1c8ea05c51968b1
108
+ 1df547800dcd168e589bb9b26b4039bff3a7f7e4
109
+ a2690f4471a0852723f0f0e95d97f7f1f3981639]
110
110
 
111
- git.activity.commit_tokens(after: '2e9366dd7a786fdb35f211fff1c8ea05c51968b1')
112
- .must_equal %w[1df547800dcd168e589bb9b26b4039bff3a7f7e4 a2690f4471a0852723f0f0e95d97f7f1f3981639]
111
+ assert_equal git.activity.commit_tokens(after: '2e9366dd7a786fdb35f211fff1c8ea05c51968b1'),
112
+ %w[1df547800dcd168e589bb9b26b4039bff3a7f7e4 a2690f4471a0852723f0f0e95d97f7f1f3981639]
113
113
 
114
- git.activity.commit_tokens(after: 'a2690f4471a0852723f0f0e95d97f7f1f3981639').must_be :empty?
114
+ assert_empty git.activity.commit_tokens(after: 'a2690f4471a0852723f0f0e95d97f7f1f3981639')
115
115
  end
116
116
  end
117
117
 
118
118
  it 'commits' do
119
119
  with_git_repository('git') do |git|
120
- git.activity.commits.collect(&:token).must_equal %w[089c527c61235bd0793c49109b5bd34d439848c6
121
- b6e9220c3cabe53a4ed7f32952aeaeb8a822603d
122
- 2e9366dd7a786fdb35f211fff1c8ea05c51968b1
123
- 1df547800dcd168e589bb9b26b4039bff3a7f7e4
124
- a2690f4471a0852723f0f0e95d97f7f1f3981639]
120
+ assert_equal git.activity.commits.collect(&:token), %w[089c527c61235bd0793c49109b5bd34d439848c6
121
+ b6e9220c3cabe53a4ed7f32952aeaeb8a822603d
122
+ 2e9366dd7a786fdb35f211fff1c8ea05c51968b1
123
+ 1df547800dcd168e589bb9b26b4039bff3a7f7e4
124
+ a2690f4471a0852723f0f0e95d97f7f1f3981639]
125
125
 
126
- git.activity.commits(after: '2e9366dd7a786fdb35f211fff1c8ea05c51968b1').collect(&:token)
127
- .must_equal %w[1df547800dcd168e589bb9b26b4039bff3a7f7e4 a2690f4471a0852723f0f0e95d97f7f1f3981639]
126
+ assert_equal git.activity.commits(after: '2e9366dd7a786fdb35f211fff1c8ea05c51968b1').collect(&:token),
127
+ %w[1df547800dcd168e589bb9b26b4039bff3a7f7e4 a2690f4471a0852723f0f0e95d97f7f1f3981639]
128
128
 
129
- git.activity.commits(after: 'a2690f4471a0852723f0f0e95d97f7f1f3981639').must_be :empty?
129
+ assert_empty git.activity.commits(after: 'a2690f4471a0852723f0f0e95d97f7f1f3981639')
130
130
  end
131
131
  end
132
132
 
133
133
  it 'commits for branch' do
134
134
  with_git_repository('git', 'develop') do |git|
135
- git.activity.commits.map(&:token).must_equal %w[089c527c61235bd0793c49109b5bd34d439848c6
136
- b6e9220c3cabe53a4ed7f32952aeaeb8a822603d
137
- 2e9366dd7a786fdb35f211fff1c8ea05c51968b1
138
- b4046b9a80fead62fa949232f2b87b0cb78fffcc]
135
+ assert_equal git.activity.commits.map(&:token), %w[089c527c61235bd0793c49109b5bd34d439848c6
136
+ b6e9220c3cabe53a4ed7f32952aeaeb8a822603d
137
+ 2e9366dd7a786fdb35f211fff1c8ea05c51968b1
138
+ b4046b9a80fead62fa949232f2b87b0cb78fffcc]
139
139
 
140
- git.activity.commits(after: '2e9366dd7a786fdb35f211fff1c8ea05c51968b1')
141
- .map(&:token).must_equal ['b4046b9a80fead62fa949232f2b87b0cb78fffcc']
140
+ assert_equal git.activity.commits(after: '2e9366dd7a786fdb35f211fff1c8ea05c51968b1')
141
+ .map(&:token), ['b4046b9a80fead62fa949232f2b87b0cb78fffcc']
142
142
 
143
- git.activity.commits(after: 'b4046b9a80fead62fa949232f2b87b0cb78fffcc').must_be :empty?
143
+ assert_empty git.activity.commits(after: 'b4046b9a80fead62fa949232f2b87b0cb78fffcc')
144
144
  end
145
145
  end
146
146
 
@@ -149,44 +149,44 @@ describe 'Git::Activity' do
149
149
  submodule_commits = %w[240375de181498b9a34d4bd328f2c87d2ade79f9
150
150
  b6a80291e49dc540bb78526f9b1aab1123c9fb0e]
151
151
 
152
- (git.activity.commit_tokens & submodule_commits).must_be :empty?
152
+ assert_empty(git.activity.commit_tokens & submodule_commits)
153
153
 
154
154
  diffs = git.activity.commits.map(&:diffs).reject(&:empty?).flatten
155
- diffs.map(&:path).must_equal ['A']
156
- diffs.map(&:sha1).must_equal ['f70f10e4db19068f79bc43844b49f3eece45c4e8']
155
+ assert_equal diffs.map(&:path), ['A']
156
+ assert_equal diffs.map(&:sha1), ['f70f10e4db19068f79bc43844b49f3eece45c4e8']
157
157
  end
158
158
  end
159
159
 
160
160
  it 'commit_count for trunk commits' do
161
161
  with_git_repository('git_dupe_delete') do |git|
162
- git.activity.commit_count(trunk_only: false).must_equal 4
163
- git.activity.commit_count(trunk_only: true).must_equal 3
162
+ assert_equal git.activity.commit_count(trunk_only: false), 4
163
+ assert_equal git.activity.commit_count(trunk_only: true), 3
164
164
  end
165
165
  end
166
166
 
167
167
  it 'commit tokens for trunk commits' do
168
168
  with_git_repository('git_dupe_delete') do |git|
169
- git.activity.commit_tokens(trunk_only: false).must_equal ['a0a2b8623941562031a7d7f95d984feb4a2d719c',
170
- 'ad6bb43112706c462e53a9a8a8cd3b05f8e9260f',
171
- '6126337d2497806528fd8657181d5d4afadd72a4', # On branch
172
- '41c4b1044ebffc968d363e5f5e883134e624f846']
169
+ assert_equal git.activity.commit_tokens(trunk_only: false),
170
+ ['a0a2b8623941562031a7d7f95d984feb4a2d719c', 'ad6bb43112706c462e53a9a8a8cd3b05f8e9260f',
171
+ '6126337d2497806528fd8657181d5d4afadd72a4', # On branch
172
+ '41c4b1044ebffc968d363e5f5e883134e624f846']
173
173
 
174
- git.activity.commit_tokens(trunk_only: true).must_equal ['a0a2b8623941562031a7d7f95d984feb4a2d719c',
175
- 'ad6bb43112706c462e53a9a8a8cd3b05f8e9260f',
176
- # '6126337d2497806528fd8657181d5d4afadd72a4' # On branch
177
- '41c4b1044ebffc968d363e5f5e883134e624f846']
174
+ assert_equal git.activity.commit_tokens(trunk_only: true),
175
+ ['a0a2b8623941562031a7d7f95d984feb4a2d719c', 'ad6bb43112706c462e53a9a8a8cd3b05f8e9260f',
176
+ # '6126337d2497806528fd8657181d5d4afadd72a4' # On branch
177
+ '41c4b1044ebffc968d363e5f5e883134e624f846']
178
178
  end
179
179
  end
180
180
 
181
181
  it 'commit tokens for trunk commits using after' do
182
182
  with_git_repository('git_dupe_delete') do |git|
183
- git.activity.commit_tokens(after: 'a0a2b8623941562031a7d7f95d984feb4a2d719c',
184
- trunk_only: true).must_equal %w[ad6bb43112706c462e53a9a8a8cd3b05f8e9260f
185
- 41c4b1044ebffc968d363e5f5e883134e624f846]
183
+ assert_equal git.activity.commit_tokens(after: 'a0a2b8623941562031a7d7f95d984feb4a2d719c',
184
+ trunk_only: true), %w[ad6bb43112706c462e53a9a8a8cd3b05f8e9260f
185
+ 41c4b1044ebffc968d363e5f5e883134e624f846]
186
186
 
187
187
  # All trunk commit_tokens, with :after == HEAD
188
- git.activity.commit_tokens(after: '41c4b1044ebffc968d363e5f5e883134e624f846',
189
- trunk_only: true).must_be :empty?
188
+ assert_empty git.activity.commit_tokens(after: '41c4b1044ebffc968d363e5f5e883134e624f846',
189
+ trunk_only: true)
190
190
  end
191
191
  end
192
192
 
@@ -194,24 +194,24 @@ describe 'Git::Activity' do
194
194
  # `git mv foo bar` results in a single R diff. Split it into A & D diffs.
195
195
  with_git_repository('git_with_mv') do |git|
196
196
  r_commit = git.activity.commits[-2]
197
- r_commit.message.strip.must_equal 'Ran: git mv foo bar'
198
- r_commit.diffs.map(&:action).must_equal %w[D A]
199
- r_commit.diffs.map(&:path).must_equal %w[foo bar]
197
+ assert_equal r_commit.message.strip, 'Ran: git mv foo bar'
198
+ assert_equal r_commit.diffs.map(&:action), %w[D A]
199
+ assert_equal r_commit.diffs.map(&:path), %w[foo bar]
200
200
 
201
201
  r_commit = git.activity.commits.last
202
- r_commit.message.strip.must_equal 'Ran: echo B >> bar; mv bar rab'
203
- r_commit.diffs.map(&:action).must_equal %w[D A]
204
- r_commit.diffs.map(&:path).must_equal %w[bar rab]
202
+ assert_equal r_commit.message.strip, 'Ran: echo B >> bar; mv bar rab'
203
+ assert_equal r_commit.diffs.map(&:action), %w[D A]
204
+ assert_equal r_commit.diffs.map(&:path), %w[bar rab]
205
205
  end
206
206
  end
207
207
 
208
208
  it 'trunk only commits' do
209
209
  with_git_repository('git_dupe_delete') do |git|
210
- git.activity.commits(trunk_only: true).collect(&:token).must_equal ['a0a2b8623941562031a7d7f95d984feb4a2d719c',
211
- 'ad6bb43112706c462e53a9a8a8cd3b05f8e9260f',
212
- # on a branch, hence excluded.
213
- # '6126337d2497806528fd8657181d5d4afadd72a4',
214
- '41c4b1044ebffc968d363e5f5e883134e624f846']
210
+ assert_equal git.activity.commits(trunk_only: true).collect(&:token),
211
+ ['a0a2b8623941562031a7d7f95d984feb4a2d719c', 'ad6bb43112706c462e53a9a8a8cd3b05f8e9260f',
212
+ # on a branch, hence excluded.
213
+ # '6126337d2497806528fd8657181d5d4afadd72a4',
214
+ '41c4b1044ebffc968d363e5f5e883134e624f846']
215
215
  end
216
216
  end
217
217
 
@@ -229,14 +229,14 @@ describe 'Git::Activity' do
229
229
  with_git_repository('git_with_null_merge') do |git|
230
230
  c = git.activity.verbose_commit('d3bd0bedbf4b197b2c4eb827e1ec4c35b834482f')
231
231
  # This commit's tree is identical to its parent's. Thus it should contain no diffs.
232
- c.diffs.must_equal []
232
+ assert_equal c.diffs, []
233
233
  end
234
234
  end
235
235
 
236
236
  it 'each commit with null merge' do
237
237
  with_git_repository('git_with_null_merge') do |git|
238
238
  git.activity.each_commit do |c|
239
- c.diffs.must_equal [] if c.token == 'd3bd0bedbf4b197b2c4eb827e1ec4c35b834482f'
239
+ assert_equal c.diffs, [] if c.token == 'd3bd0bedbf4b197b2c4eb827e1ec4c35b834482f'
240
240
  end
241
241
  end
242
242
  end
@@ -250,29 +250,29 @@ describe 'Git::Activity' do
250
250
  it 'safe_open_log_file must return text with valid encoding' do
251
251
  with_git_repository('git_with_invalid_encoding') do |git|
252
252
  git.activity.send(:safe_open_log_file) do |io|
253
- io.read.valid_encoding?.must_equal true
253
+ assert_equal io.read.valid_encoding?, true
254
254
  end
255
255
  end
256
256
  end
257
257
 
258
258
  it 'commit count when there is a tag named master' do
259
259
  with_git_repository('git_with_master_tag') do |git|
260
- git.activity.commit_count.must_equal 3
260
+ assert_equal git.activity.commit_count, 3
261
261
  end
262
262
  end
263
263
 
264
264
  it 'commit tokens when there is a tag named master' do
265
265
  with_git_repository('git_with_master_tag') do |git|
266
- git.activity.commit_tokens.must_equal %w[57b2bd30b7bae970cb3b374a0c05fd6ec3088ebf
267
- 4e95717ac8cff8cdb10d83398d3ac667a2cca341
268
- 34b8a99e6e5dd39bc36893f71e0ab1685668731f]
266
+ assert_equal git.activity.commit_tokens, %w[57b2bd30b7bae970cb3b374a0c05fd6ec3088ebf
267
+ 4e95717ac8cff8cdb10d83398d3ac667a2cca341
268
+ 34b8a99e6e5dd39bc36893f71e0ab1685668731f]
269
269
  end
270
270
  end
271
271
 
272
272
  it 'must cat file correctly' do
273
273
  with_git_repository('git') do |core|
274
274
  diff = OhlohScm::Diff.new(sha1: '4c734ad53b272c9b3d719f214372ac497ff6c068')
275
- core.activity.cat_file(nil, diff).must_equal <<-EXPECTED.gsub(/^ {8}/, '')
275
+ assert_equal core.activity.cat_file(nil, diff), <<-EXPECTED.gsub(/^ {8}/, '')
276
276
  /* Hello, World! */
277
277
  #include <stdio.h>
278
278
  main()
@@ -288,23 +288,23 @@ describe 'Git::Activity' do
288
288
  with_git_repository('git_walk') do |git|
289
289
  commit_tokens = CommitTokensHelper.new(git, commit_labels)
290
290
  # Full history to a commit
291
- commit_tokens.between(nil, :A).must_equal %i[A]
292
- commit_tokens.between(nil, :B).must_equal %i[A B]
293
- commit_tokens.between(nil, :C).must_equal %i[A B G H C]
294
- commit_tokens.between(nil, :D).must_equal %i[A B G H C I D]
295
- commit_tokens.between(nil, :G).must_equal %i[A G]
296
- commit_tokens.between(nil, :H).must_equal %i[A G H]
297
- commit_tokens.between(nil, :I).must_equal %i[A G H I]
298
- commit_tokens.between(nil, :J).must_equal %i[A G H I J]
291
+ assert_equal commit_tokens.between(nil, :A), %i[A]
292
+ assert_equal commit_tokens.between(nil, :B), %i[A B]
293
+ assert_equal commit_tokens.between(nil, :C), %i[A B G H C]
294
+ assert_equal commit_tokens.between(nil, :D), %i[A B G H C I D]
295
+ assert_equal commit_tokens.between(nil, :G), %i[A G]
296
+ assert_equal commit_tokens.between(nil, :H), %i[A G H]
297
+ assert_equal commit_tokens.between(nil, :I), %i[A G H I]
298
+ assert_equal commit_tokens.between(nil, :J), %i[A G H I J]
299
299
 
300
300
  # Limited history from one commit to another
301
- commit_tokens.between(:A, :A).must_be :empty?
302
- commit_tokens.between(:A, :B).must_equal %i[B]
303
- commit_tokens.between(:A, :C).must_equal %i[B G H C]
304
- commit_tokens.between(:A, :D).must_equal %i[B G H C I D]
305
- commit_tokens.between(:B, :D).must_equal %i[G H C I D]
306
- commit_tokens.between(:C, :D).must_equal %i[I D]
307
- commit_tokens.between(:G, :J).must_equal %i[H I J]
301
+ assert_empty commit_tokens.between(:A, :A)
302
+ assert_equal commit_tokens.between(:A, :B), %i[B]
303
+ assert_equal commit_tokens.between(:A, :C), %i[B G H C]
304
+ assert_equal commit_tokens.between(:A, :D), %i[B G H C I D]
305
+ assert_equal commit_tokens.between(:B, :D), %i[G H C I D]
306
+ assert_equal commit_tokens.between(:C, :D), %i[I D]
307
+ assert_equal commit_tokens.between(:G, :J), %i[H I J]
308
308
  end
309
309
  end
310
310
 
@@ -312,18 +312,18 @@ describe 'Git::Activity' do
312
312
  with_git_repository('git_walk') do |git|
313
313
  commit_tokens = CommitTokensHelper.new(git, commit_labels, trunk_only: true)
314
314
  # Full history to a commit
315
- commit_tokens.between(nil, :A).must_equal %i[A]
316
- commit_tokens.between(nil, :B).must_equal %i[A B]
317
- commit_tokens.between(nil, :C).must_equal %i[A B C]
318
- commit_tokens.between(nil, :D).must_equal %i[A B C D]
315
+ assert_equal commit_tokens.between(nil, :A), %i[A]
316
+ assert_equal commit_tokens.between(nil, :B), %i[A B]
317
+ assert_equal commit_tokens.between(nil, :C), %i[A B C]
318
+ assert_equal commit_tokens.between(nil, :D), %i[A B C D]
319
319
 
320
320
  # Limited history from one commit to another
321
- commit_tokens.between(:A, :A).must_be :empty?
322
- commit_tokens.between(:A, :B).must_equal %i[B]
323
- commit_tokens.between(:A, :C).must_equal %i[B C]
324
- commit_tokens.between(:A, :D).must_equal %i[B C D]
325
- commit_tokens.between(:B, :D).must_equal %i[C D]
326
- commit_tokens.between(:C, :D).must_equal %i[D]
321
+ assert_empty commit_tokens.between(:A, :A)
322
+ assert_equal commit_tokens.between(:A, :B), %i[B]
323
+ assert_equal commit_tokens.between(:A, :C), %i[B C]
324
+ assert_equal commit_tokens.between(:A, :D), %i[B C D]
325
+ assert_equal commit_tokens.between(:B, :D), %i[C D]
326
+ assert_equal commit_tokens.between(:C, :D), %i[D]
327
327
  end
328
328
  end
329
329
 
@@ -333,8 +333,9 @@ describe 'Git::Activity' do
333
333
 
334
334
  core.activity.send(:init_db)
335
335
  refute core.activity.send(:anything_to_commit?)
336
-
336
+ # rubocop:disable Lint/EmptyBlock
337
337
  File.open(File.join(dir, 'README'), 'w') {}
338
+ # rubocop:enable Lint/EmptyBlock
338
339
  assert core.activity.send(:anything_to_commit?)
339
340
 
340
341
  c = OhlohScm::Commit.new
@@ -343,12 +344,12 @@ describe 'Git::Activity' do
343
344
  core.activity.commit_all(c)
344
345
  refute core.activity.send(:anything_to_commit?)
345
346
 
346
- core.activity.commits.size.must_equal 1
347
+ assert_equal core.activity.commits.size, 1
347
348
 
348
- core.activity.commits.first.author_name.must_equal c.author_name
349
+ assert_equal core.activity.commits.first.author_name, c.author_name
349
350
  # Depending on version of Git used, we may or may not have trailing \n.
350
351
  # We don't really care, so just compare the stripped versions.
351
- core.activity.commits.first.message.strip.must_equal c.message.strip
352
+ assert_equal core.activity.commits.first.message.strip, c.message.strip
352
353
 
353
354
  assert_equal ['.gitignore', 'README'], core.activity.commits.first.diffs.collect(&:path).sort
354
355
  end
@@ -370,7 +371,7 @@ describe 'Git::Activity' do
370
371
  core.activity.send(:write_token, 'FOO')
371
372
  refute core.activity.read_token # Token not valid until committed
372
373
  core.activity.commit_all(OhlohScm::Commit.new)
373
- core.activity.read_token.must_equal 'FOO'
374
+ assert_equal core.activity.read_token, 'FOO'
374
375
  end
375
376
  end
376
377
 
@@ -381,7 +382,7 @@ describe 'Git::Activity' do
381
382
  c = OhlohScm::Commit.new
382
383
  c.token = 'BAR'
383
384
  core.activity.commit_all(c)
384
- c.token.must_equal core.activity.read_token
385
+ assert_equal c.token, core.activity.read_token
385
386
  end
386
387
  end
387
388
 
@@ -27,8 +27,8 @@ describe 'Git::Scm' do
27
27
  master_branch_sha = `cd #{dest_dir} && git rev-parse master`
28
28
  test_branch_sha = `cd #{dest_dir} && git rev-parse test`
29
29
 
30
- master_branch_sha.wont_equal test_branch_sha
31
- master_branch_sha.must_equal remote_master_branch_sha
30
+ refute_equal master_branch_sha, test_branch_sha
31
+ assert_equal master_branch_sha, remote_master_branch_sha
32
32
  end
33
33
  end
34
34
  end
@@ -48,8 +48,8 @@ describe 'Git::Scm' do
48
48
  master_branch_sha = `cd #{dest_dir} && git rev-parse master`
49
49
  test_branch_sha = `cd #{dest_dir} && git rev-parse test`
50
50
 
51
- master_branch_sha.must_equal remote_master_branch_sha
52
- test_branch_sha.must_equal remote_test_branch_sha
51
+ assert_equal master_branch_sha, remote_master_branch_sha
52
+ assert_equal test_branch_sha, remote_test_branch_sha
53
53
  end
54
54
  end
55
55
  end
@@ -80,12 +80,12 @@ describe 'Git::Scm' do
80
80
  # Emulate a scenario where the local copy doesn't have the current *main* branch.
81
81
  `cd #{dest_dir} && git checkout master && git branch -D test`
82
82
 
83
- local_branch_cmd = "cd #{dest_dir} && git branch | grep '\*' | sed 's/^\* //'"
84
- `#{ local_branch_cmd }`.chomp.must_equal 'master'
83
+ local_branch_cmd = "cd #{dest_dir} && git branch | grep '*' | sed 's/^* //'"
84
+ assert_equal `#{local_branch_cmd}`.chomp, 'master'
85
85
 
86
86
  # On doing a refetch, our local copy will now have the updated *main* branch.
87
87
  core.scm.pull(src_core.scm, TestCallback.new)
88
- `#{ local_branch_cmd }`.chomp.must_equal test_branch_name
88
+ assert_equal `#{local_branch_cmd}`.chomp, test_branch_name
89
89
  end
90
90
  end
91
91
  end
@@ -103,12 +103,12 @@ describe 'Git::Scm' do
103
103
  src_core.activity.commits.each_with_index do |c, i|
104
104
  # Because CVS does not track authors (only committers),
105
105
  # the CVS committer becomes the Git author.
106
- c.committer_date.must_equal dest_commits[i].author_date
107
- c.committer_name.must_equal dest_commits[i].author_name
106
+ assert_equal c.committer_date, dest_commits[i].author_date
107
+ assert_equal c.committer_name, dest_commits[i].author_name
108
108
 
109
109
  # Depending upon version of Git used, we may or may not have a trailing \n.
110
110
  # We don't really care, so just compare the stripped versions.
111
- c.message.strip.must_equal dest_commits[i].message.strip
111
+ assert_equal c.message.strip, dest_commits[i].message.strip
112
112
  end
113
113
  end
114
114
  end
@@ -129,6 +129,6 @@ describe 'Git::Scm' do
129
129
 
130
130
  it 'must return master when branch_name is null' do
131
131
  core = OhlohScm::Factory.get_core(scm_type: :git, url: 'foobar')
132
- _(core.scm.branch_name_or_default).must_equal 'master'
132
+ assert_equal core.scm.branch_name_or_default, 'master'
133
133
  end
134
134
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe 'Git::Status' do
4
4
  it 'branch?' do
5
5
  with_git_repository('git') do |git|
6
- git.activity.send(:branches).must_equal %w[develop master]
6
+ assert_equal git.activity.send(:branches), %w[develop master]
7
7
  assert git.status.branch?('master')
8
8
  assert git.status.branch?('develop')
9
9
  end
@@ -13,13 +13,13 @@ describe 'Git::Status' do
13
13
  it 'must return default branch when repository doesnt exist' do
14
14
  git = OhlohScm::Factory.get_core(scm_type: :git, url: 'foobar')
15
15
  git.status.stubs(:exist?)
16
- _(git.status.default_branch).must_equal 'master'
16
+ assert_equal git.status.default_branch, 'master'
17
17
  end
18
18
 
19
19
  it 'must return default branch when no HEAD branch is found in remote' do
20
20
  git = OhlohScm::Factory.get_core(scm_type: :git, url: 'foobar')
21
21
  git.status.stubs(:exist?).returns(true)
22
- git.status.default_branch.must_equal 'master'
22
+ assert_equal git.status.default_branch, 'master'
23
23
  end
24
24
  end
25
25
  end
@@ -4,22 +4,22 @@ describe 'Git::Validation' do
4
4
  it 'wont have errors for valid url' do
5
5
  core = OhlohScm::Factory.get_core(scm_type: :git, url: 'https://github.com/ruby/ruby')
6
6
  core.validation.send(:validate_attributes)
7
- core.errors.must_be :empty?
7
+ assert_empty core.errors
8
8
  end
9
9
 
10
10
  it 'must have errors for invalid branch_name' do
11
- get_core(:git, branch_name: 'x' * 81).validation.send(:branch_name_errors).wont_be :empty?
12
- get_core(:git, branch_name: 'foo@bar').validation.send(:branch_name_errors).wont_be :empty?
11
+ refute_empty get_core(:git, branch_name: 'x' * 81).validation.send(:branch_name_errors)
12
+ refute_empty get_core(:git, branch_name: 'foo@bar').validation.send(:branch_name_errors)
13
13
  end
14
14
 
15
15
  it 'must have errors for invalid username' do
16
- get_core(:git, username: 'x' * 33).validation.send(:username_errors).wont_be :empty?
17
- get_core(:git, username: 'foo@bar').validation.send(:username_errors).wont_be :empty?
16
+ refute_empty get_core(:git, username: 'x' * 33).validation.send(:username_errors)
17
+ refute_empty get_core(:git, username: 'foo@bar').validation.send(:username_errors)
18
18
  end
19
19
 
20
20
  it 'must have errors for invalid password' do
21
- get_core(:git, password: 'x' * 33).validation.send(:password_errors).wont_be :empty?
22
- get_core(:git, password: 'escape').validation.send(:password_errors).wont_be :empty?
21
+ refute_empty get_core(:git, password: 'x' * 33).validation.send(:password_errors)
22
+ refute_empty get_core(:git, password: 'escape').validation.send(:password_errors)
23
23
  end
24
24
 
25
25
  describe 'validate url' do
@@ -4,16 +4,16 @@ require 'mocha'
4
4
  describe 'GitSvn::Activity' do
5
5
  it 'must return all commit tokens' do
6
6
  with_git_svn_repository('git_svn') do |git_svn|
7
- git_svn.activity.commit_tokens.must_equal [1, 2, 3, 5]
8
- git_svn.activity.commit_tokens(after: 2).must_equal [3, 5]
7
+ assert_equal git_svn.activity.commit_tokens, [1, 2, 3, 5]
8
+ assert_equal git_svn.activity.commit_tokens(after: 2), [3, 5]
9
9
  end
10
10
  end
11
11
 
12
12
  it 'must return commits' do
13
13
  with_git_svn_repository('git_svn') do |git_svn|
14
- git_svn.activity.commits.map(&:token).must_equal [1, 2, 3, 5]
15
- git_svn.activity.commits(after: 2).map(&:token).must_equal [3, 5]
16
- git_svn.activity.commits(after: 7).map(&:token).must_equal []
14
+ assert_equal git_svn.activity.commits.map(&:token), [1, 2, 3, 5]
15
+ assert_equal git_svn.activity.commits(after: 2).map(&:token), [3, 5]
16
+ assert_equal git_svn.activity.commits(after: 7).map(&:token), []
17
17
  end
18
18
  end
19
19
 
@@ -21,19 +21,19 @@ describe 'GitSvn::Activity' do
21
21
  with_git_svn_repository('git_svn') do |git_svn|
22
22
  commits = []
23
23
  git_svn.activity.each_commit { |c| commits << c }
24
- git_svn.activity.commits.map(&:token).must_equal [1, 2, 3, 5]
24
+ assert_equal git_svn.activity.commits.map(&:token), [1, 2, 3, 5]
25
25
  end
26
26
  end
27
27
 
28
28
  it 'must return total commit count' do
29
29
  with_git_svn_repository('git_svn') do |git_svn|
30
- git_svn.activity.commit_count.must_equal 4
31
- git_svn.activity.commit_count(after: 2).must_equal 2
30
+ assert_equal git_svn.activity.commit_count, 4
31
+ assert_equal git_svn.activity.commit_count(after: 2), 2
32
32
  end
33
33
  end
34
34
 
35
35
  describe 'cat' do
36
- let(:commit_1) { OhlohScm::Commit.new(token: 1) }
36
+ let(:commit1) { OhlohScm::Commit.new(token: 1) }
37
37
  let(:hello_diff) { OhlohScm::Diff.new(path: 'helloworld.c') }
38
38
 
39
39
  it 'cat_file' do
@@ -47,8 +47,8 @@ describe 'GitSvn::Activity' do
47
47
  }
48
48
  EXPECTED
49
49
 
50
- git_svn.activity.cat_file(commit_1, hello_diff)
51
- .delete("\t").strip.must_equal expected.strip
50
+ assert_equal git_svn.activity.cat_file(commit1, hello_diff)
51
+ .delete("\t").strip, expected.strip
52
52
  end
53
53
  end
54
54
 
@@ -60,7 +60,7 @@ describe 'GitSvn::Activity' do
60
60
 
61
61
  it 'cat_file_with_invalid_filename' do
62
62
  with_git_svn_repository('git_svn') do |git_svn|
63
- assert git_svn.activity.cat_file(commit_1, OhlohScm::Diff.new(path: 'invalid')).must_be_empty
63
+ assert_empty git_svn.activity.cat_file(commit1, OhlohScm::Diff.new(path: 'invalid'))
64
64
  end
65
65
  end
66
66
 
@@ -76,13 +76,13 @@ describe 'GitSvn::Activity' do
76
76
  EXPECTED
77
77
 
78
78
  commit = OhlohScm::Commit.new(token: 2)
79
- git_svn.activity.cat_file_parent(commit, hello_diff).delete("\t").must_equal expected.strip
79
+ assert_equal git_svn.activity.cat_file_parent(commit, hello_diff).delete("\t"), expected.strip
80
80
  end
81
81
  end
82
82
 
83
83
  it 'cat_file_parent_with_first_token' do
84
84
  with_git_svn_repository('git_svn') do |git_svn|
85
- assert git_svn.activity.cat_file(commit_1, hello_diff)
85
+ assert git_svn.activity.cat_file(commit1, hello_diff)
86
86
  end
87
87
  end
88
88
  end
@@ -8,7 +8,7 @@ describe 'GitSvn::Scm' do
8
8
  git_svn.scm.pull(src.scm, TestCallback.new)
9
9
  assert git_svn.status.exist?
10
10
 
11
- git_svn.activity.commit_count.must_equal 5
11
+ assert_equal git_svn.activity.commit_count, 5
12
12
  end
13
13
  end
14
14
  end