Sha256: bc79a03ae7d7b1dd5e881f316da1f835ed5d6b64287b7e4ba59ceb281e72ad98

Contents?: true

Size: 648 Bytes

Versions: 3

Compression:

Stored size: 648 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

3 entries across 3 versions & 1 rubygems

Version Path
picolena-0.1.6 rails_plugins/rspec/examples/pure/before_and_after_example.rb
picolena-0.1.7 rails_plugins/rspec/examples/pure/before_and_after_example.rb
picolena-0.1.8 rails_plugins/rspec/examples/pure/before_and_after_example.rb