ggem 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,5 +2,4 @@ require "assert/factory"
2
2
 
3
3
  module Factory
4
4
  extend Assert::Factory
5
-
6
5
  end
@@ -1,3 +1,3 @@
1
1
  module GGem
2
- VERSION = "1.9.1"
2
+ VERSION = "1.9.2"
3
3
  end
File without changes
@@ -1,53 +1,48 @@
1
1
  require "much-plugin"
2
2
  require "scmd"
3
3
 
4
- module GGem
4
+ module GGem; end
5
+ module GGem::CmdTestsHelpers
6
+ include MuchPlugin
5
7
 
6
- module CmdTestsHelpers
7
- include MuchPlugin
8
+ plugin_included do
9
+ setup do
10
+ ENV["SCMD_TEST_MODE"] = "1"
8
11
 
9
- plugin_included do
10
- setup do
11
- ENV["SCMD_TEST_MODE"] = "1"
12
+ @cmd_spy = nil
13
+ Scmd.reset
12
14
 
13
- @cmd_spy = nil
14
- Scmd.reset
15
-
16
- @exp_cmds_run = []
17
- end
18
- teardown do
19
- Scmd.reset
20
- ENV.delete("SCMD_TEST_MODE")
21
- end
15
+ @exp_cmds_run = []
16
+ end
17
+ teardown do
18
+ Scmd.reset
19
+ ENV.delete("SCMD_TEST_MODE")
20
+ end
22
21
 
23
- private
22
+ private
24
23
 
25
- def assert_exp_cmds_run(&run_cmd_block)
26
- cmd_str, exitstatus, stdout = run_cmd_block.call
27
- assert_equal @exp_cmds_run, Scmd.calls.map(&:cmd_str)
24
+ def assert_exp_cmds_run(&run_cmd_block)
25
+ cmd_str, exitstatus, stdout = run_cmd_block.call
26
+ assert_equal @exp_cmds_run, Scmd.calls.map(&:cmd_str)
28
27
 
29
- assert_equal Scmd.calls.first.cmd_str, cmd_str
30
- assert_equal Scmd.calls.first.cmd.exitstatus, exitstatus
31
- assert_equal Scmd.calls.first.cmd.stdout, stdout
32
- end
28
+ assert_equal Scmd.calls.first.cmd_str, cmd_str
29
+ assert_equal Scmd.calls.first.cmd.exitstatus, exitstatus
30
+ assert_equal Scmd.calls.first.cmd.stdout, stdout
31
+ end
33
32
 
34
- def assert_exp_cmds_error(cmd_error_class, &run_cmd_block)
35
- err_cmd_str = @exp_cmds_run.sample
36
- Scmd.add_command(err_cmd_str) do |cmd|
37
- cmd.exitstatus = 1
38
- cmd.stderr = Factory.string
39
- @cmd_spy = cmd
40
- end
41
- err = nil
42
- begin; run_cmd_block.call; rescue StandardError => err; end
43
-
44
- assert_kind_of cmd_error_class, err
45
- exp = "#{@cmd_spy.cmd_str}\n#{@cmd_spy.stderr}"
46
- assert_equal exp, err.message
33
+ def assert_exp_cmds_error(cmd_error_class, &run_cmd_block)
34
+ err_cmd_str = @exp_cmds_run.sample
35
+ Scmd.add_command(err_cmd_str) do |cmd|
36
+ cmd.exitstatus = 1
37
+ cmd.stderr = Factory.string
38
+ @cmd_spy = cmd
47
39
  end
40
+ err = nil
41
+ begin; run_cmd_block.call; rescue StandardError => err; end
48
42
 
43
+ assert_kind_of cmd_error_class, err
44
+ exp = "#{@cmd_spy.cmd_str}\n#{@cmd_spy.stderr}"
45
+ assert_equal exp, err.message
49
46
  end
50
-
51
47
  end
52
-
53
48
  end
@@ -2,5 +2,4 @@ require "assert/factory"
2
2
 
3
3
  module Factory
4
4
  extend Assert::Factory
5
-
6
5
  end
@@ -1,73 +1,67 @@
1
- module GGem
2
- module NameSet
1
+ module GGem; end
2
+ module GGem::NameSet
3
+ class Base
4
+ attr_reader :variations, :name, :module_name, :ruby_name
3
5
 
4
- class Base
5
- attr_reader :variations, :name, :module_name, :ruby_name
6
-
7
- def expected_folders
8
- [ "",
9
- ".circleci",
10
- "lib",
11
- "lib/#{@ruby_name}",
12
- "test",
13
- "test/support",
14
- "test/system",
15
- "test/unit",
16
- "log",
17
- "tmp"
18
- ]
19
- end
20
-
21
- def expected_files
22
- [ ".circleci/config.yml",
6
+ def expected_folders
7
+ [ "",
8
+ "lib",
9
+ "lib/#{@ruby_name}",
10
+ "test",
11
+ "test/support",
12
+ "test/system",
13
+ "test/unit",
14
+ "log",
15
+ "tmp"
16
+ ]
17
+ end
23
18
 
24
- ".ruby-version",
25
- ".gitignore",
26
- "Gemfile",
27
- "#{@name}.gemspec",
28
- "README.md",
29
- "LICENSE",
19
+ def expected_files
20
+ [ ".ruby-version",
21
+ ".gitignore",
22
+ "Gemfile",
23
+ "#{@name}.gemspec",
24
+ "README.md",
25
+ "LICENSE",
30
26
 
31
- "lib/#{@ruby_name}.rb",
32
- "lib/#{@ruby_name}/version.rb",
27
+ "lib/#{@ruby_name}.rb",
28
+ "lib/#{@ruby_name}/version.rb",
33
29
 
34
- "test/helper.rb",
35
- "test/support/factory.rb",
30
+ "test/helper.rb",
31
+ "test/support/factory.rb",
36
32
 
37
- "log/.gitkeep",
38
- "test/system/.gitkeep",
39
- "test/unit/.gitkeep",
40
- "tmp/.gitkeep",
41
- ]
42
- end
33
+ "log/.keep",
34
+ "test/system/.keep",
35
+ "test/unit/.keep",
36
+ "tmp/.keep",
37
+ ]
43
38
  end
39
+ end
44
40
 
45
- class Simple < Base
46
- def initialize
47
- @variations = ["simple"]
48
- @name = "simple"
49
- @module_name = "Simple"
50
- @ruby_name = "simple"
51
- end
41
+ class Simple < Base
42
+ def initialize
43
+ @variations = ["simple"]
44
+ @name = "simple"
45
+ @module_name = "Simple"
46
+ @ruby_name = "simple"
52
47
  end
48
+ end
53
49
 
54
- class Underscored < Base
55
- def initialize
56
- @variations = ["my_gem", "my__gem", "MyGem", "myGem", "My_Gem"]
57
- @name = "my_gem"
58
- @module_name = "MyGem"
59
- @ruby_name = "my_gem"
60
- end
50
+ class Underscored < Base
51
+ def initialize
52
+ @variations = ["my_gem", "my__gem", "MyGem", "myGem", "My_Gem"]
53
+ @name = "my_gem"
54
+ @module_name = "MyGem"
55
+ @ruby_name = "my_gem"
61
56
  end
57
+ end
62
58
 
63
- class HyphenatedOther < Base
64
- def initialize
65
- @variations = ["my-gem"]
66
- @name = "my-gem"
67
- @module_name = "MyGem"
68
- @ruby_name = "my-gem"
69
- end
59
+ class HyphenatedOther < Base
60
+ def initialize
61
+ @variations = ["my-gem"]
62
+ @name = "my-gem"
63
+ @module_name = "MyGem"
64
+ @ruby_name = "my-gem"
70
65
  end
71
-
72
66
  end
73
67
  end
@@ -4,7 +4,6 @@ require "ggem"
4
4
  require "test/support/name_set"
5
5
 
6
6
  module GGem
7
-
8
7
  class SystemTests < Assert::Context
9
8
 
10
9
  NS_SIMPLE = GGem::NameSet::Simple
@@ -12,7 +11,6 @@ module GGem
12
11
  NS_HYPHEN = GGem::NameSet::HyphenatedOther
13
12
 
14
13
  desc "GGem"
15
-
16
14
  end
17
15
 
18
16
  class GemTests < SystemTests
@@ -34,7 +32,6 @@ module GGem
34
32
  assert_equal name_set.ruby_name, the_gem.ruby_name
35
33
  end
36
34
  end
37
-
38
35
  end
39
36
 
40
37
  class GemSaveTests < GemTests
@@ -67,7 +64,5 @@ module GGem
67
64
  assert File.exists?(path), "`#{path}` does not exist"
68
65
  end
69
66
  end
70
-
71
67
  end
72
-
73
68
  end
@@ -9,7 +9,6 @@ require "ggem/git_repo"
9
9
  require "much-plugin"
10
10
 
11
11
  class GGem::CLI
12
-
13
12
  class UnitTests < Assert::Context
14
13
  desc "GGem::CLI"
15
14
  setup do
@@ -47,7 +46,6 @@ class GGem::CLI
47
46
  assert_same COMMANDS["tag"], COMMANDS["t"]
48
47
  assert_same COMMANDS["release"], COMMANDS["r"]
49
48
  end
50
-
51
49
  end
52
50
 
53
51
  class InitTests < UnitTests
@@ -62,7 +60,6 @@ class GGem::CLI
62
60
  subject{ @cli }
63
61
 
64
62
  should have_imeths :run
65
-
66
63
  end
67
64
 
68
65
  class RunSetupTests < InitTests
@@ -80,7 +77,6 @@ class GGem::CLI
80
77
  teardown do
81
78
  COMMANDS.remove(@command_name)
82
79
  end
83
-
84
80
  end
85
81
 
86
82
  class RunTests < RunSetupTests
@@ -96,7 +92,6 @@ class GGem::CLI
96
92
  should "have successfully exited" do
97
93
  assert_equal 0, @kernel_spy.exit_status
98
94
  end
99
-
100
95
  end
101
96
 
102
97
  class RunWithNoArgsTests < RunSetupTests
@@ -113,7 +108,6 @@ class GGem::CLI
113
108
  should "have successfully exited" do
114
109
  assert_equal 0, @kernel_spy.exit_status
115
110
  end
116
-
117
111
  end
118
112
 
119
113
  class RunWithInvalidCommandTests < RunSetupTests
@@ -133,7 +127,6 @@ class GGem::CLI
133
127
  should "have unsuccessfully exited" do
134
128
  assert_equal 1, @kernel_spy.exit_status
135
129
  end
136
-
137
130
  end
138
131
 
139
132
  class RunWithCommandExitErrorTests < RunSetupTests
@@ -147,7 +140,6 @@ class GGem::CLI
147
140
  assert_equal 1, @kernel_spy.exit_status
148
141
  assert_empty @stderr.read
149
142
  end
150
-
151
143
  end
152
144
 
153
145
  class RunWithHelpTests < RunSetupTests
@@ -164,7 +156,6 @@ class GGem::CLI
164
156
  should "have successfully exited" do
165
157
  assert_equal 0, @kernel_spy.exit_status
166
158
  end
167
-
168
159
  end
169
160
 
170
161
  class RunWithVersionTests < RunSetupTests
@@ -181,7 +172,6 @@ class GGem::CLI
181
172
  should "have successfully exited" do
182
173
  assert_equal 0, @kernel_spy.exit_status
183
174
  end
184
-
185
175
  end
186
176
 
187
177
  class RunWithErrorTests < RunSetupTests
@@ -201,7 +191,6 @@ class GGem::CLI
201
191
  should "have unsuccessfully exited" do
202
192
  assert_equal 1, @kernel_spy.exit_status
203
193
  end
204
-
205
194
  end
206
195
 
207
196
  class InvalidCommandTests < UnitTests
@@ -247,7 +236,6 @@ class GGem::CLI
247
236
  "#{COMMANDS.to_s.split("\n").map{ |l| " #{l}" }.join("\n")}\n"
248
237
  assert_equal exp, subject.help
249
238
  end
250
-
251
239
  end
252
240
 
253
241
  class IOCommandTests < UnitTests
@@ -256,7 +244,6 @@ class GGem::CLI
256
244
  @stdout, @stderr = IOSpy.new, IOSpy.new
257
245
  end
258
246
  subject{ @cmd }
259
-
260
247
  end
261
248
 
262
249
  class ValidCommandTests < IOCommandTests
@@ -289,7 +276,6 @@ class GGem::CLI
289
276
  should "default its summary" do
290
277
  assert_equal "", subject.summary
291
278
  end
292
-
293
279
  end
294
280
 
295
281
  class GitRepoCommandTests < IOCommandTests
@@ -314,7 +300,6 @@ class GGem::CLI
314
300
  @command_class.new
315
301
  assert_equal [Dir.pwd], gitrepo_new_called_with
316
302
  end
317
-
318
303
  end
319
304
 
320
305
  module RootPathTests
@@ -326,7 +311,6 @@ class GGem::CLI
326
311
  Assert.stub(Dir, :pwd){ @root_path }
327
312
  end
328
313
  end
329
-
330
314
  end
331
315
 
332
316
  module GitRepoSpyTests
@@ -339,9 +323,7 @@ class GGem::CLI
339
323
  @repo_spy = nil
340
324
  Assert.stub(GGem::GitRepo, :new){ |*args| @repo_spy = GitRepoSpy.new(*args) }
341
325
  end
342
-
343
326
  end
344
-
345
327
  end
346
328
 
347
329
  class GenerateCommandTests < IOCommandTests
@@ -411,7 +393,6 @@ class GGem::CLI
411
393
  assert_equal exp, err.message
412
394
  assert_not_empty err.backtrace
413
395
  end
414
-
415
396
  end
416
397
 
417
398
  class GemspecCommandTests < IOCommandTests
@@ -449,7 +430,6 @@ class GGem::CLI
449
430
  exp = "There are no gemspecs at #{Dir.pwd}"
450
431
  assert_equal exp, err.message
451
432
  end
452
-
453
433
  end
454
434
 
455
435
  module GemspecSpyTests
@@ -463,7 +443,6 @@ class GGem::CLI
463
443
  Assert.stub(GGem::Gemspec, :new){ |*args| @spec_spy = GemspecSpy.new(*args) }
464
444
  end
465
445
  end
466
-
467
446
  end
468
447
 
469
448
  class BuildCommandTests < IOCommandTests
@@ -513,7 +492,6 @@ class GGem::CLI
513
492
  assert_raises(CommandExitError){ subject.run([], @stdout, @stderr) }
514
493
  assert_equal "#{err_msg}\n", @stderr.read
515
494
  end
516
-
517
495
  end
518
496
 
519
497
  class InstallCommandTests < IOCommandTests
@@ -571,7 +549,6 @@ class GGem::CLI
571
549
  assert_raises(CommandExitError){ subject.run(@argv, @stdout, @stderr) }
572
550
  assert_equal "#{err_msg}\n", @stderr.read
573
551
  end
574
-
575
552
  end
576
553
 
577
554
  class PushCommandTests < IOCommandTests
@@ -630,7 +607,6 @@ class GGem::CLI
630
607
  assert_raises(CommandExitError){ subject.run(@argv, @stdout, @stderr) }
631
608
  assert_equal "#{err_msg}\n", @stderr.read
632
609
  end
633
-
634
610
  end
635
611
 
636
612
  class ForceTagOptionCommandTests < IOCommandTests
@@ -648,7 +624,6 @@ class GGem::CLI
648
624
  subject.run(["-f"], @stdout, @stderr)
649
625
  assert_true subject.clirb.opts["force-tag"]
650
626
  end
651
-
652
627
  end
653
628
 
654
629
  class TagCommandTests < IOCommandTests
@@ -757,7 +732,6 @@ class GGem::CLI
757
732
  assert_raises(CommandExitError){ subject.run([], @stdout, @stderr) }
758
733
  assert_equal "#{err_msg}\n", @stderr.read
759
734
  end
760
-
761
735
  end
762
736
 
763
737
  class ReleaseCommandTests < IOCommandTests
@@ -821,7 +795,6 @@ class GGem::CLI
821
795
  assert_true @push_spy.run_called
822
796
  assert_equal [], @push_spy.argv
823
797
  end
824
-
825
798
  end
826
799
 
827
800
  class CommandSetTests < UnitTests
@@ -878,7 +851,6 @@ class GGem::CLI
878
851
  subject[unknown_cmd_name]
879
852
  assert_equal [unknown_cmd_name], @unknown_cmd_block_called_with
880
853
  end
881
-
882
854
  end
883
855
 
884
856
  class CLISpy
@@ -1003,7 +975,6 @@ class GGem::CLI
1003
975
  @run_push_cmd_called = true
1004
976
  ["push", 0, "push cmd was run"]
1005
977
  end
1006
-
1007
978
  end
1008
979
 
1009
980
  class GitRepoSpy
@@ -1056,7 +1027,5 @@ class GGem::CLI
1056
1027
  @run_push_cmd_called = true
1057
1028
  ["push", 0, "push cmd was run"]
1058
1029
  end
1059
-
1060
1030
  end
1061
-
1062
1031
  end