paramesan 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 +4 -4
- data/README.md +7 -1
- data/lib/paramesan.rb +21 -13
- data/lib/paramesan/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3588ccf21c136cc11ef86b4551317836898aed56
|
4
|
+
data.tar.gz: e1161b477394209a86c123ec328c09330640c4b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5455dc909ec3b11d9f11afd7d9b9caf6ce89bd23ad4c74c14d69956cc707ffab51daed4467fb54836051cee3560be0ff09f22089387d56403d05750567a78946
|
7
|
+
data.tar.gz: b919e75b9f002b986d15886705b4308e5a571bf1409c25529e64c97c63069a899b8c6b8708e69c75ba6f3d8af3e6eb9fd1f3fc1bb7e91c53ceeba36de39739ea
|
data/README.md
CHANGED
@@ -15,7 +15,9 @@ and output as data that go through the process.
|
|
15
15
|
I looked for the equivalent in Ruby, and the closest that I found was
|
16
16
|
[param_test](https://www.ruby-toolbox.com/projects/param_test). That, however, uses activesupport,
|
17
17
|
which is included in Rails, but I wanted a version that ran in a pure Ruby environment, using only
|
18
|
-
Test::Unit
|
18
|
+
Test::Unit, which I prefer over Minitest, mainly because the latter uses notifications that don't
|
19
|
+
work especially well with Emacs, such as changing the mode line to show the success/failure status,
|
20
|
+
but do not afterward change back to the default settings.
|
19
21
|
|
20
22
|
Ergo, paramesan, which as of this writing, allows a very primitive set of options for parameterized
|
21
23
|
tests.
|
@@ -24,6 +26,8 @@ tests.
|
|
24
26
|
|
25
27
|
## Before
|
26
28
|
|
29
|
+
31 lines.
|
30
|
+
|
27
31
|
```ruby
|
28
32
|
require 'pvn/log/options'
|
29
33
|
require 'test/unit'
|
@@ -60,6 +64,8 @@ end
|
|
60
64
|
|
61
65
|
## After
|
62
66
|
|
67
|
+
20 lines, 35% fewer.
|
68
|
+
|
63
69
|
```ruby
|
64
70
|
require 'pvn/log/options'
|
65
71
|
require 'test/unit'
|
data/lib/paramesan.rb
CHANGED
@@ -4,22 +4,30 @@
|
|
4
4
|
require "paramesan/version"
|
5
5
|
|
6
6
|
module Paramesan
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
module ClassMethods
|
8
|
+
def param_test paramlist, &blk
|
9
|
+
puts "self: #{self}"
|
10
|
+
|
11
|
+
paramlist.each do |params|
|
12
|
+
basename = "test_" + params.to_s.gsub(Regexp.new('[^\w]+'), '_')
|
13
|
+
mname = basename
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
count = 1
|
16
|
+
while instance_methods.include? mname.to_sym
|
17
|
+
mname += "_#{count}"
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
define_method mname do
|
21
|
+
instance_exec(params, &blk)
|
22
|
+
puts
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
27
|
+
|
28
|
+
extend ClassMethods
|
29
|
+
|
30
|
+
def self.included other
|
31
|
+
other.extend ClassMethods
|
32
|
+
end
|
25
33
|
end
|
data/lib/paramesan/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paramesan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Pace
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|