pork 1.4.0 → 1.4.1
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 +4 -4
- data/CHANGES.md +16 -1
- data/README.md +14 -1
- data/lib/pork/expect.rb +4 -0
- data/lib/pork/report/description.rb +1 -1
- data/lib/pork/version.rb +1 -1
- data/pork.gemspec +5 -3
- data/test/test_expect.rb +37 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea04f4f02776116f6c7025ec88bff977b9e0f6c
|
4
|
+
data.tar.gz: 7552e19b9204c1c4c5b7909df41b07a92ef24350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 364d9a7e04b48dbd722f22f410eafeafef623ab77097541a73d3c39ba7fc2e4305af584325f0aac8cb86eb42e742bab781ac103b4b8995f544fc5f4c557539df
|
7
|
+
data.tar.gz: e8c9f3031d0850f7ff1accb9852a082e03ea9f0a13e429e9f99b823f8480423434ad221197611f68ffc29ba2ab0feff0ae1c5985ddf48e49eefa3603bf0c5125
|
data/CHANGES.md
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Pork 1.4.0 -- 2015-07-23
|
4
|
+
|
5
|
+
### Enhancement
|
6
|
+
|
7
|
+
* Introduced `Expect#approx` for comparing two floating point numbers.
|
8
|
+
|
9
|
+
### Bugs fixed
|
10
|
+
|
11
|
+
* Removed the extra colon with PORK_REPORT=description.
|
12
|
+
|
3
13
|
## Pork 1.4.0 -- 2015-07-18
|
4
14
|
|
5
15
|
### Enhancement
|
6
16
|
|
7
17
|
* Introduced `Pork.report_mode` and `ENV['PORK_REPORT']`.
|
8
18
|
* The replicating command for `ENV['PORK_SEED']` is more accurate now.
|
9
|
-
* Now you can still run test sequentially when ENV['PORK_TEST'] is set.
|
19
|
+
* Now you can still run test sequentially when `ENV['PORK_TEST']` is set.
|
20
|
+
|
21
|
+
### Bugs fixed
|
22
|
+
|
23
|
+
* Using `ENV['PORK_TEST']` to specify a describe block would run all
|
24
|
+
before/after blocks properly now.
|
10
25
|
|
11
26
|
## Pork 1.3.1 -- 2015-06-06
|
12
27
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Pork [](http://travis-ci.org/godfat/pork) [](https://coveralls.io/r/godfat/pork)
|
1
|
+
# Pork [](http://travis-ci.org/godfat/pork) [](https://coveralls.io/r/godfat/pork) [](https://gitter.im/godfat/pork)
|
2
2
|
|
3
3
|
by Lin Jen-Shin ([godfat](http://godfat.org))
|
4
4
|
|
@@ -513,6 +513,19 @@ require 'pork/auto'
|
|
513
513
|
would{ 1.should.gte 1 }
|
514
514
|
```
|
515
515
|
|
516
|
+
### Pork::Expect#approx
|
517
|
+
|
518
|
+
Comparing two floating point numbers is troublesome. `approx` would round on
|
519
|
+
two numbers so it would make less false positives. There's an optional second
|
520
|
+
argument which indicates the precision for the fractional part. By default
|
521
|
+
it's 10. (round on 10)
|
522
|
+
|
523
|
+
``` ruby
|
524
|
+
require 'pork/auto'
|
525
|
+
|
526
|
+
would{ 1.23.should.approx 1.225, 2 }
|
527
|
+
```
|
528
|
+
|
516
529
|
### Pork::Expect#raise
|
517
530
|
|
518
531
|
Expect for exceptions! There are two ways to call it. Either you could use
|
data/lib/pork/expect.rb
CHANGED
@@ -40,6 +40,10 @@ module Pork
|
|
40
40
|
def lte rhs; self <= rhs; end
|
41
41
|
def gte rhs; self >= rhs; end
|
42
42
|
|
43
|
+
def approx rhs, precision=10
|
44
|
+
round(precision) == rhs.round(precision)
|
45
|
+
end
|
46
|
+
|
43
47
|
def raise exception=::RuntimeError
|
44
48
|
satisfy("#{__not__}raising #{exception}") do
|
45
49
|
begin
|
data/lib/pork/version.rb
CHANGED
data/pork.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: pork 1.4.
|
2
|
+
# stub: pork 1.4.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "pork"
|
6
|
-
s.version = "1.4.
|
6
|
+
s.version = "1.4.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
11
|
-
s.date = "2015-07-
|
11
|
+
s.date = "2015-07-23"
|
12
12
|
s.description = "Pork -- Simple and clean and modular testing library.\n\nInspired by [Bacon][].\n\n[Bacon]: https://github.com/chneukirchen/bacon"
|
13
13
|
s.email = ["godfat (XD) godfat.org"]
|
14
14
|
s.files = [
|
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
"task/README.md",
|
51
51
|
"task/gemgem.rb",
|
52
52
|
"test/test_bacon.rb",
|
53
|
+
"test/test_expect.rb",
|
53
54
|
"test/test_inspect.rb",
|
54
55
|
"test/test_nested.rb",
|
55
56
|
"test/test_pork_test.rb",
|
@@ -62,6 +63,7 @@ Gem::Specification.new do |s|
|
|
62
63
|
s.summary = "Pork -- Simple and clean and modular testing library."
|
63
64
|
s.test_files = [
|
64
65
|
"test/test_bacon.rb",
|
66
|
+
"test/test_expect.rb",
|
65
67
|
"test/test_inspect.rb",
|
66
68
|
"test/test_nested.rb",
|
67
69
|
"test/test_pork_test.rb",
|
data/test/test_expect.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
require 'pork/test'
|
3
|
+
|
4
|
+
describe Pork::Expect do
|
5
|
+
would 'eq' do
|
6
|
+
expect(1).eq 1
|
7
|
+
end
|
8
|
+
|
9
|
+
would 'lt' do
|
10
|
+
expect(0).lt 1
|
11
|
+
end
|
12
|
+
|
13
|
+
would 'gt' do
|
14
|
+
expect(1).gt 0
|
15
|
+
end
|
16
|
+
|
17
|
+
would 'lte' do
|
18
|
+
expect(0).lte 0
|
19
|
+
expect(0).lte 1
|
20
|
+
end
|
21
|
+
|
22
|
+
would 'gte' do
|
23
|
+
expect(1).gte 1
|
24
|
+
expect(1).gte 0
|
25
|
+
end
|
26
|
+
|
27
|
+
would 'approx' do
|
28
|
+
expect(1.2345678901234).approx 1.2345678901
|
29
|
+
expect(1.2345678901234).approx 1.23456789012
|
30
|
+
expect(1.2345678901234).approx 1.234567890123
|
31
|
+
expect(1.2345678901234).approx 1.234567890124
|
32
|
+
expect(1.23).approx 1.23 , 2
|
33
|
+
expect(1.23).approx 1.225 , 2
|
34
|
+
expect(1.23).approx 1.234 , 2
|
35
|
+
expect(1.23).approx 1.2345, 2
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- task/README.md
|
75
75
|
- task/gemgem.rb
|
76
76
|
- test/test_bacon.rb
|
77
|
+
- test/test_expect.rb
|
77
78
|
- test/test_inspect.rb
|
78
79
|
- test/test_nested.rb
|
79
80
|
- test/test_pork_test.rb
|
@@ -106,6 +107,7 @@ specification_version: 4
|
|
106
107
|
summary: Pork -- Simple and clean and modular testing library.
|
107
108
|
test_files:
|
108
109
|
- test/test_bacon.rb
|
110
|
+
- test/test_expect.rb
|
109
111
|
- test/test_inspect.rb
|
110
112
|
- test/test_nested.rb
|
111
113
|
- test/test_pork_test.rb
|