juwelier 2.1.0

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