technicalpickles-jeweler 0.8.1 → 0.9.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 (59) hide show
  1. data/ChangeLog.markdown +27 -7
  2. data/README.markdown +9 -3
  3. data/Rakefile +30 -24
  4. data/TODO +2 -2
  5. data/VERSION.yml +2 -2
  6. data/bin/jeweler +1 -77
  7. data/lib/jeweler/commands/build_gem.rb +22 -0
  8. data/lib/jeweler/commands/install_gem.rb +19 -0
  9. data/lib/jeweler/commands/release.rb +45 -0
  10. data/lib/jeweler/commands/validate_gemspec.rb +21 -0
  11. data/lib/jeweler/commands/version/base.rb +30 -0
  12. data/lib/jeweler/commands/version/bump_major.rb +13 -0
  13. data/lib/jeweler/commands/version/bump_minor.rb +12 -0
  14. data/lib/jeweler/commands/version/bump_patch.rb +14 -0
  15. data/lib/jeweler/commands/version/write.rb +12 -0
  16. data/lib/jeweler/commands/write_gemspec.rb +26 -0
  17. data/lib/jeweler/commands.rb +10 -0
  18. data/lib/jeweler/{gemspec.rb → gemspec_helper.rb} +7 -1
  19. data/lib/jeweler/generator/application.rb +45 -0
  20. data/lib/jeweler/generator/options.rb +64 -0
  21. data/lib/jeweler/generator.rb +66 -26
  22. data/lib/jeweler/tasks.rb +11 -29
  23. data/lib/jeweler/templates/.gitignore +3 -1
  24. data/lib/jeweler/templates/LICENSE +1 -1
  25. data/lib/jeweler/templates/README.rdoc +7 -0
  26. data/lib/jeweler/templates/Rakefile +48 -31
  27. data/lib/jeweler/templates/bacon/flunking.rb +1 -1
  28. data/lib/jeweler/templates/bacon/helper.rb +1 -1
  29. data/lib/jeweler/templates/features/support/env.rb +0 -2
  30. data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
  31. data/lib/jeweler/templates/micronaut/helper.rb +17 -0
  32. data/lib/jeweler/templates/minitest/flunking.rb +1 -1
  33. data/lib/jeweler/templates/minitest/helper.rb +1 -0
  34. data/lib/jeweler/templates/rspec/flunking.rb +1 -1
  35. data/lib/jeweler/templates/rspec/helper.rb +1 -1
  36. data/lib/jeweler/templates/shoulda/flunking.rb +2 -2
  37. data/lib/jeweler/templates/shoulda/helper.rb +1 -1
  38. data/lib/jeweler/templates/testunit/flunking.rb +1 -1
  39. data/lib/jeweler/templates/testunit/helper.rb +1 -1
  40. data/lib/jeweler/{version.rb → version_helper.rb} +1 -1
  41. data/lib/jeweler.rb +59 -141
  42. data/test/jeweler/commands/test_build_gem.rb +53 -0
  43. data/{lib/jeweler/templates/features/steps/default_steps.rb → test/jeweler/commands/test_install_gem.rb} +0 -0
  44. data/test/jeweler/commands/test_release.rb +145 -0
  45. data/test/jeweler/commands/test_write_gemspec.rb +58 -0
  46. data/test/jeweler/commands/version/test_bump_major.rb +21 -0
  47. data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
  48. data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
  49. data/test/jeweler/commands/version/test_write.rb +23 -0
  50. data/test/test_application.rb +109 -0
  51. data/test/{test_gemspec.rb → test_gemspec_helper.rb} +9 -5
  52. data/test/test_generator.rb +179 -0
  53. data/test/test_helper.rb +11 -23
  54. data/test/test_jeweler.rb +12 -9
  55. data/test/test_options.rb +90 -0
  56. data/test/test_tasks.rb +3 -4
  57. data/test/{test_version.rb → test_version_helper.rb} +16 -16
  58. metadata +44 -11
  59. data/lib/jeweler/templates/README +0 -9
data/lib/jeweler.rb CHANGED
@@ -1,237 +1,155 @@
1
1
  require 'date'
2
2
  require 'rubygems/builder'
3
3
 
4
- require 'jeweler/version'
5
- require 'jeweler/gemspec'
4
+ require 'jeweler/version_helper'
5
+ require 'jeweler/gemspec_helper'
6
6
  require 'jeweler/errors'
7
7
  require 'jeweler/generator'
8
+ require 'jeweler/generator/options'
9
+ require 'jeweler/generator/application'
10
+
11
+ require 'jeweler/commands'
8
12
 
9
13
  require 'jeweler/tasks'
10
14
 
11
15
  # A Jeweler helps you craft the perfect Rubygem. Give him a gemspec, and he takes care of the rest.
12
16
  class Jeweler
13
17
 
14
- attr_reader :gemspec
15
- attr_accessor :base_dir
18
+ attr_reader :gemspec, :gemspec_helper
19
+ attr_accessor :base_dir, :output
16
20
 
17
21
  def initialize(gemspec, base_dir = '.')
18
22
  raise(GemspecError, "Can't create a Jeweler with a nil gemspec") if gemspec.nil?
19
- @gemspec = gemspec
20
- @base_dir = base_dir
21
-
22
- if @gemspec.files.nil? || @gemspec.files.empty?
23
- @gemspec.files = FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
24
- end
25
-
26
- if @gemspec.executables.nil? || @gemspec.executables.empty?
27
- @gemspec.executables = Dir["#{@base_dir}/bin/*"].map do |f|
28
- File.basename(f)
29
- end
30
- end
31
-
32
- @gemspec.has_rdoc = true
33
- @gemspec.rdoc_options << '--inline-source' << '--charset=UTF-8'
34
- @gemspec.extra_rdoc_files ||= FileList["[A-Z]*.*"]
35
23
 
36
- if File.exists?(File.join(base_dir, '.git'))
37
- @repo = Git.open(base_dir)
38
- end
39
-
40
- @version = Jeweler::Version.new(@base_dir)
24
+ @base_dir = base_dir
25
+ @gemspec = fill_in_gemspec_defaults(gemspec)
26
+ @repo = Git.open(base_dir) if in_git_repo?
27
+ @version_helper = Jeweler::VersionHelper.new(@base_dir)
28
+ @output = $stdout
29
+ @gemspec_helper = GemSpecHelper.new(@gemspec,base_dir)
41
30
  end
42
31
 
43
32
  # Major version, as defined by the gemspec's Version module.
44
33
  # For 1.5.3, this would return 1.
45
34
  def major_version
46
- @version.major
35
+ @version_helper.major
47
36
  end
48
37
 
49
38
  # Minor version, as defined by the gemspec's Version module.
50
39
  # For 1.5.3, this would return 5.
51
40
  def minor_version
52
- @version.minor
41
+ @version_helper.minor
53
42
  end
54
43
 
55
44
  # Patch version, as defined by the gemspec's Version module.
56
45
  # For 1.5.3, this would return 5.
57
46
  def patch_version
58
- @version.patch
47
+ @version_helper.patch
59
48
  end
60
49
 
61
50
  # Human readable version, which is used in the gemspec.
62
51
  def version
63
- @version.to_s
52
+ @version_helper.to_s
64
53
  end
65
54
 
66
55
  # Writes out the gemspec
67
56
  def write_gemspec
68
- self.refresh_version
69
-
70
- helper = gemspec_helper do |s|
71
- s.version = self.version
72
- s.date = Time.now
73
- end
74
-
75
- helper.write
76
-
77
- puts "Generated: #{helper.path}"
57
+ build_command(Jeweler::Commands::WriteGemspec).run
78
58
  end
79
59
 
80
60
  # Validates the project's gemspec from disk in an environment similar to how
81
61
  # GitHub would build from it. See http://gist.github.com/16215
82
62
  def validate_gemspec
83
- begin
84
- gemspec_helper.parse
85
- puts "#{gemspec_path} is valid."
86
- rescue Exception => e
87
- puts "#{gemspec_path} is invalid. See the backtrace for more details."
88
- raise
89
- end
63
+ build_command(Jeweler::Commands::ValidateGemspec).run
90
64
  end
91
65
 
92
-
93
66
  # is the project's gemspec from disk valid?
94
67
  def valid_gemspec?
95
68
  gemspec_helper.valid?
96
69
  end
97
70
 
98
- # parses the project's gemspec from disk without extra sanity checks
99
- def unsafe_parse_gemspec(data = nil)
100
- data ||= File.read(gemspec_path)
101
- eval(data, binding, gemspec_path)
102
- end
103
-
104
71
  def build_gem
105
- parsed_gemspec = unsafe_parse_gemspec()
106
- Gem::Builder.new(parsed_gemspec).build
107
-
108
- pkg_dir = File.join(@base_dir, 'pkg')
109
- FileUtils.mkdir_p pkg_dir
110
-
111
- gem_filename = File.join(@base_dir, parsed_gemspec.file_name)
112
- FileUtils.mv gem_filename, pkg_dir
72
+ build_command(Jeweler::Commands::BuildGem).run
113
73
  end
114
74
 
115
75
  def install_gem
116
- command = "sudo gem install #{gem_path}"
117
- $stdout.puts "Executing #{command.inspect}:"
118
- sh command
76
+ build_command(Jeweler::Commands::InstallGem).run
119
77
  end
120
78
 
121
79
  # Bumps the patch version.
122
80
  #
123
81
  # 1.5.1 -> 1.5.2
124
82
  def bump_patch_version(options = {})
125
- options = version_writing_options(options)
126
-
127
- @version.bump_patch
128
- @version.write
129
-
130
- commit_version if options[:commit]
83
+ build_command(Jeweler::Commands::Version::BumpPatch).run
131
84
  end
132
85
 
133
86
  # Bumps the minor version.
134
87
  #
135
88
  # 1.5.1 -> 1.6.0
136
89
  def bump_minor_version(options = {})
137
- options = version_writing_options(options)
138
-
139
- @version.bump_minor
140
- @version.write
141
-
142
- commit_version if options[:commit]
90
+ build_command(Jeweler::Commands::Version::BumpMinor).run
143
91
  end
144
92
 
145
93
  # Bumps the major version.
146
94
  #
147
95
  # 1.5.1 -> 2.0.0
148
96
  def bump_major_version(options = {})
149
- options = version_writing_options(options)
150
-
151
- @version.bump_major
152
- @version.write
153
-
154
- commit_version if options[:commit]
97
+ build_command(Jeweler::Commands::Version::BumpMajor).run
155
98
  end
156
99
 
157
100
  # Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.
158
101
  def write_version(major, minor, patch, options = {})
159
- options = version_writing_options(options)
102
+ command = build_command(Jeweler::Commands::Version::Write)
103
+ command.major = major
104
+ command.minor = minor
105
+ command.patch = patch
160
106
 
161
- @version.update_to major, minor, patch
162
- @version.write
163
-
164
- @gemspec.version = @version.to_s
165
-
166
- commit_version if options[:commit]
107
+ command.run
167
108
  end
168
109
 
169
-
170
110
  def release
171
- @repo.checkout('master')
172
-
173
- raise "Hey buddy, try committing them files first" if any_pending_changes?
174
-
175
- write_gemspec()
176
-
177
- @repo.add(gemspec_path)
178
- $stdout.puts "Committing #{gemspec_path}"
179
- @repo.commit("Regenerated gemspec for version #{version}")
180
-
181
- $stdout.puts "Pushing master to origin"
182
- @repo.push
183
-
184
- $stdout.puts "Tagging #{release_tag}"
185
- @repo.add_tag(release_tag)
186
-
187
- $stdout.puts "Pushing #{release_tag} to origin"
188
- @repo.push('origin', release_tag)
189
- end
190
-
191
- def release_tag
192
- @release_tag ||= "v#{version}"
111
+ build_command(Jeweler::Commands::Release).run
193
112
  end
194
113
 
195
114
  protected
196
115
 
197
- def version_writing_options(options)
198
- {:commit => true}.merge(options)
199
- end
116
+ def build_command(command_class)
117
+ command = command_class.new
118
+ command.repo = @repo if command.respond_to?(:repo=)
119
+ command.version_helper = @version_helper if command.respond_to?(:version_helper=)
120
+ command.gemspec = @gemspec if command.respond_to?(:gemspec=)
121
+ command.commit = true if command.respond_to?(:commit=)
122
+ command.version = self.version if command.respond_to?(:version=)
123
+ command.output = output if command.respond_to?(:output=)
124
+ command.base_dir = @base_dir if command.respond_to?(:base_dir=)
125
+ command.gemspec_helper = GemSpecHelper.new(@gemspec, @base_dir) if command.respond_to?(:gemspec_helper)
200
126
 
201
- def commit_version
202
- if @repo
203
- @repo.add('VERSION.yml')
204
- @repo.commit("Version bump to #{version}", 'VERSION.yml')
205
- end
127
+ command
206
128
  end
207
129
 
208
- def refresh_version
209
- @version.refresh
130
+ def in_git_repo?
131
+ File.exists?(File.join(self.base_dir, '.git'))
210
132
  end
211
133
 
212
- def gemspec_helper(&block)
213
- GemSpecHelper.new(@gemspec, @base_dir, &block)
214
- end
134
+ def fill_in_gemspec_defaults(gemspec)
135
+ if gemspec.files.nil? || gemspec.files.empty?
136
+ gemspec.files = FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
137
+ end
215
138
 
216
- def gemspec_path
217
- gemspec_helper.path
218
- end
139
+ if gemspec.executables.nil? || gemspec.executables.empty?
140
+ gemspec.executables = Dir["#{@base_dir}/bin/*"].map do |f|
141
+ File.basename(f)
142
+ end
143
+ end
219
144
 
220
- def gem_path
221
- parsed_gemspec = unsafe_parse_gemspec()
222
- File.join(@base_dir, 'pkg', parsed_gemspec.file_name)
223
- end
145
+ gemspec.has_rdoc = true
146
+ gemspec.rdoc_options << '--inline-source' << '--charset=UTF-8'
224
147
 
225
- def any_pending_changes?
226
- unless ENV['JEWELER_DEBUG'].nil? || ENV['JEWELER_DEBUG'].squeeze == ''
227
- require 'ruby-debug'; breakpoint
148
+ if gemspec.extra_rdoc_files.nil? || gemspec.extra_rdoc_files.empty?
149
+ gemspec.extra_rdoc_files = FileList["README*", "ChangeLog*", "LICENSE*"]
228
150
  end
229
- !(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?)
230
- end
231
151
 
232
- protected
233
- def any_pending_changes?
234
- !(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?)
235
- end
152
+ gemspec
153
+ end
236
154
  end
237
155
 
@@ -0,0 +1,53 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ class TestBuildGem < Test::Unit::TestCase
6
+
7
+ context "after running" do
8
+ setup do
9
+ @gemspec = Object.new
10
+ stub(@gemspec).file_name { 'zomg-1.2.3.gem' }
11
+
12
+ @gemspec_helper = Object.new
13
+ stub(@gemspec_helper).parse { @gemspec }
14
+
15
+ @builder = Object.new
16
+ stub(Gem::Builder).new { @builder }
17
+ stub(@builder).build { 'zomg-1.2.3.gem' }
18
+
19
+ @file_utils = Object.new
20
+ stub(@file_utils).mkdir_p './pkg'
21
+ stub(@file_utils).mv './zomg-1.2.3.gem', './pkg'
22
+
23
+ @base_dir = '.'
24
+
25
+ @command = Jeweler::Commands::BuildGem.new
26
+ @command.base_dir = @base_dir
27
+ @command.file_utils = @file_utils
28
+ @command.gemspec_helper = @gemspec_helper
29
+
30
+ @command.run
31
+ end
32
+
33
+ should "call gemspec helper's parse" do
34
+ assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.parse }
35
+ end
36
+
37
+ should "build from parsed gemspec" do
38
+ assert_received(Gem::Builder) {|builder_class| builder_class.new(@gemspec) }
39
+ assert_received(@builder) {|builder| builder.build }
40
+ end
41
+
42
+ should 'make package directory' do
43
+ assert_received(@file_utils) {|file_utils| file_utils.mkdir_p './pkg'}
44
+ end
45
+
46
+ should 'move built gem into package directory' do
47
+ assert_received(@file_utils) {|file_utils| file_utils.mv './zomg-1.2.3.gem', './pkg'}
48
+ end
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,145 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ class TestRelease < Test::Unit::TestCase
6
+
7
+ context "with added files" do
8
+ setup do
9
+ @repo = Object.new
10
+ stub(@repo).checkout(anything)
11
+
12
+ status = Object.new
13
+ stub(status).added { ['README'] }
14
+ stub(status).deleted { [] }
15
+ stub(status).changed { [] }
16
+ stub(@repo).status { status }
17
+
18
+ @command = Jeweler::Commands::Release.new
19
+ @command.output = @output
20
+ @command.repo = @repo
21
+ @command.gemspec_helper = @gemspec_helper
22
+ @command.version = '1.2.3'
23
+ end
24
+
25
+ should 'raise error' do
26
+ assert_raises RuntimeError, /try commiting/i do
27
+ @command.run
28
+ end
29
+ end
30
+ end
31
+
32
+ context "with deleted files" do
33
+ setup do
34
+ @repo = Object.new
35
+ stub(@repo).checkout(anything)
36
+
37
+ status = Object.new
38
+ stub(status).added { [] }
39
+ stub(status).deleted { ['README'] }
40
+ stub(status).changed { [] }
41
+ stub(@repo).status { status }
42
+
43
+ @command = Jeweler::Commands::Release.new
44
+ @command.output = @output
45
+ @command.repo = @repo
46
+ @command.gemspec_helper = @gemspec_helper
47
+ @command.version = '1.2.3'
48
+ @command.base_dir = '.'
49
+ end
50
+
51
+ should 'raise error' do
52
+ assert_raises RuntimeError, /try commiting/i do
53
+ @command.run
54
+ end
55
+ end
56
+ end
57
+
58
+ context "with changed files" do
59
+ setup do
60
+ @repo = Object.new
61
+ stub(@repo).checkout(anything)
62
+
63
+ status = Object.new
64
+ stub(status).added { [] }
65
+ stub(status).deleted { [] }
66
+ stub(status).changed { ['README'] }
67
+ stub(@repo).status { status }
68
+
69
+ @command = Jeweler::Commands::Release.new
70
+ @command.output = @output
71
+ @command.repo = @repo
72
+ @command.gemspec_helper = @gemspec_helper
73
+ @command.version = '1.2.3'
74
+ end
75
+
76
+ should 'raise error' do
77
+ assert_raises RuntimeError, /try commiting/i do
78
+ @command.run
79
+ end
80
+ end
81
+ end
82
+
83
+ context "after running without pending changes" do
84
+ setup do
85
+ @repo = Object.new
86
+ stub(@repo).checkout(anything)
87
+ stub(@repo).add(anything)
88
+ stub(@repo).commit(anything)
89
+ stub(@repo).push
90
+ stub(@repo).push(anything)
91
+ stub(@repo).add_tag(anything)
92
+
93
+ @gemspec_helper = Object.new
94
+ stub(@gemspec_helper).write
95
+ stub(@gemspec_helper).path {'zomg.gemspec'}
96
+
97
+ status = Object.new
98
+ stub(status).added { [] }
99
+ stub(status).deleted { [] }
100
+ stub(status).changed { [] }
101
+ stub(@repo).status { status }
102
+
103
+ @output = StringIO.new
104
+
105
+ @command = Jeweler::Commands::Release.new
106
+ @command.output = @output
107
+ @command.repo = @repo
108
+ @command.gemspec_helper = @gemspec_helper
109
+ @command.version = '1.2.3'
110
+
111
+ @command.run
112
+ end
113
+
114
+ should "checkout master" do
115
+ assert_received(@repo) {|repo| repo.checkout('master') }
116
+ end
117
+
118
+ should "write gemspec" do
119
+ assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
120
+
121
+ end
122
+
123
+ should "add gemspec to repository" do
124
+ assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
125
+ end
126
+
127
+ should "commit with commit message including version" do
128
+ assert_received(@repo) {|repo| repo.commit("Regenerated gemspec for version 1.2.3") }
129
+ end
130
+
131
+ should "push repository" do
132
+ assert_received(@repo) {|repo| repo.push }
133
+ end
134
+
135
+ should "tag release" do
136
+ assert_received(@repo) {|repo| repo.add_tag("v1.2.3")}
137
+ end
138
+
139
+ should "push tag to repository" do
140
+ assert_received(@repo) {|repo| repo.push('origin', 'v1.2.3')}
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,58 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ class TestWriteGemspec < Test::Unit::TestCase
6
+
7
+ context "after run" do
8
+ setup do
9
+ @gemspec = Gem::Specification.new {|s| s.name = 'zomg' }
10
+ @gemspec_helper = Object.new
11
+ stub(@gemspec_helper).spec { @gemspec }
12
+ stub(@gemspec_helper).path { 'zomg.gemspec' }
13
+ stub(@gemspec_helper).write
14
+
15
+ @output = StringIO.new
16
+
17
+ @version_helper = Object.new
18
+ stub(@version_helper).to_s { '1.2.3' }
19
+ stub(@version_helper).refresh
20
+
21
+ @command = Jeweler::Commands::WriteGemspec.new
22
+ @command.base_dir = 'tmp'
23
+ @command.version_helper = @version_helper
24
+ @command.gemspec = @gemspec
25
+ @command.output = @output
26
+ @command.gemspec_helper = @gemspec_helper
27
+
28
+ @now = Time.now
29
+ stub(Time.now).now { @now }
30
+
31
+ @command.run
32
+ end
33
+
34
+ should "refresh version" do
35
+ assert_received(@version_helper) {|version_helper| version_helper.refresh }
36
+ end
37
+
38
+ should "update gemspec version" do
39
+ assert_equal '1.2.3', @gemspec.version.to_s
40
+ end
41
+
42
+ should "update gemspec date to the beginning of today" do
43
+ assert_equal Time.mktime(@now.year, @now.month, @now.day, 0, 0), @gemspec.date
44
+ end
45
+
46
+ should "write gemspec" do
47
+ assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
48
+ end
49
+
50
+ should_eventually "output that the gemspec was written" do
51
+ assert_equal @output.string, "Generated: tmp/zomg.gemspec"
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ module Version
6
+ class TestBumpMajor < Test::Unit::TestCase
7
+
8
+ should "call bump_major on version_helper in update_version" do
9
+ mock(version_helper = Object.new).bump_major
10
+
11
+ command = Jeweler::Commands::Version::BumpMajor.new
12
+ command.version_helper = version_helper
13
+
14
+ command.update_version
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ module Version
6
+ class TestBumpMinor < Test::Unit::TestCase
7
+
8
+ should "call bump_minor on version_helper in update_version" do
9
+ mock(version_helper = Object.new).bump_minor
10
+
11
+ command = Jeweler::Commands::Version::BumpMinor.new
12
+ command.version_helper = version_helper
13
+
14
+ command.update_version
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ module Version
6
+ class TestBumpPatch < Test::Unit::TestCase
7
+
8
+ should "call bump_patch on version_helper in update_version" do
9
+ mock(version_helper = Object.new).bump_patch
10
+
11
+ command = Jeweler::Commands::Version::BumpPatch.new
12
+ command.version_helper = version_helper
13
+
14
+ command.update_version
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,23 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ module Version
6
+ class TestWrite < Test::Unit::TestCase
7
+
8
+ should "call write_version on version_helper in update_version" do
9
+ mock(version_helper = Object.new).update_to 1, 2, 3
10
+
11
+ command = Jeweler::Commands::Version::Write.new
12
+ command.version_helper = version_helper
13
+ command.major = 1
14
+ command.minor = 2
15
+ command.patch = 3
16
+
17
+ command.update_version
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+