petitest-spec 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +16 -2
- data/Rakefile +1 -3
- data/lib/petitest/spec.rb +10 -0
- data/lib/petitest/spec/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: 9b426ff3ae56ec13f4486f96394c9ddf950987a4
|
4
|
+
data.tar.gz: b0c9c77ca031cfe98783912833887de717a8e73c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 124cfc4f4f4acb27b7c23218c26c136c70f6fcc2d7dc872d8ffdb6f2278424b182570375d7528801bef5fef94697ca983fcf3d2106be4b919d9d0e564583dc06
|
7
|
+
data.tar.gz: c6f477d43ea77eed0cf577aea75b7eeb1ec7d80e041b79af3cc5dd4fee624e56d640096694c4cab08ceee28457c2bf8349893eb3067f157ed44927f8b0eddc5f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Require `"petitest/spec"` and extend `Petitest::Spec` into your test class.
|
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
require "petitest/autorun"
|
34
|
-
require "petitest/
|
34
|
+
require "petitest/spec"
|
35
35
|
|
36
36
|
class ExampleTest < Petitest::Test
|
37
37
|
include ::Petitest::Spec
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
Nest a test group with description. `.context` is an alias.
|
46
46
|
|
47
47
|
```ruby
|
48
|
-
describe
|
48
|
+
describe "GET /me" do
|
49
49
|
context "without logged-in" do
|
50
50
|
it "returns 401" do
|
51
51
|
assert { response.status == 200 }
|
@@ -67,3 +67,17 @@ specify "x is foo" do
|
|
67
67
|
assert { x == "foo" }
|
68
68
|
end
|
69
69
|
```
|
70
|
+
|
71
|
+
### .let
|
72
|
+
|
73
|
+
Define a memozied method.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
let(:result) do
|
77
|
+
1 + 1
|
78
|
+
end
|
79
|
+
|
80
|
+
it "returns 2" do
|
81
|
+
assert { result == 2 }
|
82
|
+
end
|
83
|
+
```
|
data/Rakefile
CHANGED
data/lib/petitest/spec.rb
CHANGED
@@ -16,5 +16,15 @@ module Petitest
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
# @param method_name [Symbol]
|
21
|
+
def let(method_name, &block)
|
22
|
+
define_method(method_name) do
|
23
|
+
@memoized_table ||= {}
|
24
|
+
@memoized_table.fetch(method_name) do |key|
|
25
|
+
@memoized_table[key] = instance_eval(&block)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
19
29
|
end
|
20
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: petitest-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: petitest
|