Sha256: a32d93d35d84257b623bde1424492994157f866f7a542a269290ccda3022d852

Contents?: true

Size: 604 Bytes

Versions: 7

Compression:

Stored size: 604 Bytes

Contents

$global = 0

describe "State created in before(:all)" do
  before :all do
    @sideeffect = 1
    $global +=1
  end

  before :each do
    @isolated = 1
  end
  
  it "should be accessible from example" do
    @sideeffect.should == 1
    $global.should == 1
    @isolated.should == 1

    @sideeffect += 1
    @isolated += 1
  end

  it "should not have sideffects" do
    @sideeffect.should == 1
    $global.should == 2
    @isolated.should == 1

    @sideeffect += 1
    @isolated += 1
  end

  after :each do
    $global += 1
  end
  
  after :all do
    $global.should == 3
    $global = 0
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/examples/before_and_after_example.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/examples/before_and_after_example.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/examples/before_and_after_example.rb
rspec-1.0.5 examples/before_and_after_example.rb
rspec-1.0.6 examples/before_and_after_example.rb
rspec-1.0.7 examples/before_and_after_example.rb
rspec-1.0.8 examples/before_and_after_example.rb