rspec-action-check 0.1.0 → 0.1.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/README.md +160 -2
- data/lib/rspec/actioncheck/helpers.rb +1 -1
- data/lib/rspec/actioncheck/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: 923efd500d7f9bc2bfde5bc1b1ef1f05f02c12cc
|
4
|
+
data.tar.gz: efe08f5b452d90ae153f14d2d38a5ee881807257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2974a67eb82955ee4123ffdfaeea91be5e733cb53a26d0505845591c803e046c3eee8ee1f051434b3464f30508d4541226ff3651b5793c639f5dda75047cb30b
|
7
|
+
data.tar.gz: 7debd562446a2b023f27445e1103e13bfea812ca715f4710b26b1ee6b86f7bafbf3bb4e2433edcd876daac2ab70f860eda3ac02200cd2f5ad68421e39f885d05
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rspec/actioncheck`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -22,7 +21,166 @@ Or install it yourself as:
|
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
25
|
-
|
24
|
+
### Simple case
|
25
|
+
|
26
|
+
You can write that code in spec.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
RSpec.describe 'First Example' do
|
30
|
+
before do
|
31
|
+
@some_state1 = nil
|
32
|
+
@some_state2 = nil
|
33
|
+
end
|
34
|
+
|
35
|
+
actions 'some actions like a scenario test story' do
|
36
|
+
action 'set some_state1 = 100' do
|
37
|
+
@some_state1 = 100
|
38
|
+
end
|
39
|
+
|
40
|
+
check 'some_state1 = 100' do
|
41
|
+
expect(@some_state1).to eq 100
|
42
|
+
end
|
43
|
+
|
44
|
+
action 'set some_state2 = 100' do
|
45
|
+
@some_state2 = 200
|
46
|
+
end
|
47
|
+
|
48
|
+
check 'some_state2 = 200' do
|
49
|
+
expect(@some_state2).to eq 200
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
It output that when It run
|
56
|
+
|
57
|
+
```rspec
|
58
|
+
First Example
|
59
|
+
some actions like a scenario test story
|
60
|
+
action:set some_state1 = 100
|
61
|
+
check:some_state1 = 100
|
62
|
+
action:set some_state2 = 100
|
63
|
+
check:some_state2 = 200
|
64
|
+
```
|
65
|
+
|
66
|
+
It is same as
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
RSpec.describe SomeTest do
|
70
|
+
before do
|
71
|
+
@some_state1 = nil
|
72
|
+
@some_state2 = nil
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'some actions like a scenario test story' do
|
76
|
+
context 'action:set some_state1 = 100' do
|
77
|
+
before do
|
78
|
+
@some_state1 = 100
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'check:some_state1 = 100' do
|
82
|
+
expect(@some_state1).to eq 100
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'action:set some_state2 = 200' do
|
86
|
+
before do
|
87
|
+
@some_state1 = 100
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'check:some_state2 = 200' do
|
91
|
+
expect(@some_state2).to eq 200
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
First one is more clearly to write story test.
|
100
|
+
|
101
|
+
### Branching
|
102
|
+
|
103
|
+
You can write that code in spec if you want to branch story.
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
RSpec.describe 'Branch Example' do
|
107
|
+
before do
|
108
|
+
@some_state1 = nil
|
109
|
+
@some_state2 = nil
|
110
|
+
@some_state3 = nil
|
111
|
+
end
|
112
|
+
|
113
|
+
actions 'some actions like a scenario test story with branching' do
|
114
|
+
action 'set some_state1 = 100' do
|
115
|
+
@some_state1 = 100
|
116
|
+
end
|
117
|
+
|
118
|
+
branch 'branch1' do
|
119
|
+
check 'some_state1 = 100' do
|
120
|
+
expect(@some_state1).to eq 100
|
121
|
+
end
|
122
|
+
|
123
|
+
action 'set some_state2 = 200'
|
124
|
+
@some_state2 = 200
|
125
|
+
end
|
126
|
+
|
127
|
+
check 'some_state1 = 100 and some_state2 == 200' do
|
128
|
+
expect(@some_state1).to eq 100
|
129
|
+
expect(@some_state2).to eq 200
|
130
|
+
end
|
131
|
+
|
132
|
+
branch 'branch in branch1' do
|
133
|
+
action 'set some_state3 = 300'
|
134
|
+
@some_state3 = 300
|
135
|
+
end
|
136
|
+
|
137
|
+
check 'some_state1 = 100 and some_state2 == 200 and some_state3 == 300' do
|
138
|
+
expect(@some_state1).to eq 100
|
139
|
+
expect(@some_state2).to eq 200
|
140
|
+
expect(@some_state3).to eq 300
|
141
|
+
end
|
142
|
+
end
|
143
|
+
branch 'branch` in branch1' do
|
144
|
+
check 'some_state1 = 100 and some_state2 == 200 and some_state3 is nil' do
|
145
|
+
expect(@some_state1).to eq 100
|
146
|
+
expect(@some_state2).to eq 200
|
147
|
+
expect(@some_state3).to be_nil
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
branch 'branch2' do
|
153
|
+
check 'some_state1 = 100 and some_state2 is nil' do
|
154
|
+
expect(@some_state1).to eq 100
|
155
|
+
expect(@some_state2).to be_nil
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
```
|
161
|
+
|
162
|
+
It output that when It run
|
163
|
+
|
164
|
+
```
|
165
|
+
Branch Example
|
166
|
+
some actions like a scenario test story with branching
|
167
|
+
action:set some_state1 = 100
|
168
|
+
action:branch1
|
169
|
+
check:some_state1 = 100
|
170
|
+
action:set some_state2 = 200
|
171
|
+
check:some_state1 = 100 and some_state2 == 200
|
172
|
+
action:branch in branch1
|
173
|
+
action:set some_state3 = 300
|
174
|
+
check:some_state1 = 100 and some_state2 == 200 and some_state3 == 300
|
175
|
+
action:branch` in branch1
|
176
|
+
check:some_state1 = 100 and some_state2 == 200 and some_state3 is nil
|
177
|
+
action:branch2
|
178
|
+
check:some_state1 = 100 and some_state2 is nil
|
179
|
+
```
|
180
|
+
|
181
|
+
It same as ... That code as too long. I will write it when I feel like it.
|
182
|
+
|
183
|
+
Both examples contain in `spec/rspec/example/`
|
26
184
|
|
27
185
|
## Development
|
28
186
|
|
@@ -89,7 +89,7 @@ module RSpec
|
|
89
89
|
_action_dags[name].merge!({
|
90
90
|
forwards: _action_dags[name][:forwards],
|
91
91
|
backwards: _action_dags[name][:backwards] | [before_action_name],
|
92
|
-
action: {description: "action:#{
|
92
|
+
action: {description: "action:#{action_description}", block: action_block},
|
93
93
|
})
|
94
94
|
_action_dags[before_action_name].merge!({
|
95
95
|
forwards: _action_dags[before_action_name][:forwards] | [name],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-action-check
|
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
|
- Yuta Hinokuma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|