repo.or.cz
/
monkeycharger.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Upgraded Rails and RSpec
[monkeycharger.git]
/
vendor
/
plugins
/
rspec
/
examples
/
before_and_after_example.rb
blob
09e3805fb5a25165446856173d6cef21fdcd26ef
1
$global = 0
2
3
describe "State created in before(:all)" do
4
before :all do
5
@sideeffect = 1
6
$global +=1
7
end
8
9
before :each do
10
@isolated = 1
11
end
12
13
it "should be accessible from example" do
14
@sideeffect.should == 1
15
$global.should == 1
16
@isolated.should == 1
17
18
@sideeffect += 1
19
@isolated += 1
20
end
21
22
it "should not have sideffects" do
23
@sideeffect.should == 1
24
$global.should == 2
25
@isolated.should == 1
26
27
@sideeffect += 1
28
@isolated += 1
29
end
30
31
after :each do
32
$global += 1
33
end
34
35
after :all do
36
$global.should == 3
37
$global = 0
38
end
39
end