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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f97eedd83f7c6a9241c9f3759a1807d9ff7b3edfd170e7a4320a4a1d292e91d7
4
- data.tar.gz: 6c53d48ead218f4876595920e43802749c769ca542aadfde28fc454cb0368beb
3
+ metadata.gz: 9fcbbd609eb6172a23e421ebed3c09965c4b33e8ff12ae3b9513ada52c9375ea
4
+ data.tar.gz: 8680a7dd08f5d2bfb52ae713b95a66da6e1680eaad88dd25b8232a43ac0b5469
5
5
  SHA512:
6
- metadata.gz: 1c83622024411b5fa628cf5d7aac028c3633ab3e3c804823952ad9b6d1122a9ddf1d4c19fa5030bd8e4eb65e503cec9c16d7869ee1740f937bbcbf1de7f09694
7
- data.tar.gz: 92dcf8380c701f334bb30c78a36239814e9903dd62e3b10e50ece457b5ed838b15ddd929b5bd8ac64a77fe630f09ad7c8c2520277679f8c8f084d163b0b55c33
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 applications 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.
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(:three) { 3.let_as(:three_2) }
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
- four_2 = 4.let_as(:four)
77
-
78
- expect(one).to eq(1)
79
- expect(two).to eq(2)
80
- expect(three).to eq(3)
81
- expect(three_2).to eq(3)
82
- expect(four).to eq(4)
83
- expect(four_2).to eq(4)
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
  ```
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module LetAs
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
data/lib/rspec/let_as.rb CHANGED
@@ -14,7 +14,7 @@ module RSpec
14
14
  }
15
15
 
16
16
  raise Error, <<~EOS unless example_group
17
- must be called from an example group or from within:
17
+ `let_as` must be called from an example group (describe / context) or its inner block.
18
18
 
19
19
  RSpec.describe 'answer' do
20
20
  before do
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.0
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-19 00:00:00.000000000 Z
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