jeweler 1.8.2 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.semver +5 -0
  4. data/.travis.yml +5 -3
  5. data/ChangeLog.markdown +30 -0
  6. data/Gemfile +32 -25
  7. data/Gemfile.lock +117 -46
  8. data/README.markdown +36 -10
  9. data/README.org +374 -0
  10. data/Rakefile +23 -28
  11. data/bin/jeweler +1 -0
  12. data/features/generator/gemfile.feature +1 -0
  13. data/features/generator/test.feature +2 -2
  14. data/features/step_definitions/debug_steps.rb +0 -1
  15. data/features/step_definitions/filesystem_steps.rb +2 -3
  16. data/features/step_definitions/generator_steps.rb +44 -66
  17. data/features/step_definitions/task_steps.rb +1 -2
  18. data/features/support/env.rb +22 -9
  19. data/jeweler.gemspec +64 -45
  20. data/lib/jeweler/commands/build_gem.rb +6 -2
  21. data/lib/jeweler/commands/check_dependencies.rb +3 -3
  22. data/lib/jeweler/commands/install_gem.rb +1 -1
  23. data/lib/jeweler/commands/release_gemspec.rb +17 -14
  24. data/lib/jeweler/commands/release_to_git.rb +20 -11
  25. data/lib/jeweler/commands/validate_gemspec.rb +5 -7
  26. data/lib/jeweler/commands/version/base.rb +8 -13
  27. data/lib/jeweler/commands/version/bump_major.rb +1 -3
  28. data/lib/jeweler/commands/version/bump_minor.rb +1 -2
  29. data/lib/jeweler/commands/version/bump_patch.rb +1 -4
  30. data/lib/jeweler/commands/write_gemspec.rb +4 -3
  31. data/lib/jeweler/commands.rb +6 -6
  32. data/lib/jeweler/gemspec_helper.rb +15 -15
  33. data/lib/jeweler/generator/application.rb +5 -10
  34. data/lib/jeweler/generator/bacon_mixin.rb +2 -4
  35. data/lib/jeweler/generator/github_mixin.rb +1 -10
  36. data/lib/jeweler/generator/micronaut_mixin.rb +3 -3
  37. data/lib/jeweler/generator/minitest_mixin.rb +2 -3
  38. data/lib/jeweler/generator/options.rb +16 -25
  39. data/lib/jeweler/generator/rdoc_mixin.rb +1 -1
  40. data/lib/jeweler/generator/riot_mixin.rb +2 -3
  41. data/lib/jeweler/generator/rspec_mixin.rb +2 -3
  42. data/lib/jeweler/generator/shindo_mixin.rb +2 -3
  43. data/lib/jeweler/generator/shoulda_mixin.rb +2 -3
  44. data/lib/jeweler/generator/testspec_mixin.rb +2 -3
  45. data/lib/jeweler/generator/testunit_mixin.rb +1 -3
  46. data/lib/jeweler/generator/yard_mixin.rb +3 -4
  47. data/lib/jeweler/generator.rb +52 -45
  48. data/lib/jeweler/rubyforge_tasks.rb +13 -13
  49. data/lib/jeweler/rubygems_dot_org_tasks.rb +3 -3
  50. data/lib/jeweler/rubygems_tasks.rb +3 -3
  51. data/lib/jeweler/specification.rb +22 -11
  52. data/lib/jeweler/tasks.rb +68 -59
  53. data/lib/jeweler/templates/Gemfile +1 -1
  54. data/lib/jeweler/templates/bacon/flunking.rb +3 -3
  55. data/lib/jeweler/templates/bacon/helper.rb +1 -0
  56. data/lib/jeweler/templates/features/support/env.rb +1 -0
  57. data/lib/jeweler/templates/jeweler_tasks.erb +1 -1
  58. data/lib/jeweler/templates/micronaut/flunking.rb +3 -3
  59. data/lib/jeweler/templates/micronaut/helper.rb +1 -0
  60. data/lib/jeweler/templates/minitest/flunking.rb +1 -1
  61. data/lib/jeweler/templates/minitest/helper.rb +4 -3
  62. data/lib/jeweler/templates/other_tasks.erb +4 -20
  63. data/lib/jeweler/templates/riot/flunking.rb +1 -1
  64. data/lib/jeweler/templates/riot/helper.rb +1 -0
  65. data/lib/jeweler/templates/rspec/flunking.rb +3 -3
  66. data/lib/jeweler/templates/rspec/helper.rb +3 -1
  67. data/lib/jeweler/templates/shindo/flunking.rb +3 -3
  68. data/lib/jeweler/templates/shindo/helper.rb +1 -0
  69. data/lib/jeweler/templates/shoulda/helper.rb +1 -0
  70. data/lib/jeweler/templates/simplecov.erb +16 -0
  71. data/lib/jeweler/templates/testspec/flunking.rb +3 -3
  72. data/lib/jeweler/templates/testspec/helper.rb +1 -1
  73. data/lib/jeweler/templates/testunit/helper.rb +1 -0
  74. data/lib/jeweler/version.rb +3 -3
  75. data/lib/jeweler/version_helper.rb +18 -15
  76. data/lib/jeweler.rb +23 -23
  77. data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -1
  78. data/test/fixtures/existing-project-with-version-constant/Rakefile +18 -20
  79. data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +15 -17
  80. data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +2 -2
  81. data/test/fixtures/existing-project-with-version-plaintext/Rakefile +17 -19
  82. data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +15 -17
  83. data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +2 -2
  84. data/test/fixtures/existing-project-with-version-yaml/Rakefile +17 -19
  85. data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +15 -17
  86. data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +2 -2
  87. data/test/jeweler/commands/test_build_gem.rb +33 -27
  88. data/test/jeweler/commands/test_install_gem.rb +7 -7
  89. data/test/jeweler/commands/test_release_to_gemcutter.rb +6 -7
  90. data/test/jeweler/commands/test_release_to_git.rb +95 -37
  91. data/test/jeweler/commands/test_release_to_github.rb +161 -97
  92. data/test/jeweler/commands/test_validate_gemspec.rb +4 -6
  93. data/test/jeweler/commands/test_write_gemspec.rb +21 -24
  94. data/test/jeweler/commands/version/test_base.rb +26 -6
  95. data/test/jeweler/commands/version/test_bump_major.rb +1 -5
  96. data/test/jeweler/commands/version/test_bump_minor.rb +1 -2
  97. data/test/jeweler/commands/version/test_bump_patch.rb +1 -3
  98. data/test/jeweler/commands/version/test_write.rb +1 -3
  99. data/test/jeweler/generator/test_application.rb +22 -26
  100. data/test/jeweler/generator/test_options.rb +26 -38
  101. data/test/jeweler/test_gemspec_helper.rb +7 -7
  102. data/test/jeweler/test_generator.rb +31 -33
  103. data/test/jeweler/test_generator_initialization.rb +40 -57
  104. data/test/jeweler/test_generator_mixins.rb +6 -7
  105. data/test/jeweler/test_specification.rb +44 -43
  106. data/test/jeweler/test_tasks.rb +2 -3
  107. data/test/jeweler/test_version_helper.rb +33 -35
  108. data/test/shoulda_macros/jeweler_macros.rb +5 -5
  109. data/test/test_helper.rb +25 -31
  110. data/test/test_jeweler.rb +28 -29
  111. metadata +206 -165
@@ -4,9 +4,8 @@ require 'pathname'
4
4
  class Jeweler
5
5
  module Commands
6
6
  class TestReleaseGemspec < Test::Unit::TestCase
7
-
8
- rubyforge_command_context "running" do
9
- context "happily" do
7
+ rubyforge_command_context 'running' do
8
+ context 'happily' do
10
9
  setup do
11
10
  stub(@command).clean_staging_area? { true }
12
11
 
@@ -24,43 +23,116 @@ class Jeweler
24
23
  @command.run
25
24
  end
26
25
 
27
- should "checkout master" do
28
- assert_received(@repo) {|repo| repo.checkout('master') }
26
+ should 'checkout master' do
27
+ assert_received(@repo) { |repo| repo.checkout('master') }
28
+ end
29
+
30
+ should 'regenerate gemspec' do
31
+ assert_received(@command, &:regenerate_gemspec!)
32
+ end
33
+
34
+ should 'commit gemspec' do
35
+ assert_received(@command, &:commit_gemspec!)
36
+ end
37
+
38
+ should 'push' do
39
+ assert_received(@repo) { |repo| repo.push('origin', 'master:master') }
40
+ end
41
+ end
42
+
43
+ context 'happily with different remote, local branch and remote branch' do
44
+ setup do
45
+ stub(@command).clean_staging_area? { true }
46
+
47
+ stub(@repo).checkout(anything)
48
+
49
+ stub(@command).regenerate_gemspec!
50
+
51
+ stub(@command).gemspec_changed? { true }
52
+ stub(@command).commit_gemspec! { true }
53
+
54
+ stub(@repo).push
55
+
56
+ stub(@command).release_not_tagged? { true }
57
+
58
+ @command.run(remote: 'upstream', local_branch: 'branch', remote_branch: 'remote_branch')
29
59
  end
30
60
 
31
- should "regenerate gemspec" do
32
- assert_received(@command) {|command| command.regenerate_gemspec! }
61
+ should 'checkout local branch' do
62
+ assert_received(@repo) { |repo| repo.checkout('branch') }
33
63
  end
34
64
 
35
- should "commit gemspec" do
36
- assert_received(@command) {|command| command.commit_gemspec! }
65
+ should 'regenerate gemspec' do
66
+ assert_received(@command, &:regenerate_gemspec!)
37
67
  end
38
68
 
39
- should "push" do
40
- assert_received(@repo) {|repo| repo.push }
69
+ should 'commit gemspec' do
70
+ assert_received(@command, &:commit_gemspec!)
41
71
  end
42
72
 
73
+ should 'push' do
74
+ assert_received(@repo) { |repo| repo.push('upstream', 'branch:remote_branch') }
75
+ end
43
76
  end
44
77
 
45
- context "with an unclean staging area" do
78
+ context 'happily with different branch' do
79
+ setup do
80
+ stub(@command).clean_staging_area? { true }
81
+
82
+ stub(@repo).checkout(anything)
83
+
84
+ stub(@command).regenerate_gemspec!
85
+
86
+ stub(@command).gemspec_changed? { true }
87
+ stub(@command).commit_gemspec! { true }
88
+
89
+ stub(@repo).push
90
+
91
+ stub(@command).release_not_tagged? { true }
92
+
93
+ @command.run(branch: 'v3')
94
+ end
95
+
96
+ should 'checkout local branch' do
97
+ assert_received(@repo) { |repo| repo.checkout('v3') }
98
+ end
99
+
100
+ should 'regenerate gemspec' do
101
+ assert_received(@command, &:regenerate_gemspec!)
102
+ end
103
+
104
+ should 'commit gemspec' do
105
+ assert_received(@command, &:commit_gemspec!)
106
+ end
107
+
108
+ should 'push' do
109
+ assert_received(@repo) { |repo| repo.push('origin', 'v3:v3') }
110
+ end
111
+ end
112
+
113
+ context 'with an unclean staging area' do
46
114
  setup do
47
115
  stub(@command).clean_staging_area? { false }
48
116
  stub(@command).system
49
117
  end
50
118
 
51
119
  should 'raise error' do
52
- assert_raises RuntimeError, /try commiting/i do
120
+ assert_raises RuntimeError, 'Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above.' do
53
121
  @command.run
54
122
  end
55
123
  end
56
124
 
57
125
  should 'display git status' do
58
- @command.run rescue nil
59
- assert_received(@command) {|command| command.system("git status") }
126
+ begin
127
+ @command.run
128
+ rescue
129
+ nil
130
+ end
131
+ assert_received(@command) { |command| command.system('git status') }
60
132
  end
61
133
  end
62
134
 
63
- context "with an unchanged gemspec" do
135
+ context 'with an unchanged gemspec' do
64
136
  setup do
65
137
  stub(@command).clean_staging_area? { true }
66
138
 
@@ -78,21 +150,20 @@ class Jeweler
78
150
  @command.run
79
151
  end
80
152
 
81
- should "checkout master" do
82
- assert_received(@repo) {|repo| repo.checkout('master') }
153
+ should 'checkout master' do
154
+ assert_received(@repo) { |repo| repo.checkout('master') }
83
155
  end
84
156
 
85
- should "regenerate gemspec" do
86
- assert_received(@command) {|command| command.regenerate_gemspec! }
157
+ should 'regenerate gemspec' do
158
+ assert_received(@command, &:regenerate_gemspec!)
87
159
  end
88
160
 
89
- should "push" do
90
- assert_received(@repo) {|repo| repo.push }
161
+ should 'push' do
162
+ assert_received(@repo) { |repo| repo.push('origin', 'master:master') }
91
163
  end
92
-
93
164
  end
94
165
 
95
- context "with a release already tagged" do
166
+ context 'with a release already tagged' do
96
167
  setup do
97
168
  stub(@command).clean_staging_area? { true }
98
169
 
@@ -110,59 +181,56 @@ class Jeweler
110
181
  @command.run
111
182
  end
112
183
 
113
- should "checkout master" do
114
- assert_received(@repo) {|repo| repo.checkout('master') }
184
+ should 'checkout master' do
185
+ assert_received(@repo) { |repo| repo.checkout('master') }
115
186
  end
116
187
 
117
- should "regenerate gemspec" do
118
- assert_received(@command) {|command| command.regenerate_gemspec! }
188
+ should 'regenerate gemspec' do
189
+ assert_received(@command, &:regenerate_gemspec!)
119
190
  end
120
191
 
121
- should "commit gemspec" do
122
- assert_received(@command) {|command| command.commit_gemspec! }
192
+ should 'commit gemspec' do
193
+ assert_received(@command, &:commit_gemspec!)
123
194
  end
124
195
 
125
- should "push" do
126
- assert_received(@repo) {|repo| repo.push }
196
+ should 'push' do
197
+ assert_received(@repo) { |repo| repo.push('origin', 'master:master') }
127
198
  end
128
-
129
199
  end
130
-
131
200
  end
132
201
 
133
-
134
- build_command_context "building from jeweler" do
202
+ build_command_context 'building from jeweler' do
135
203
  setup do
136
204
  @command = Jeweler::Commands::ReleaseGemspec.build_for(@jeweler)
137
205
  end
138
206
 
139
- should "assign gemspec" do
207
+ should 'assign gemspec' do
140
208
  assert_same @gemspec, @command.gemspec
141
209
  end
142
210
 
143
- should "assign version" do
211
+ should 'assign version' do
144
212
  assert_same @version, @command.version
145
213
  end
146
214
 
147
- should "assign repo" do
215
+ should 'assign repo' do
148
216
  assert_same @repo, @command.repo
149
217
  end
150
218
 
151
- should "assign output" do
219
+ should 'assign output' do
152
220
  assert_same @output, @command.output
153
221
  end
154
222
 
155
- should "assign gemspec_helper" do
223
+ should 'assign gemspec_helper' do
156
224
  assert_same @gemspec_helper, @command.gemspec_helper
157
225
  end
158
226
 
159
- should "assign base_dir" do
227
+ should 'assign base_dir' do
160
228
  assert_same @base_dir, @command.base_dir
161
229
  end
162
230
  end
163
231
 
164
- # FIXME this code had its ruby-git stuff replaced with `` and system, which is much harder to test, so re-enable these someday
165
- #context "clean_staging_area?" do
232
+ # FIXME: this code had its ruby-git stuff replaced with `` and system, which is much harder to test, so re-enable these someday
233
+ # context "clean_staging_area?" do
166
234
 
167
235
  # should "be false if there added files" do
168
236
  # repo = build_repo :added => %w(README)
@@ -198,9 +266,9 @@ class Jeweler
198
266
 
199
267
  # assert command.clean_staging_area?
200
268
  # end
201
- #end
269
+ # end
202
270
 
203
- context "regenerate_gemspec!" do
271
+ context 'regenerate_gemspec!' do
204
272
  setup do
205
273
  @repo = Object.new
206
274
  stub(@repo) do
@@ -211,30 +279,30 @@ class Jeweler
211
279
  @gemspec_helper = Object.new
212
280
  stub(@gemspec_helper) do
213
281
  write
214
- path {'zomg.gemspec'}
282
+ path { 'zomg.gemspec' }
215
283
  update_version('1.2.3')
216
284
  end
217
285
 
218
286
  @output = StringIO.new
219
287
 
220
- @command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
221
- :repo => @repo,
222
- :gemspec_helper => @gemspec_helper,
223
- :version => '1.2.3'
288
+ @command = Jeweler::Commands::ReleaseGemspec.new output: @output,
289
+ repo: @repo,
290
+ gemspec_helper: @gemspec_helper,
291
+ version: '1.2.3'
224
292
 
225
293
  @command.regenerate_gemspec!
226
294
  end
227
295
 
228
- should "refresh gemspec version" do
229
- assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version('1.2.3') }
296
+ should 'refresh gemspec version' do
297
+ assert_received(@gemspec_helper) { |gemspec_helper| gemspec_helper.update_version('1.2.3') }
230
298
  end
231
299
 
232
- should "write gemspec" do
233
- assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
300
+ should 'write gemspec' do
301
+ assert_received(@gemspec_helper, &:write)
234
302
  end
235
303
  end
236
304
 
237
- context "commit_gemspec!" do
305
+ context 'commit_gemspec!' do
238
306
  setup do
239
307
  @repo = Object.new
240
308
  stub(@repo) do
@@ -244,32 +312,31 @@ class Jeweler
244
312
 
245
313
  @gemspec_helper = Object.new
246
314
  stub(@gemspec_helper) do
247
- path {'zomg.gemspec'}
315
+ path { 'zomg.gemspec' }
248
316
  update_version('1.2.3')
249
317
  end
250
318
 
251
319
  @output = StringIO.new
252
320
 
253
- @command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
254
- :repo => @repo,
255
- :gemspec_helper => @gemspec_helper,
256
- :version => '1.2.3'
321
+ @command = Jeweler::Commands::ReleaseGemspec.new output: @output,
322
+ repo: @repo,
323
+ gemspec_helper: @gemspec_helper,
324
+ version: '1.2.3'
257
325
 
258
- stub(@command).working_subdir { Pathname.new(".") }
326
+ stub(@command).working_subdir { Pathname.new('.') }
259
327
  @command.commit_gemspec!
260
328
  end
261
329
 
262
- should "add gemspec to repository" do
263
- assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
330
+ should 'add gemspec to repository' do
331
+ assert_received(@repo) { |repo| repo.add('zomg.gemspec') }
264
332
  end
265
333
 
266
- should "commit with commit message including version" do
267
- assert_received(@repo) {|repo| repo.commit("Regenerate gemspec for version 1.2.3") }
334
+ should 'commit with commit message including version' do
335
+ assert_received(@repo) { |repo| repo.commit('Regenerate gemspec for version 1.2.3') }
268
336
  end
269
-
270
337
  end
271
338
 
272
- context "commit_gemspec! in top dir" do
339
+ context 'commit_gemspec! in top dir' do
273
340
  setup do
274
341
  @repo = Object.new
275
342
 
@@ -280,33 +347,33 @@ class Jeweler
280
347
 
281
348
  @gemspec_helper = Object.new
282
349
  stub(@gemspec_helper) do
283
- path {'zomg.gemspec'}
350
+ path { 'zomg.gemspec' }
284
351
  update_version('1.2.3')
285
352
  end
286
353
 
287
354
  @output = StringIO.new
288
355
 
289
- @command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
290
- :repo => @repo,
291
- :gemspec_helper => @gemspec_helper,
292
- :version => '1.2.3',
293
- :base_dir => '.'
356
+ @command = Jeweler::Commands::ReleaseGemspec.new output: @output,
357
+ repo: @repo,
358
+ gemspec_helper: @gemspec_helper,
359
+ version: '1.2.3',
360
+ base_dir: '.'
294
361
 
295
362
  @dir = Object.new
296
363
  stub(@repo).dir { @dir }
297
- stub(@dir).path { "/x/y/z" }
364
+ stub(@dir).path { '/x/y/z' }
298
365
 
299
- stub(@command).base_dir_path { Pathname.new("/x/y/z") }
366
+ stub(@command).base_dir_path { Pathname.new('/x/y/z') }
300
367
 
301
368
  @command.commit_gemspec!
302
369
  end
303
370
 
304
- should "add gemspec to repository" do
305
- assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
371
+ should 'add gemspec to repository' do
372
+ assert_received(@repo) { |repo| repo.add('zomg.gemspec') }
306
373
  end
307
374
  end
308
375
 
309
- context "commit_gemspec! in sub dir" do
376
+ context 'commit_gemspec! in sub dir' do
310
377
  setup do
311
378
  @repo = Object.new
312
379
 
@@ -317,33 +384,33 @@ class Jeweler
317
384
 
318
385
  @gemspec_helper = Object.new
319
386
  stub(@gemspec_helper) do
320
- path {'zomg.gemspec'}
387
+ path { 'zomg.gemspec' }
321
388
  update_version('1.2.3')
322
389
  end
323
390
 
324
391
  @output = StringIO.new
325
392
 
326
- @command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
327
- :repo => @repo,
328
- :gemspec_helper => @gemspec_helper,
329
- :version => '1.2.3',
330
- :base_dir => '.'
393
+ @command = Jeweler::Commands::ReleaseGemspec.new output: @output,
394
+ repo: @repo,
395
+ gemspec_helper: @gemspec_helper,
396
+ version: '1.2.3',
397
+ base_dir: '.'
331
398
 
332
399
  @dir = Object.new
333
400
  stub(@repo).dir { @dir }
334
- stub(@dir).path { "/x/y/z" }
401
+ stub(@dir).path { '/x/y/z' }
335
402
 
336
- stub(@command).base_dir_path { Pathname.new("/x/y/z/gem") }
403
+ stub(@command).base_dir_path { Pathname.new('/x/y/z/gem') }
337
404
 
338
405
  @command.commit_gemspec!
339
406
  end
340
407
 
341
- should "add gemspec to repository" do
342
- assert_received(@repo) {|repo| repo.add('gem/zomg.gemspec') }
408
+ should 'add gemspec to repository' do
409
+ assert_received(@repo) { |repo| repo.add('gem/zomg.gemspec') }
343
410
  end
344
411
  end
345
412
 
346
- context "release_tagged? when no tag exists" do
413
+ context 'release_tagged? when no tag exists' do
347
414
  setup do
348
415
  @repo = Object.new
349
416
  stub(@repo).tag('v1.2.3') { raise Git::GitTagNameDoesNotExist, tag }
@@ -356,13 +423,12 @@ class Jeweler
356
423
  @command.version = '1.2.3'
357
424
  end
358
425
 
359
- should_eventually "be true" do
426
+ should_eventually 'be true' do
360
427
  assert @command.release_not_tagged?
361
428
  end
362
-
363
429
  end
364
430
 
365
- context "release_tagged? when tag exists" do
431
+ context 'release_tagged? when tag exists' do
366
432
  setup do
367
433
  @repo = Object.new
368
434
  stub(@repo) do
@@ -377,10 +443,9 @@ class Jeweler
377
443
  @command.version = '1.2.3'
378
444
  end
379
445
 
380
- should_eventually "be false" do
446
+ should_eventually 'be false' do
381
447
  assert @command.release_not_tagged?
382
448
  end
383
-
384
449
  end
385
450
 
386
451
  def build_repo(options = {})
@@ -391,7 +456,7 @@ class Jeweler
391
456
  end
392
457
 
393
458
  def build_status(options = {})
394
- options = {:added => [], :deleted => [], :changed => []}.merge(options)
459
+ options = { added: [], deleted: [], changed: [] }.merge(options)
395
460
 
396
461
  status = Object.new
397
462
  stub(status) do
@@ -399,7 +464,6 @@ class Jeweler
399
464
  deleted { options[:deleted] }
400
465
  changed { options[:changed] }
401
466
  end
402
-
403
467
  end
404
468
  end
405
469
  end
@@ -3,24 +3,22 @@ require 'test_helper'
3
3
  class Jeweler
4
4
  module Commands
5
5
  class TestValidateGemspec < Test::Unit::TestCase
6
-
7
- build_command_context "build context" do
6
+ build_command_context 'build context' do
8
7
  setup do
9
8
  @command = Jeweler::Commands::ValidateGemspec.build_for(@jeweler)
10
9
  end
11
10
 
12
- should "assign gemspec_helper" do
11
+ should 'assign gemspec_helper' do
13
12
  assert_same @gemspec_helper, @command.gemspec_helper
14
13
  end
15
14
 
16
- should "assign output" do
15
+ should 'assign output' do
17
16
  assert_same @output, @command.output
18
17
  end
19
18
 
20
- should "return Jeweler::Commands::ValidateGemspec" do
19
+ should 'return Jeweler::Commands::ValidateGemspec' do
21
20
  assert_kind_of Jeweler::Commands::ValidateGemspec, @command
22
21
  end
23
-
24
22
  end
25
23
  end
26
24
  end
@@ -3,10 +3,9 @@ require 'test_helper'
3
3
  class Jeweler
4
4
  module Commands
5
5
  class TestWriteGemspec < Test::Unit::TestCase
6
-
7
- context "after run" do
6
+ context 'after run' do
8
7
  setup do
9
- @gemspec = Gem::Specification.new {|s| s.name = 'zomg' }
8
+ @gemspec = Gem::Specification.new { |s| s.name = 'zomg' }
10
9
  @gemspec_helper = Object.new
11
10
  stub(@gemspec_helper).spec { @gemspec }
12
11
  stub(@gemspec_helper).path { 'zomg.gemspec' }
@@ -15,7 +14,7 @@ class Jeweler
15
14
  @output = StringIO.new
16
15
 
17
16
  @version_helper = Object.new
18
- stub(@version_helper).to_s { '1.2.3' }
17
+ stub(@version_helper).to_s { '1.2.3' }
19
18
  stub(@version_helper).refresh
20
19
 
21
20
  @command = Jeweler::Commands::WriteGemspec.new
@@ -25,17 +24,17 @@ class Jeweler
25
24
  @command.output = @output
26
25
  @command.gemspec_helper = @gemspec_helper
27
26
 
28
- # FIXME apparently rubygems doesn't use Time.now under the hood when generating a date
27
+ # FIXME: apparently rubygems doesn't use Time.now under the hood when generating a date
29
28
  @now = Time.local(2008, 9, 1, 12, 0, 0)
30
29
  stub(Time.now).now { @now }
31
30
  end
32
31
 
33
- should "refresh version" do
32
+ should 'refresh version' do
34
33
  @command.run
35
- assert_received(@version_helper) {|version_helper| version_helper.refresh }
34
+ assert_received(@version_helper, &:refresh)
36
35
  end
37
36
 
38
- should "update gemspec version" do
37
+ should 'update gemspec version' do
39
38
  @command.run
40
39
  assert_equal '1.2.3', @gemspec.version.to_s
41
40
  end
@@ -46,58 +45,56 @@ class Jeweler
46
45
  assert_equal '2.3.4', @gemspec.version.to_s
47
46
  end
48
47
 
49
- should_eventually "update gemspec date to the beginning of today" do
48
+ should_eventually 'update gemspec date to the beginning of today' do
50
49
  @command.run
51
- # FIXME apparently rubygems doesn't use Time.now under the hood when generating a date
50
+ # FIXME: apparently rubygems doesn't use Time.now under the hood when generating a date
52
51
  assert_equal Time.local(@now.year, @now.month, @now.day, 0, 0), @gemspec.date
53
52
  end
54
53
 
55
- should "write gemspec" do
54
+ should 'write gemspec' do
56
55
  @command.run
57
- assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
56
+ assert_received(@gemspec_helper, &:write)
58
57
  end
59
58
 
60
- should_eventually "output that the gemspec was written" do
59
+ should_eventually 'output that the gemspec was written' do
61
60
  @command.run
62
- assert_equal @output.string, "Generated: tmp/zomg.gemspec"
61
+ assert_equal @output.string, 'Generated: tmp/zomg.gemspec'
63
62
  end
64
-
65
63
  end
66
64
 
67
- build_command_context "building for jeweler" do
65
+ build_command_context 'building for jeweler' do
68
66
  setup do
69
67
  @command = Jeweler::Commands::WriteGemspec.build_for(@jeweler)
70
68
  end
71
69
 
72
- should "assign base_dir" do
70
+ should 'assign base_dir' do
73
71
  assert_same @base_dir, @command.base_dir
74
72
  end
75
73
 
76
- should "assign gemspec" do
74
+ should 'assign gemspec' do
77
75
  assert_same @gemspec, @command.gemspec
78
76
  end
79
77
 
80
- should "assign version" do
78
+ should 'assign version' do
81
79
  assert_same @version, @command.version
82
80
  end
83
81
 
84
- should "assign output" do
82
+ should 'assign output' do
85
83
  assert_same @output, @command.output
86
84
  end
87
85
 
88
- should "assign gemspec_helper" do
86
+ should 'assign gemspec_helper' do
89
87
  assert_same @gemspec_helper, @command.gemspec_helper
90
88
  end
91
89
 
92
- should "assign version_helper" do
90
+ should 'assign version_helper' do
93
91
  assert_same @version_helper, @command.version_helper
94
92
  end
95
93
 
96
- should "return WriteGemspec" do
94
+ should 'return WriteGemspec' do
97
95
  assert_kind_of Jeweler::Commands::WriteGemspec, @command
98
96
  end
99
97
  end
100
-
101
98
  end
102
99
  end
103
100
  end
@@ -4,29 +4,49 @@ class Jeweler
4
4
  module Commands
5
5
  module Version
6
6
  class TestBase < Test::Unit::TestCase
7
- build_command_context "build for jeweler" do
7
+ build_command_context 'build for jeweler' do
8
8
  setup do
9
9
  @command = Jeweler::Commands::Version::Base.build_for(@jeweler)
10
10
  end
11
11
 
12
- should "assign repo" do
12
+ should 'assign repo' do
13
13
  assert_equal @repo, @command.repo
14
14
  end
15
15
 
16
- should "assign version_helper" do
16
+ should 'assign version_helper' do
17
17
  assert_equal @version_helper, @command.version_helper
18
18
  end
19
19
 
20
- should "assign gemspec" do
20
+ should 'assign gemspec' do
21
21
  assert_equal @gemspec, @command.gemspec
22
22
  end
23
23
 
24
- should"assign commit" do
24
+ should 'assign commit' do
25
25
  assert_equal @commit, @command.commit
26
26
  end
27
+
28
+ context 'commit_version' do
29
+ setup do
30
+ @dir = Object.new
31
+ stub(@repo).dir { @dir }
32
+ stub(@dir).path { Dir.pwd }
33
+ stub(@version_helper).path { Pathname.new 'VERSION' }
34
+ stub(@version_helper).to_s { '1.0.0' }
35
+ stub(@repo) do
36
+ add(anything)
37
+ commit(anything)
38
+ end
39
+ @command.base_dir = Dir.pwd
40
+ @command.commit_version
41
+ end
42
+
43
+ should 'add VERSION' do
44
+ assert_received(@repo) { |repo| repo.add('VERSION') }
45
+ assert_received(@repo) { |repo| repo.commit('Version bump to 1.0.0') }
46
+ end
47
+ end
27
48
  end
28
49
  end
29
50
  end
30
51
  end
31
52
  end
32
-