petitest-dsl 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +83 -0
- data/Rakefile +8 -0
- data/lib/petitest/dsl.rb +29 -0
- data/lib/petitest/dsl/version.rb +5 -0
- data/petitest-dsl.gemspec +22 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2eb4d82cc6cc01165297260128710acc89381e8d
|
4
|
+
data.tar.gz: ea7111634c8f3154bf98429c47d0d9e7c389b475
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 10f9afe2a65bea9a52333abdd1addfc7a21f3930cbc7979c2cab47518608a0914df9955b1b4e3cdc32efb218886d8cc28f8c6e0a0a179f80268d893831472d7e
|
7
|
+
data.tar.gz: 2686f2e0d8c21271c23cadcfd9558cf7d4bd9047985c6f240d53a2c63deb74305352f60b2ae8dccd564cb3cbcbd1dca4314a37bde538d85b6691532da1fe3dba
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Ryo Nakamura
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Petitest::DSL
|
2
|
+
|
3
|
+
DSL for [Petitest](https://github.com/petitest/petitest-dsl).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "petitest-dsl"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
gem install petitest-dsl
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Require `"petitest/dsl"` and extend `Petitest::DSL` into your test class.
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require "petitest/autorun"
|
31
|
+
require "petitest/dsl"
|
32
|
+
|
33
|
+
class ExampleTest < Petitest::Test
|
34
|
+
extend ::Petitest::DSL
|
35
|
+
|
36
|
+
# ... your tests ...
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
### .desc
|
41
|
+
|
42
|
+
Set a description to the following test.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
desc "description for this test"
|
46
|
+
def test_foo
|
47
|
+
assert { foo }
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
### .test
|
52
|
+
|
53
|
+
Define a test with a given description.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
test "description for this test" do
|
57
|
+
assert { foo }
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
Define a skkipped test.
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
test "description for this test"
|
65
|
+
```
|
66
|
+
|
67
|
+
### .sub_test
|
68
|
+
|
69
|
+
Nest test groups.
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
sub_test "bar" do
|
73
|
+
test "baz" do
|
74
|
+
assert { baz }
|
75
|
+
end
|
76
|
+
|
77
|
+
sub_test "boo" do
|
78
|
+
test "boz" do
|
79
|
+
assert { boz }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
```
|
data/Rakefile
ADDED
data/lib/petitest/dsl.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "petitest/dsl/version"
|
2
|
+
|
3
|
+
module Petitest
|
4
|
+
module DSL
|
5
|
+
# @param current_description [String]
|
6
|
+
def desc(current_description)
|
7
|
+
self.current_description = current_description
|
8
|
+
end
|
9
|
+
|
10
|
+
# @param description [String]
|
11
|
+
# @param metadata [Hash{Symbol => Object}]
|
12
|
+
def sub_test(description, metadata = {}, &block)
|
13
|
+
child = ::Class.new(self)
|
14
|
+
child.description = description
|
15
|
+
child.metadata = self.metadata.merge(metadata)
|
16
|
+
child.undefine_test_methods
|
17
|
+
child.class_eval(&block)
|
18
|
+
child
|
19
|
+
end
|
20
|
+
|
21
|
+
# @param description [String]
|
22
|
+
# @param metadata [Hash{Symbol => Object}]
|
23
|
+
def test(description, metadata = {}, &block)
|
24
|
+
block ||= -> { skip }
|
25
|
+
desc(description)
|
26
|
+
define_method("test_#{description}", &block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "petitest/dsl/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "petitest-dsl"
|
7
|
+
spec.version = Petitest::DSL::VERSION
|
8
|
+
spec.authors = ["Ryo Nakamura"]
|
9
|
+
spec.email = ["r7kamura@gmail.com"]
|
10
|
+
spec.summary = "DSL for Petitest."
|
11
|
+
spec.homepage = "https://github.com/petitest/petitest-dsl"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
15
|
+
f.match(%r{^(test|spec|features)/})
|
16
|
+
end
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_runtime_dependency "petitest", "~> 0.3.0"
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: petitest-dsl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryo Nakamura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: petitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.3.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- r7kamura@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/petitest/dsl.rb
|
69
|
+
- lib/petitest/dsl/version.rb
|
70
|
+
- petitest-dsl.gemspec
|
71
|
+
homepage: https://github.com/petitest/petitest-dsl
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.5.2
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: DSL for Petitest.
|
95
|
+
test_files: []
|