rspec-let_as 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +14 -10
- data/lib/rspec/let_as/version.rb +1 -1
- data/lib/rspec/let_as.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fcbbd609eb6172a23e421ebed3c09965c4b33e8ff12ae3b9513ada52c9375ea
|
4
|
+
data.tar.gz: 8680a7dd08f5d2bfb52ae713b95a66da6e1680eaad88dd25b8232a43ac0b5469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7a64feffd688a5417567dbb76eefbfee0ff5f7596379e7e66abc81d6fbc63d49ef38654cbfe485f5c844106fc0c61070fed857e482e5136e6bd1b4f3c299d55
|
7
|
+
data.tar.gz: d3b338780ed14ab739d63d3931c63d8cf776432d4e6b957a08dfabccf9262133539441b9d7283b2c9d42dcd9636b7170b69a193c354ea3bd370cddd92940a95e
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Keita Urashima
|
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
CHANGED
@@ -18,7 +18,7 @@ end
|
|
18
18
|
|
19
19
|
## Motivation
|
20
20
|
|
21
|
-
When testing Rails
|
21
|
+
When testing a Rails application with RSpec, I am often faced with the need to arrange large object graph. And since I also need to be able to access specific nodes in the graph, I have to create edges one by one.
|
22
22
|
|
23
23
|
``` ruby
|
24
24
|
RSpec.describe MyApp do
|
@@ -70,17 +70,21 @@ RSpec.describe 'let_as' do
|
|
70
70
|
2.let_as :two
|
71
71
|
end
|
72
72
|
|
73
|
-
let(:
|
73
|
+
let!(:_three) { 3.let_as(:three) }
|
74
|
+
|
75
|
+
def let_four
|
76
|
+
4.let_as :four
|
77
|
+
end
|
74
78
|
|
75
79
|
example do
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
expect(
|
80
|
-
expect(
|
81
|
-
expect(
|
82
|
-
expect(four).to
|
83
|
-
expect(
|
80
|
+
let_four
|
81
|
+
5.let_as :five
|
82
|
+
|
83
|
+
expect(one).to eq(1)
|
84
|
+
expect(two).to eq(2)
|
85
|
+
expect(three).to eq(3)
|
86
|
+
expect(four).to eq(4)
|
87
|
+
expect(five).to eq(5)
|
84
88
|
end
|
85
89
|
end
|
86
90
|
```
|
data/lib/rspec/let_as/version.rb
CHANGED
data/lib/rspec/let_as.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-let_as
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keita Urashima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: binding_of_caller
|
@@ -45,6 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- LICENSE.txt
|
48
49
|
- README.md
|
49
50
|
- lib/rspec-let_as.rb
|
50
51
|
- lib/rspec/let_as.rb
|