methadone 1.9.5 → 2.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 (56) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +2 -5
  5. data/README.rdoc +75 -47
  6. data/Rakefile +25 -29
  7. data/bin/methadone +13 -5
  8. data/lib/methadone.rb +1 -1
  9. data/lib/methadone/cli_logger.rb +0 -1
  10. data/lib/methadone/cli_logging.rb +1 -1
  11. data/lib/methadone/cucumber.rb +4 -0
  12. data/lib/methadone/main.rb +4 -1
  13. data/lib/methadone/test/base_integration_test.rb +29 -0
  14. data/lib/methadone/test/integration_test_assertions.rb +63 -0
  15. data/lib/methadone/version.rb +1 -1
  16. data/methadone.gemspec +3 -5
  17. data/templates/full/Rakefile.erb +9 -12
  18. data/templates/full/bin/executable.erb +2 -0
  19. data/templates/rspec/spec/something_spec.rb.erb +1 -1
  20. data/templates/test_unit/test/integration/test_cli.rb.erb +11 -0
  21. data/templates/test_unit/test/{tc_something.rb.erb → unit/test_something.rb.erb} +0 -0
  22. data/test/integration/base_integration_test.rb +60 -0
  23. data/test/integration/test_bootstrap.rb +150 -0
  24. data/test/integration/test_cli.rb +21 -0
  25. data/test/integration/test_license.rb +56 -0
  26. data/test/integration/test_readme.rb +53 -0
  27. data/test/integration/test_rspec.rb +28 -0
  28. data/test/integration/test_version.rb +21 -0
  29. data/test/{base_test.rb → unit/base_test.rb} +0 -0
  30. data/test/{command_for_tests.sh → unit/command_for_tests.sh} +0 -0
  31. data/test/{execution_strategy → unit/execution_strategy}/test_base.rb +0 -0
  32. data/test/{execution_strategy → unit/execution_strategy}/test_jvm.rb +4 -4
  33. data/test/{execution_strategy → unit/execution_strategy}/test_mri.rb +0 -0
  34. data/test/{execution_strategy → unit/execution_strategy}/test_open_3.rb +5 -5
  35. data/test/{execution_strategy → unit/execution_strategy}/test_open_4.rb +5 -5
  36. data/test/{execution_strategy → unit/execution_strategy}/test_rbx_open_4.rb +0 -0
  37. data/test/unit/test/test_integration_test_assertions.rb +211 -0
  38. data/test/{test_cli_logger.rb → unit/test_cli_logger.rb} +17 -17
  39. data/test/{test_cli_logging.rb → unit/test_cli_logging.rb} +12 -12
  40. data/test/{test_exit_now.rb → unit/test_exit_now.rb} +4 -4
  41. data/test/{test_main.rb → unit/test_main.rb} +48 -48
  42. data/test/{test_sh.rb → unit/test_sh.rb} +37 -37
  43. metadata +61 -93
  44. data/features/bootstrap.feature +0 -153
  45. data/features/license.feature +0 -43
  46. data/features/readme.feature +0 -26
  47. data/features/rspec_support.feature +0 -27
  48. data/features/step_definitions/bootstrap_steps.rb +0 -47
  49. data/features/step_definitions/license_steps.rb +0 -30
  50. data/features/step_definitions/readme_steps.rb +0 -26
  51. data/features/step_definitions/version_steps.rb +0 -4
  52. data/features/support/env.rb +0 -26
  53. data/features/version.feature +0 -17
  54. data/templates/full/features/executable.feature.erb +0 -13
  55. data/templates/full/features/step_definitions/executable_steps.rb.erb +0 -1
  56. data/templates/full/features/support/env.rb.erb +0 -16
@@ -16,8 +16,8 @@ class TestExitNow < BaseTest
16
16
  }
17
17
  Then {
18
18
  exception = assert_raises(Methadone::Error,&@code)
19
- exception.exit_code.should == @exit_code
20
- exception.message.should == @message
19
+ exception.exit_code.should be == @exit_code
20
+ exception.message.should be == @message
21
21
  }
22
22
  end
23
23
 
@@ -30,8 +30,8 @@ class TestExitNow < BaseTest
30
30
  }
31
31
  Then {
32
32
  exception = assert_raises(Methadone::Error,&@code)
33
- exception.exit_code.should == 1
34
- exception.message.should == @message
33
+ exception.exit_code.should be == 1
34
+ exception.message.should be == @message
35
35
  }
36
36
  end
37
37
  end
@@ -66,7 +66,7 @@ class TestMain < BaseTest
66
66
  }
67
67
  When run_go_safely
68
68
  Then {
69
- @params.should == %w(one two three)
69
+ @params.should be == %w(one two three)
70
70
  }
71
71
  end
72
72
 
@@ -94,7 +94,7 @@ class TestMain < BaseTest
94
94
  }
95
95
  When run_go_safely
96
96
  Then {
97
- @params.should == ['one','two',nil]
97
+ @params.should be == ['one','two',nil]
98
98
  }
99
99
  end
100
100
 
@@ -248,7 +248,7 @@ class TestMain < BaseTest
248
248
 
249
249
  Then {
250
250
  @switch.should be true
251
- @flag.should == 'value'
251
+ @flag.should be == 'value'
252
252
  }
253
253
  end
254
254
 
@@ -345,18 +345,18 @@ class TestMain < BaseTest
345
345
  @switch[0].should be true
346
346
  @some_other[0].should be true
347
347
  @other[0].should_not be true
348
- @flag[0].should == 'value'
349
- @f[0].should == 'value'
350
- @with_dashes[0].should == 'BAR'
348
+ @flag[0].should be == 'value'
349
+ @f[0].should be == 'value'
350
+ @with_dashes[0].should be == 'BAR'
351
351
 
352
352
  @switch[1].should be true
353
353
  @some_other[1].should be nil # ** this is set manually
354
354
  @other[1].should_not be true
355
- @flag[1].should == 'value'
356
- @f[1].should == 'value'
357
- @with_dashes[1].should == 'BAR'
355
+ @flag[1].should be == 'value'
356
+ @f[1].should be == 'value'
357
+ @with_dashes[1].should be == 'BAR'
358
358
 
359
- opts.to_s.should match /Some documentation string/
359
+ opts.to_s.should match(/Some documentation string/)
360
360
  }
361
361
  end
362
362
 
@@ -366,7 +366,7 @@ class TestMain < BaseTest
366
366
  }
367
367
 
368
368
  Then {
369
- opts.banner.should_not match /\[options\]/
369
+ opts.banner.should_not match(/\[options\]/)
370
370
  }
371
371
  end
372
372
 
@@ -377,7 +377,7 @@ class TestMain < BaseTest
377
377
  }
378
378
 
379
379
  Then {
380
- opts.banner.should match /\[options\]/
380
+ opts.banner.should match(/\[options\]/)
381
381
  }
382
382
 
383
383
  end
@@ -395,10 +395,10 @@ class TestMain < BaseTest
395
395
  }
396
396
  When run_go_safely
397
397
  Then {
398
- opts.banner.should match /db_name user \[password\]$/
399
- opts.to_s.should match /#{@db_name_desc}/
400
- opts.to_s.should match /#{@user_desc}/
401
- opts.to_s.should match /#{@password_desc}/
398
+ opts.banner.should match(/db_name user \[password\]$/)
399
+ opts.to_s.should match(/#{@db_name_desc}/)
400
+ opts.to_s.should match(/#{@user_desc}/)
401
+ opts.to_s.should match(/#{@password_desc}/)
402
402
  }
403
403
  end
404
404
 
@@ -412,7 +412,7 @@ class TestMain < BaseTest
412
412
  }
413
413
 
414
414
  Then {
415
- opts.banner.should match /db_name user tables...$/
415
+ opts.banner.should match(/db_name user tables...$/)
416
416
  }
417
417
  end
418
418
 
@@ -426,7 +426,7 @@ class TestMain < BaseTest
426
426
  }
427
427
 
428
428
  Then {
429
- opts.banner.should match /db_name user \[tables...\]$/
429
+ opts.banner.should match(/db_name user \[tables...\]$/)
430
430
  }
431
431
  end
432
432
 
@@ -437,7 +437,7 @@ class TestMain < BaseTest
437
437
 
438
438
  }
439
439
  Then {
440
- opts.banner.should match /^An app of total awesome$/
440
+ opts.banner.should match(/^An app of total awesome$/)
441
441
  }
442
442
  end
443
443
 
@@ -450,7 +450,7 @@ class TestMain < BaseTest
450
450
  }
451
451
 
452
452
  Then {
453
- opts.banner.should == 'FOOBAR'
453
+ opts.banner.should be == 'FOOBAR'
454
454
  }
455
455
  end
456
456
 
@@ -491,7 +491,7 @@ class TestMain < BaseTest
491
491
  }
492
492
 
493
493
  Then {
494
- opts.banner.should match /^v0.0.1/m
494
+ opts.banner.should match(/^v0.0.1/m)
495
495
  }
496
496
  end
497
497
 
@@ -503,7 +503,7 @@ class TestMain < BaseTest
503
503
  }
504
504
  Then run_go_safely
505
505
  And {
506
- opts.to_s.should match /Show help\/version info/m
506
+ opts.to_s.should match(/Show help\/version info/m)
507
507
  }
508
508
  end
509
509
 
@@ -516,7 +516,7 @@ class TestMain < BaseTest
516
516
  }
517
517
  Then run_go_safely
518
518
  And {
519
- opts.to_s.should match /#{@version_message}/
519
+ opts.to_s.should match(/#{@version_message}/)
520
520
  }
521
521
  end
522
522
 
@@ -530,7 +530,7 @@ class TestMain < BaseTest
530
530
  @help_string = opts.to_s
531
531
  }
532
532
  When {
533
- @help_string.should match /\(default: bar\)/
533
+ @help_string.should match(/\(default: bar\)/)
534
534
  }
535
535
 
536
536
  end
@@ -545,7 +545,7 @@ class TestMain < BaseTest
545
545
  @help_string = opts.to_s
546
546
  }
547
547
  When {
548
- @help_string.should match /\(default: bar\)/
548
+ @help_string.should match(/\(default: bar\)/)
549
549
  }
550
550
  end
551
551
 
@@ -556,7 +556,7 @@ class TestMain < BaseTest
556
556
  @help_string = opts.to_s
557
557
  }
558
558
  Then {
559
- @help_string.should match /Default values can be placed in the APP_OPTS environment variable/
559
+ @help_string.should match(/Default values can be placed in the APP_OPTS environment variable/)
560
560
  }
561
561
  end
562
562
 
@@ -573,9 +573,9 @@ class TestMain < BaseTest
573
573
  }
574
574
  Then {
575
575
  assert_exits(0,'',&@code)
576
- @switch.should == true
577
- @flag.should == @flag_value
578
- @args.should == [@some_arg]
576
+ @switch.should be == true
577
+ @flag.should be == @flag_value
578
+ @args.should be == [@some_arg]
579
579
  }
580
580
  end
581
581
 
@@ -591,8 +591,8 @@ class TestMain < BaseTest
591
591
  }
592
592
  Then {
593
593
  assert_exits(0,'',&@code)
594
- @switch.should == true
595
- @flag.should == @flag_value
594
+ @switch.should be == true
595
+ @flag.should be == @flag_value
596
596
  }
597
597
  end
598
598
 
@@ -607,8 +607,8 @@ class TestMain < BaseTest
607
607
  }
608
608
  Then {
609
609
  assert_exits(0,'',&@code)
610
- @switch.should == true
611
- @flag.should == @flag_value
610
+ @switch.should be == true
611
+ @flag.should be == @flag_value
612
612
  }
613
613
  end
614
614
 
@@ -624,8 +624,8 @@ class TestMain < BaseTest
624
624
  }
625
625
  Then {
626
626
  assert_exits(0,'',&@code)
627
- @switch.should == true
628
- @flag.should == @flag_value
627
+ @switch.should be == true
628
+ @flag.should be == @flag_value
629
629
  }
630
630
  end
631
631
 
@@ -646,8 +646,8 @@ class TestMain < BaseTest
646
646
  }
647
647
  Then {
648
648
  assert_exits(0,&@code)
649
- @switch.should == true
650
- @flag.should == @flag_value
649
+ @switch.should be == true
650
+ @flag.should be == @flag_value
651
651
  }
652
652
 
653
653
  end
@@ -670,8 +670,8 @@ class TestMain < BaseTest
670
670
  }
671
671
  Then {
672
672
  assert_exits(0,&@code)
673
- @switch.should == true
674
- @flag.should == @flag_value
673
+ @switch.should be == true
674
+ @flag.should be == @flag_value
675
675
  }
676
676
 
677
677
  end
@@ -682,15 +682,15 @@ class TestMain < BaseTest
682
682
  And {
683
683
  @flag_value = any_string
684
684
  rc_file = File.join(ENV['HOME'],'.my_app.rc')
685
- raise "Something's wrong, expection rc file not to exist" if File.exists?(rc_file)
685
+ raise "Something's wrong, expection rc file not to exist" if File.exist?(rc_file)
686
686
  }
687
687
  When {
688
688
  @code = lambda { go! }
689
689
  }
690
690
  Then {
691
691
  assert_exits(0,&@code)
692
- @switch.should == nil
693
- @flag.should == nil
692
+ @switch.should be == nil
693
+ @flag.should be == nil
694
694
  }
695
695
  end
696
696
 
@@ -708,8 +708,8 @@ class TestMain < BaseTest
708
708
  }
709
709
  Then {
710
710
  assert_exits(0,&@code)
711
- @switch.should == true
712
- @flag.should == @flag_value
711
+ @switch.should be == true
712
+ @flag.should be == @flag_value
713
713
  }
714
714
 
715
715
  end
@@ -728,8 +728,8 @@ class TestMain < BaseTest
728
728
  }
729
729
  Then {
730
730
  assert_exits(0,&@code)
731
- @switch.should == true
732
- @flag.should == @flag_value
731
+ @switch.should be == true
732
+ @flag.should be == @flag_value
733
733
  }
734
734
  end
735
735
 
@@ -758,8 +758,8 @@ class TestMain < BaseTest
758
758
  main {}
759
759
  }
760
760
  Then {
761
- opts.banner.should match /^An app of total awesome$/
762
- opts.to_s.should match /--switch/
761
+ opts.banner.should match(/^An app of total awesome$/)
762
+ opts.to_s.should match(/--switch/)
763
763
  }
764
764
  end
765
765
 
@@ -54,7 +54,7 @@ class TestSH < BaseTest
54
54
  end
55
55
  }
56
56
  Then {
57
- @stdout_received.should == test_command_stdout
57
+ @stdout_received.should be == test_command_stdout
58
58
  assert_successful_command_execution(@exit_code,@logger,@command,test_command_stdout)
59
59
  }
60
60
  end
@@ -71,7 +71,7 @@ class TestSH < BaseTest
71
71
  end
72
72
  }
73
73
  Then {
74
- @block_called.should == true
74
+ @block_called.should be == true
75
75
  assert_successful_command_execution(@exit_code,@logger,@command,test_command_stdout)
76
76
  }
77
77
  end
@@ -87,7 +87,7 @@ class TestSH < BaseTest
87
87
  @exit_code = self.send(method,@command,&@lambda)
88
88
  }
89
89
  Then {
90
- @block_called.should == true
90
+ @block_called.should be == true
91
91
  assert_successful_command_execution(@exit_code,@logger,@command,test_command_stdout)
92
92
  }
93
93
  end
@@ -107,8 +107,8 @@ class TestSH < BaseTest
107
107
  end
108
108
  }
109
109
  Then {
110
- @stdout_received.should == test_command_stdout
111
- @stderr_received.length.should == 0
110
+ @stdout_received.should be == test_command_stdout
111
+ @stderr_received.length.should be == 0
112
112
  assert_successful_command_execution(@exit_code,@logger,@command,test_command_stdout)
113
113
  }
114
114
  end
@@ -130,9 +130,9 @@ class TestSH < BaseTest
130
130
  end
131
131
  }
132
132
  Then {
133
- @stdout_received.should == test_command_stdout
134
- @stderr_received.length.should == 0
135
- @exitstatus_received.should == 0
133
+ @stdout_received.should be == test_command_stdout
134
+ @stderr_received.length.should be == 0
135
+ @exitstatus_received.should be == 0
136
136
  assert_successful_command_execution(@exit_code,@logger,@command,test_command_stdout)
137
137
  }
138
138
  end
@@ -150,7 +150,7 @@ class TestSH < BaseTest
150
150
  end
151
151
  }
152
152
  Then {
153
- @exit_code.should == 1
153
+ @exit_code.should be == 1
154
154
  assert_logger_output_for_failure(@logger,@command,test_command_stdout,test_command_stderr)
155
155
  }
156
156
  end
@@ -167,7 +167,7 @@ class TestSH < BaseTest
167
167
  end
168
168
  }
169
169
  Then {
170
- @exit_code.should == 1
170
+ @exit_code.should be == 1
171
171
  assert_logger_output_for_failure(@logger,@command,test_command_stdout,test_command_stderr)
172
172
  }
173
173
  end
@@ -188,12 +188,12 @@ class TestSH < BaseTest
188
188
  end
189
189
  }
190
190
  Then {
191
- @exit_code.should == 1
192
- @block_called.should == true
193
- @exitstatus_received.should == 1
194
- @logger.debugs[0].should == "Executing '#{test_command}foo'"
195
- @logger.debugs[1].should == "stdout output of '#{test_command}foo': #{test_command_stdout}"
196
- @logger.warns[0].should == "stderr output of '#{test_command}foo': #{test_command_stderr}"
191
+ @exit_code.should be == 1
192
+ @block_called.should be == true
193
+ @exitstatus_received.should be == 1
194
+ @logger.debugs[0].should be == "Executing '#{test_command}foo'"
195
+ @logger.debugs[1].should be == "stdout output of '#{test_command}foo': #{test_command_stdout}"
196
+ @logger.warns[0].should be == "stderr output of '#{test_command}foo': #{test_command_stderr}"
197
197
  }
198
198
  end
199
199
  end
@@ -208,7 +208,7 @@ class TestSH < BaseTest
208
208
  @exit_code = sh @command
209
209
  }
210
210
  Then {
211
- @exit_code.should == 1
211
+ @exit_code.should be == 1
212
212
  assert_logger_output_for_failure(@logger,@command,test_command_stdout,test_command_stderr)
213
213
  }
214
214
  end
@@ -222,8 +222,8 @@ class TestSH < BaseTest
222
222
  @exit_code = sh @command
223
223
  }
224
224
  Then {
225
- @exit_code.should == 127 # consistent with what bash does
226
- @logger.errors[0].should match /^Error running '#{@command}': .+$/
225
+ @exit_code.should be == 127 # consistent with what bash does
226
+ @logger.errors[0].should match(/^Error running '#{@command}': .+$/)
227
227
  }
228
228
  end
229
229
 
@@ -237,7 +237,7 @@ class TestSH < BaseTest
237
237
  }
238
238
  Then {
239
239
  exception = assert_raises(Methadone::FailedCommandError,&@code)
240
- exception.command.should == @command
240
+ exception.command.should be == @command
241
241
  assert_logger_output_for_failure(@logger,@command,test_command_stdout,test_command_stderr)
242
242
  }
243
243
  end
@@ -253,8 +253,8 @@ class TestSH < BaseTest
253
253
  }
254
254
  Then {
255
255
  exception = assert_raises(Methadone::FailedCommandError,&@code)
256
- exception.command.should == @command
257
- exception.message.should == @custom_error_message
256
+ exception.command.should be == @command
257
+ exception.message.should be == @custom_error_message
258
258
  assert_logger_output_for_failure(@logger,@command,test_command_stdout,test_command_stderr)
259
259
  }
260
260
  end
@@ -289,7 +289,7 @@ class TestSH < BaseTest
289
289
  @code = lambda { @test_app.sh @command }
290
290
  }
291
291
  Then {
292
- exception = assert_raises(StandardError,&@code)
292
+ assert_raises(StandardError,&@code)
293
293
  }
294
294
  end
295
295
 
@@ -339,8 +339,8 @@ class TestSH < BaseTest
339
339
  @results = @app.sh(@command)
340
340
  }
341
341
  Then {
342
- @app.strategy.command.should == @command
343
- @results.should == @exit_code
342
+ @app.strategy.command.should be == @command
343
+ @results.should be == @exit_code
344
344
  }
345
345
  end
346
346
 
@@ -353,8 +353,8 @@ class TestSH < BaseTest
353
353
  @results = @app.sh(@command)
354
354
  }
355
355
  Then {
356
- @app.strategy.command.should == @command
357
- @results.should == 0
356
+ @app.strategy.command.should be == @command
357
+ @results.should be == 0
358
358
  }
359
359
  end
360
360
 
@@ -367,25 +367,25 @@ class TestSH < BaseTest
367
367
  @results = @app.sh(@command)
368
368
  }
369
369
  Then {
370
- @app.strategy.command.should == @command
371
- @results.should == 1
370
+ @app.strategy.command.should be == @command
371
+ @results.should be == 1
372
372
  }
373
373
  end
374
374
 
375
375
  private
376
376
 
377
377
  def assert_successful_command_execution(exit_code,logger,command,stdout)
378
- exit_code.should == 0
379
- logger.debugs[0].should == "Executing '#{command}'"
380
- logger.debugs[1].should == "stdout output of '#{command}': #{stdout}"
381
- logger.warns.length.should == 0
378
+ exit_code.should be == 0
379
+ logger.debugs[0].should be == "Executing '#{command}'"
380
+ logger.debugs[1].should be == "stdout output of '#{command}': #{stdout}"
381
+ logger.warns.length.should be == 0
382
382
  end
383
383
 
384
384
  def assert_logger_output_for_failure(logger,command,stdout,stderr)
385
- logger.debugs[0].should == "Executing '#{command}'"
386
- logger.infos[0].should == "stdout output of '#{command}': #{stdout}"
387
- logger.warns[0].should == "stderr output of '#{command}': #{stderr}"
388
- logger.warns[1].should == "Error running '#{command}'"
385
+ logger.debugs[0].should be == "Executing '#{command}'"
386
+ logger.infos[0].should be == "stdout output of '#{command}': #{stdout}"
387
+ logger.warns[0].should be == "stderr output of '#{command}': #{stderr}"
388
+ logger.warns[1].should be == "Error running '#{command}'"
389
389
  end
390
390
 
391
391
  def use_capturing_logger