testrocket 1.1.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06ada1739ceaafbbbf088207e2c957d12c20272b8d50a99fe7964a868401828b
4
- data.tar.gz: 1229f23c0d064b3e093d2a8e6fca8c784f277d43a990bf67e32eb1f400f27d3c
3
+ metadata.gz: 850df8bb63cf9b35ae6a47d1c86e974549290f772fd2f97f6f55ca17ab74446c
4
+ data.tar.gz: 297b5ed54aeedd054c3fae47df9dc349e2f8c58b634b0121c1cca2f1b3fe2d93
5
5
  SHA512:
6
- metadata.gz: c9ceb9459b8657f3362b34976282bd1277b7a2ac4a3e11c28c80447ff261be9b07ec4e665d73c71803092ad32bfb6700211c564ff8d6419f07d0075d86b5779a
7
- data.tar.gz: baffd75f9460dd548ae919d6d5c8ef4b83b7b22ff3cba90b8cfbcc454594639f598faf14e39ec17f447faad67be47bf237251f9ee9061c74777dca02f565f403
6
+ metadata.gz: 983ebb929595e631e2411eb9252db89fa4eead16673a13d5b6d3fba15c37e3baf260daffa63b8ff07192bf8a6fc2794dddc9f76e9cb1740e5707440633e3b764
7
+ data.tar.gz: 8a5021650afde04e25d0f33d8b9523068d2968e4600dbaa2bfc2be0c9b0f137a00b5cabc10d884cc78fae5fbbe7602807094629cf2b68d8e8fff7d87cc023117
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  | |_| __|__ \ |_| | | (_) | (__| <| __/ |_
5
5
  \__|\___|___/\__|_| \___/ \___|_|\_\\___|\__|
6
6
 
7
- Testrocket is a super simple (as simple as it gets really) testing library for Ruby 2.0 and higher. It has also been modernized and tested to run on Ruby 3.4.
7
+ Testrocket is a super simple (as simple as it gets really) testing library for Ruby 2.0 and higher. It has also been modernized and tested to run on Ruby 3.4 and Ruby 4.0.2.
8
8
 
9
9
  It was initially developed for [a CodeBrawl contest](https://web.archive.org/web/20110725022042/http://codebrawl.com/articles/contest-rundown-ruby-testing-libraries) and it got first place! People asked me to release it 'for real' so here we are.
10
10
 
@@ -21,8 +21,8 @@ As yet there are no useful bits and pieces for creating test files (look at the
21
21
  Dependencies
22
22
  ------------
23
23
 
24
- - Ruby 2.1 or higher (tested on Ruby 3.4)
25
- - minitest/spec (part of MRI 1.9+ standard library)
24
+ - Ruby 2.1 or higher (tested on Ruby 3.4 and 4.0.2)
25
+ - minitest/spec
26
26
 
27
27
  Example
28
28
  -------
@@ -79,7 +79,7 @@ In this way, your class is tested each time you run the app in development or te
79
79
  Other Features
80
80
  --------------
81
81
 
82
- By default, output is written to STDERR (as well as returned by the test expressions themselves). You can override where test output goes like so:
82
+ By default, output is written to `$stderr` (as well as returned by the test expressions themselves). You can override where test output goes like so:
83
83
 
84
84
  ```ruby
85
85
  TestRocket.out = File.new('/dev/null', 'w')
data/lib/testrocket.rb CHANGED
@@ -4,34 +4,33 @@
4
4
  # TestRocket Module to refine lambdas an use them for lightweight tests
5
5
  #
6
6
  module TestRocket
7
- VERSION = '1.1.0'
7
+ VERSION = '1.2.0'
8
8
 
9
9
  extend Module.new { attr_accessor :out }
10
10
 
11
11
  refine Proc do
12
- # Include TestRocket methods WITHOUT implementation selected
13
- Proc.send :include, TestRocket
14
-
15
12
  # If we're in a production environment, the tests shall do nothing.
16
13
  if ENV['RACK_ENV'] == 'production' ||
17
14
  (defined?(Rails) && Rails.env.production?) ||
18
15
  ENV['RAILS_ENV'] == 'production'
19
- def _test(a, b); end
16
+ def _test_pass; end
17
+ def _test_fail; end
20
18
  def _show(r); end
21
19
  def _pend; end
22
20
  def _desc; end
23
21
  else
24
- def _test(a, b); send((call rescue()) ? a : b) end
25
- def _show(r); (TestRocket.out || STDERR) << r + "\n"; r end
22
+ def _test_pass; (call rescue()) ? _pass : _fail end
23
+ def _test_fail; (call rescue()) ? _fail : _pass end
24
+ def _show(r); (TestRocket.out || $stderr) << r + "\n"; r end
26
25
  def _pass; ' OK' end
27
26
  def _fail; " FAIL @ #{source_location * ':'}" end
28
27
  def _pend; "PENDING '#{call}' @ #{source_location * ':'}" end
29
28
  def _desc; " FIRE '#{call}'!" end
30
29
  end
31
30
 
32
- def +@; _show _test :_pass, :_fail end
33
- def -@; _show _test :_fail, :_pass end
31
+ def +@; _show _test_pass end
32
+ def -@; _show _test_fail end
34
33
  def ~; _show _pend end
35
34
  def !; _show _desc end
36
35
  end
37
- end
36
+ end
@@ -5,41 +5,41 @@ class RefinementTest
5
5
 
6
6
  def self.test!
7
7
  describe TestRocket do
8
- it 'should find emptiness non-truthful by default' do
8
+ it 'finds emptiness non-truthful by default' do
9
9
  _(+->{}).must_match(/FAIL/)
10
10
  _(+->{}).must_match("#{__FILE__}:#{__LINE__}")
11
11
  end
12
12
 
13
- it 'should pass a simple positive assertion' do
13
+ it 'passes a simple positive assertion' do
14
14
  _(+->{ 2 + 2 == 4 }).must_match(/OK/)
15
15
  end
16
16
 
17
- it 'should pass a simple negative assertion' do
17
+ it 'passes a simple negative assertion' do
18
18
  _(-->{ 2 + 2 == 5 }).must_match(/OK/)
19
19
  end
20
20
 
21
- it 'should fail a simple erroneous assertion' do
21
+ it 'fails a simple erroneous assertion' do
22
22
  _(+->{ 2 + 2 == 5 }).must_match(/FAIL/)
23
23
  _(+->{ 2 + 2 == 5 }).must_match("#{__FILE__}:#{__LINE__}")
24
24
  end
25
25
 
26
- it 'should fail a simple correct assertion assumed to fail' do
26
+ it 'fails a simple correct assertion assumed to fail' do
27
27
  _(-->{ 2 + 2 == 4 }).must_match(/FAIL/)
28
28
  _(-->{ 2 + 2 == 4 }).must_match("#{__FILE__}:#{__LINE__}")
29
29
  end
30
30
 
31
- it 'should give a pending notice' do
31
+ it 'gives a pending notice' do
32
32
  _(~->{ 'a pending test' }).must_match(/PENDING/)
33
33
  _(~->{ 'a pending test' }).must_match(/a pending test/)
34
34
  _(~->{ 'a pending test' }).must_match("#{__FILE__}:#{__LINE__}")
35
35
  end
36
36
 
37
- it 'should fire a description rocket' do
37
+ it 'fires a description rocket' do
38
38
  _(!->{ 'a description' }).must_match(/FIRE/)
39
39
  _(!->{ 'a description' }).must_match(/a description/)
40
40
  end
41
41
 
42
- it 'would influence Ruby Proc if TestRocket used explitly' do
42
+ it 'influences Ruby Proc if TestRocket used explicitly' do
43
43
  (
44
44
  ok = ->() { nil }
45
45
  _(!ok)
@@ -52,7 +52,7 @@ end
52
52
  class NoRefinementTest
53
53
  def self.test!
54
54
  describe 'Without `using TestRocket`' do
55
- it 'should not influence global Ruby scope and other libs' do
55
+ it 'does not influence global Ruby scope and other libs' do
56
56
  (
57
57
  ok = ->() { nil }
58
58
  _(!ok)
data/testrocket.gemspec CHANGED
@@ -1,6 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'testrocket'
2
+ require_relative 'lib/testrocket'
4
3
 
5
4
  Gem::Specification.new do |s|
6
5
  s.name = 'testrocket'
@@ -8,14 +7,16 @@ Gem::Specification.new do |s|
8
7
  s.platform = Gem::Platform::RUBY
9
8
  s.authors = ['Peter Cooper', 'Christoph Grabo']
10
9
  s.email = %w[git@peterc.org chris@dinarrr.com]
11
- s.homepage = 'http://github.com/peterc/testrocket'
12
- s.summary = %q{A super lightweight lamdba-based testing library for Ruby}
13
- s.description = %q{A super lightweight lamdba-based testing library for Ruby}
10
+ s.homepage = 'https://github.com/peterc/testrocket'
11
+ s.summary = %q{A super lightweight lambda-based testing library for Ruby}
12
+ s.description = %q{A super lightweight lambda-based testing library for Ruby}
13
+ s.license = 'MIT'
14
+ s.required_ruby_version = '>= 2.1'
14
15
 
15
- s.rubyforge_project = 'testrocket'
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
+ s.files = Dir.glob('{lib,test}/**/*') + %w[README.md LICENSE Gemfile testrocket.gemspec]
17
+ s.executables = Dir.glob('bin/*').map { |f| File.basename(f) }
20
18
  s.require_paths = ['lib']
19
+
20
+ s.add_development_dependency 'rake'
21
+ s.add_development_dependency 'minitest'
21
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Cooper
@@ -9,8 +9,36 @@ authors:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 1980-01-02 00:00:00.000000000 Z
12
- dependencies: []
13
- description: A super lightweight lamdba-based testing library for Ruby
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A super lightweight lambda-based testing library for Ruby
14
42
  email:
15
43
  - git@peterc.org
16
44
  - chris@dinarrr.com
@@ -18,18 +46,16 @@ executables: []
18
46
  extensions: []
19
47
  extra_rdoc_files: []
20
48
  files:
21
- - ".gitignore"
22
49
  - Gemfile
23
- - HISTORY
24
50
  - LICENSE
25
51
  - README.md
26
- - Rakefile
27
52
  - lib/testrocket.rb
28
53
  - test/helper.rb
29
54
  - test/test_testrocket.rb
30
55
  - testrocket.gemspec
31
- homepage: http://github.com/peterc/testrocket
32
- licenses: []
56
+ homepage: https://github.com/peterc/testrocket
57
+ licenses:
58
+ - MIT
33
59
  metadata: {}
34
60
  rdoc_options: []
35
61
  require_paths:
@@ -38,16 +64,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
38
64
  requirements:
39
65
  - - ">="
40
66
  - !ruby/object:Gem::Version
41
- version: '0'
67
+ version: '2.1'
42
68
  required_rubygems_version: !ruby/object:Gem::Requirement
43
69
  requirements:
44
70
  - - ">="
45
71
  - !ruby/object:Gem::Version
46
72
  version: '0'
47
73
  requirements: []
48
- rubygems_version: 3.6.7
74
+ rubygems_version: 4.0.6
49
75
  specification_version: 4
50
- summary: A super lightweight lamdba-based testing library for Ruby
51
- test_files:
52
- - test/helper.rb
53
- - test/test_testrocket.rb
76
+ summary: A super lightweight lambda-based testing library for Ruby
77
+ test_files: []
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
- .vscode
data/HISTORY DELETED
@@ -1,21 +0,0 @@
1
- 1.0.0 - October 2, 2019
2
-
3
- - Breaking change: TestRocker now uses refinements to stop it polluting Object.
4
-
5
- 0.1.0 - February 2, 2015
6
-
7
- - Switched default output to STDERR instead of STDOUT
8
- - Moved the methods that do the work into a TestRocket::Live module so...
9
- - .. a module called TestRocket::Dummy has been added so TestRocket isn't used in production situations
10
- - Extra tests for showing the location of a failing, passing, or pending test
11
- - Reversed HISTORY order
12
- - Merged VERSION constant into main module file
13
- - Removed the Jenkins CI stuff as I can't remember anything about it
14
-
15
- 0.0.2 - May 31, 2014
16
-
17
- - Finally pushed extra syntax version to rubygems.org ;-)
18
-
19
- 0.0.1 - August 10, 2011
20
-
21
- - Initial release
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- require 'bundler'
2
- require 'rake/testtask'
3
-
4
- Bundler::GemHelper.install_tasks
5
- Rake::TestTask.new
6
-
7
- task :default => :test