Sha256: e2c969de454c9bd6618cf271b41ca7b1e4d26c4cbdc530e50c89042ca3852809

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

Feature: before and after blocks

  Scenario: define around(:each) block in example group
    Given a file named "around_each_in_example_group_spec.rb" with:
      """
      require 'rspec/expectations'

      class Thing
        def self.cache
          @cache ||= []
        end

        def initialize
          self.class.cache << self
        end
      end

      describe Thing do
        around(:each) do |example|
          Thing.new
          example.run
          Thing.cache.clear
        end

        it "has 1 Thing (1)" do
          Thing.cache.length.should == 1
        end

        it "has 1 Thing (2)" do
          Thing.cache.length.should == 1
        end
      end
      """
    When I run "rspec around_each_in_example_group_spec.rb"
    Then the stderr should not match "NoMethodError"
    Then the stdout should match "2 examples, 0 failures"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-core-2.0.0.a5 features/before_and_after_blocks/around.feature
rspec-core-2.0.0.a4 features/before_and_after_blocks/around.feature
rspec-core-2.0.0.a3 features/before_and_after_blocks/around.feature