Sha256: 67df25b324118d0284f862f7b2abb8d37fa0f47fed4622d8eca55c9be1cd6c41

Contents?: true

Size: 652 Bytes

Versions: 82

Compression:

Stored size: 652 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'
$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

82 entries across 82 versions & 12 rubygems

Version Path
pictrails-0.5.0 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
radiant-0.6.5.1 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
radiant-0.6.5 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
radiant-0.6.7 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
radiant-0.6.6 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
radiant-0.6.8 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
radiant-0.6.9 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
rspec-0.0.10 examples/pure/before_and_after_example.rb
rspec-1.1.0 examples/pure/before_and_after_example.rb
rspec-1.1.1 examples/pure/before_and_after_example.rb
rspec-1.1.10 examples/pure/before_and_after_example.rb
rspec-1.1.4 examples/pure/before_and_after_example.rb
rspec-1.1.2 examples/pure/before_and_after_example.rb
rspec-1.1.12 examples/passing/before_and_after_example.rb
rspec-1.1.11 examples/pure/before_and_after_example.rb
rspec-1.1.3 examples/pure/before_and_after_example.rb
rspec-1.1.5 examples/pure/before_and_after_example.rb
rspec-1.1.6 examples/pure/before_and_after_example.rb
rspec-1.1.7 examples/pure/before_and_after_example.rb
rspec-1.1.9 examples/pure/before_and_after_example.rb