|
134 | 134 | raise "bad current scope: #{RSpec.current_scope.inspect}"
|
135 | 135 | end
|
136 | 136 |
|
137 |
| - if RSpec.current_scope.in_example_context? |
138 |
| - raise "this is not an example context" |
139 |
| - end |
140 |
| - |
141 | 137 | RSpec.configure do |c|
|
142 | 138 | c.before :suite do
|
143 | 139 | expect(RSpec.current_scope).to eq(:before_suite_hook)
|
144 |
| - expect(RSpec.current_scope.in_example_context?).to eq(false) |
145 | 140 | end
|
146 | 141 |
|
147 | 142 | c.before :all do
|
148 | 143 | expect(RSpec.current_scope).to eq(:before_all_hook)
|
149 |
| - expect(RSpec.current_scope.in_example_context?).to eq(false) |
150 | 144 | end
|
151 | 145 |
|
152 | 146 | c.before :each do
|
153 | 147 | expect(RSpec.current_scope).to eq(:before_each_hook)
|
154 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
155 | 148 | end
|
156 | 149 |
|
157 | 150 | c.around :each do |ex|
|
158 | 151 | expect(RSpec.current_scope).to eq(:before_each_hook)
|
159 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
160 | 152 | ex.run
|
161 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
162 | 153 | expect(RSpec.current_scope).to eq(:after_each_hook)
|
163 | 154 | end
|
164 | 155 |
|
165 | 156 | c.after :each do
|
166 | 157 | expect(RSpec.current_scope).to eq(:after_each_hook)
|
167 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
168 | 158 | end
|
169 | 159 |
|
170 | 160 | c.after :all do
|
171 | 161 | expect(RSpec.current_scope).to eq(:after_all_hook)
|
172 |
| - expect(RSpec.current_scope.in_example_context?).to eq(false) |
173 | 162 | end
|
174 | 163 |
|
175 | 164 | c.after :suite do
|
176 | 165 | expect(RSpec.current_scope).to eq(:after_suite_hook)
|
177 |
| - expect(RSpec.current_scope.in_example_context?).to eq(false) |
178 | 166 | end
|
179 | 167 | end
|
180 | 168 |
|
181 | 169 | before :all do
|
182 |
| - expect(RSpec.current_scope.in_example_context?).to eq(false) |
183 | 170 | expect(RSpec.current_scope).to eq(:before_all_hook)
|
184 | 171 | end
|
185 | 172 |
|
186 | 173 | before :each do
|
187 | 174 | expect(RSpec.current_scope).to eq(:before_each_hook)
|
188 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
189 | 175 | end
|
190 | 176 |
|
191 | 177 | around :each do |ex|
|
|
195 | 181 | end
|
196 | 182 |
|
197 | 183 | after :each do
|
198 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
199 | 184 | expect(RSpec.current_scope).to eq(:after_each_hook)
|
200 | 185 | end
|
201 | 186 |
|
202 | 187 | after :all do
|
203 | 188 | expect(RSpec.current_scope).to eq(:after_all_hook)
|
204 |
| - expect(RSpec.current_scope.in_example_context?).to eq(false) |
205 | 189 | end
|
206 | 190 |
|
207 | 191 | it "returns :example inside an example" do
|
208 | 192 | expect(RSpec.current_scope).to eq(:example)
|
209 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
210 | 193 | end
|
211 | 194 |
|
212 | 195 | it "works for more than one example in a describe block" do
|
213 | 196 | expect(RSpec.current_scope).to eq(:example)
|
214 |
| - expect(RSpec.current_scope.in_example_context?).to eq(true) |
215 | 197 | end
|
216 | 198 | end
|
217 | 199 |
|
|
0 commit comments