testrocket 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e62650b45a99c697c146ea300cb0c6f03a53b9b8
4
+ data.tar.gz: 2aecec4e6db2fc1f5a36b488f4212b2dbc420cd1
5
+ SHA512:
6
+ metadata.gz: a8161afc11c7646e6144196bf51a512b1aab39da67a80225146dfb9c995c1a488ee022c8b69248996117b8c11988e097117f58402e9b1941cd3a766578151a89
7
+ data.tar.gz: 56b62f8767679d0bf04f6e73fad121e1be6a3baeb81d208933df9087526e10a342078455c8b86467420a6043b8aa3e9cd3bd09f2d3b919118f42d8e82fcf3b3b
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.9.2
3
+ gemfile: gemfiles/Gemfile.travis
4
+ notifications:
5
+ recipients:
6
+ - chris@dinarrr.com
7
+
data/Gemfile.travis ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rake" # added for travis-ci.org
4
+
5
+ # Specify your gem's dependencies in testrocket.gemspec
6
+ gemspec
data/HISTORY CHANGED
@@ -1,3 +1,7 @@
1
1
  0.0.1 - August 10, 2011
2
2
 
3
- - Initial release
3
+ - Initial release
4
+
5
+ 0.0.2 - May 31, 2014
6
+
7
+ - Finally pushed extra syntax version to rubygems.org ;-)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  This is a modified MIT license.
2
2
 
3
- Copyright © 2011 Peter Cooper (http://peterc.org/)
3
+ Copyright © 2011-2012 Peter Cooper (http://peterc.org/)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
data/README.md CHANGED
@@ -1,49 +1,64 @@
1
- _ _ _ _
2
- | |_ ___ ___| |_ _ __ ___ ___| | __ ___| |_
1
+ _ _ _ _
2
+ | |_ ___ ___| |_ _ __ ___ ___| | __ ___| |_
3
3
  | __|/ _ | __| __| '__/ _ \ / __| |/ // _ \ __|
4
- | |_| __|__ \ |_| | | (_) | (__| <| __/ |_
4
+ | |_| __|__ \ |_| | | (_) | (__| <| __/ |_
5
5
  \__|\___|___/\__|_| \___/ \___|_|\_\\___|\__|
6
-
7
- Testrocket is a super simple (as simple as it gets really) testing library for Ruby.
8
6
 
9
- It was initially developed for [this CodeBrawl competition](http://codebrawl.com/articles/contest-rundown-ruby-testing-libraries) and it won! People then asked me to release it 'for real' so here we are.
7
+ Testrocket is a super simple (as simple as it gets really) testing library for Ruby 1.9 and higher.
8
+
9
+ It was initially developed for [a CodeBrawl contest](http://codebrawl.com/articles/contest-rundown-ruby-testing-libraries) and it won! People asked me to release it 'for real' so here we are.
10
10
 
11
11
  To install:
12
12
 
13
13
  gem install testrocket
14
-
14
+
15
15
  As yet there are no useful bits and pieces for creating test files (look at the example, it's easy!) or Rake tasks. But it's all crazy simple. A few things may be added later on.
16
-
16
+
17
17
  Dependencies
18
18
  ------------
19
19
 
20
- - Ruby 1.9
21
- - minitest/spec (part of MRI 1.9 stdlib)
22
- - Unix/Unix-like/POSIX system
20
+ - Ruby 1.9 or higher
21
+ - minitest/spec (part of MRI 1.9+ standard library)
23
22
 
24
23
  Example
25
24
  -------
26
25
 
27
- require 'testrocket'
28
-
29
- # ===========================================================
30
- # EXAMPLE TEST "SUITE" FOR "DIE"
31
- #
32
- # USAGE
33
- # +-> { block that should succeed }
34
- # --> { block that should fail }
35
-
36
- +-> { Die.new(2) }
37
- --> { raise }
38
- +-> { 2 + 2 == 4 }
39
-
40
- # These two tests will deliberately fail
41
- +-> { raise }
42
- --> { true }
43
-
26
+ ```ruby
27
+ require 'testrocket'
28
+
29
+ # BASIC USAGE
30
+ # +-> { block that should succeed }
31
+ # --> { block that should fail }
32
+
33
+ +-> { Die.new(2) }
34
+ --> { raise }
35
+ +-> { 2 + 2 == 4 }
36
+
37
+ # These two tests will deliberately fail
38
+ +-> { raise }
39
+ --> { true }
40
+
41
+ # A 'pending' test
42
+ ~-> { "this is a pending test" }
43
+
44
+ # A description
45
+ !-> { "use this for descriptive output and to separate your test parts" }
46
+ ```
47
+
44
48
  Other Features
45
49
  --------------
46
50
 
47
51
  By default, output is written to STDOUT (as well as returned by the test expressions themselves). You can override where test output goes like so:
48
52
 
49
- TestRocket.out = File.new('/dev/null', 'w')
53
+ ```ruby
54
+ TestRocket.out = File.new('/dev/null', 'w')
55
+ ```
56
+
57
+ TestRocket.out also supports Logger instances.
58
+
59
+ Authors
60
+ -------
61
+
62
+ Initial concept and maintenance by Peter Cooper
63
+
64
+ Extra concepts and code by Christoph Grabo
data/Rakefile CHANGED
@@ -1,11 +1,7 @@
1
1
  require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
4
2
  require 'rake/testtask'
5
- Rake::TestTask.new(:test) do |test|
6
- test.libs << 'lib' << 'test'
7
- test.pattern = 'test/**/test_*.rb'
8
- test.verbose = true
9
- end
3
+
4
+ Bundler::GemHelper.install_tasks
5
+ Rake::TestTask.new
10
6
 
11
7
  task :default => :test
data/lib/testrocket.rb CHANGED
@@ -1,15 +1,18 @@
1
1
  module TestRocket
2
- module Out; attr_accessor :out; end; extend Out
3
-
4
- def _test(a, b)
5
- send((call rescue()) ? a : b)
6
- end
2
+ extend Module.new { attr_accessor :out }
7
3
 
8
- def +@; r = _test :_pass, :_fail; (TestRocket.out || $>).puts r; r end
9
- def -@; r = _test :_fail, :_pass; (TestRocket.out || $>).puts r; r end
4
+ def _test(a, b); send((call rescue()) ? a : b) end
10
5
 
11
- def _pass; ' OK'; end
12
- def _fail; "FAIL @ #{source_location.join(':')}"; end
6
+ def +@; _show _test :_pass, :_fail end
7
+ def -@; _show _test :_fail, :_pass end
8
+ def ~; _show _pend; end
9
+ def !; _show _desc; end
10
+
11
+ def _show(r); (TestRocket.out || $>) << r + "\n"; r end
12
+ def _pass; " OK" end
13
+ def _fail; " FAIL @ #{source_location * ':'}" end
14
+ def _pend; "PENDING '#{call}' @ #{source_location * ':'}" end
15
+ def _desc; " FIRE '#{call}'!" end
13
16
  end
14
17
 
15
- Proc.send :include, TestRocket
18
+ Proc.send :include, TestRocket
@@ -1,3 +1,3 @@
1
1
  module Testrocket
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require_relative 'helper'
2
2
 
3
3
  describe TestRocket do
4
4
  it "should find emptiness non-truthful by default" do
@@ -20,4 +20,14 @@ describe TestRocket do
20
20
  it "should fail a simple correct assertion assumed to fail" do
21
21
  (-->{ 2 + 2 == 4 }).must_match(/FAIL/)
22
22
  end
23
- end
23
+
24
+ it "should give a pending notice" do
25
+ (~->{ "a pending test" }).must_match(/PENDING/)
26
+ (~->{ "a pending test" }).must_match(/a pending test/)
27
+ end
28
+
29
+ it "should fire a description rocket" do
30
+ (!->{ "a description" }).must_match(/FIRE/)
31
+ (!->{ "a description" }).must_match(/a description/)
32
+ end
33
+ end
data/testrocket.gemspec CHANGED
@@ -6,11 +6,11 @@ Gem::Specification.new do |s|
6
6
  s.name = "testrocket"
7
7
  s.version = Testrocket::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Peter Cooper"]
10
- s.email = ["git@peterc.org"]
9
+ s.authors = ["Peter Cooper","Christoph Grabo"]
10
+ s.email = ["git@peterc.org","chris@dinarrr.com"]
11
11
  s.homepage = "http://github.com/peterc/testrocket"
12
- s.summary = %q{A super lightweight testing library for Ruby}
13
- s.description = %q{A super lightweight testing library for Ruby}
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}
14
14
 
15
15
  s.rubyforge_project = "testrocket"
16
16
 
metadata CHANGED
@@ -1,31 +1,28 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: testrocket
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Peter Cooper
8
+ - Christoph Grabo
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-10 00:00:00 +01:00
14
- default_executable:
12
+ date: 2014-05-31 00:00:00.000000000 Z
15
13
  dependencies: []
16
-
17
- description: A super lightweight testing library for Ruby
18
- email:
14
+ description: A super lightweight lamdba-based testing library for Ruby
15
+ email:
19
16
  - git@peterc.org
17
+ - chris@dinarrr.com
20
18
  executables: []
21
-
22
19
  extensions: []
23
-
24
20
  extra_rdoc_files: []
25
-
26
- files:
27
- - .gitignore
21
+ files:
22
+ - ".gitignore"
23
+ - ".travis.yml"
28
24
  - Gemfile
25
+ - Gemfile.travis
29
26
  - HISTORY
30
27
  - LICENSE
31
28
  - README.md
@@ -35,34 +32,29 @@ files:
35
32
  - test/helper.rb
36
33
  - test/test_testrocket.rb
37
34
  - testrocket.gemspec
38
- has_rdoc: true
39
35
  homepage: http://github.com/peterc/testrocket
40
36
  licenses: []
41
-
37
+ metadata: {}
42
38
  post_install_message:
43
39
  rdoc_options: []
44
-
45
- require_paths:
40
+ require_paths:
46
41
  - lib
47
- required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
- requirements:
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
50
44
  - - ">="
51
- - !ruby/object:Gem::Version
52
- version: "0"
53
- required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
56
49
  - - ">="
57
- - !ruby/object:Gem::Version
58
- version: "0"
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
59
52
  requirements: []
60
-
61
53
  rubyforge_project: testrocket
62
- rubygems_version: 1.6.2
54
+ rubygems_version: 2.2.0
63
55
  signing_key:
64
- specification_version: 3
65
- summary: A super lightweight testing library for Ruby
66
- test_files:
56
+ specification_version: 4
57
+ summary: A super lightweight lamdba-based testing library for Ruby
58
+ test_files:
67
59
  - test/helper.rb
68
60
  - test/test_testrocket.rb