Sha256: 28c401a18ef448db5f8c38b4cd99ce43f8cef3cf741a215d944c633335e2f21c

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

module Spec
  module Example
    describe 'Nested Example Groups' do
      parent = self
      
      def count
        @count ||= 0
        @count = @count + 1
        @count
      end

      before(:all) do
        count.should == 1
      end

      before(:all) do
        count.should == 2
      end

      before(:each) do
        count.should == 3
      end

      before(:each) do
        count.should == 4
      end

      it "should run before(:all), before(:each), example, after(:each), after(:all) in order" do
        count.should == 5
      end

      after(:each) do
        count.should == 7
      end

      after(:each) do
        count.should == 6
      end

      after(:all) do
        count.should == 9
      end

      after(:all) do
        count.should == 8
      end

      describe 'nested example group' do
        self.superclass.should == parent
        
        it "should run all before and after callbacks" do
          count.should == 5
        end
      end
    end

    describe "Nested Example Groups" do
      describe "description options", :other_options => "other options" do
        it "includes :location" do
          self.class.options[:location].should match(/#{__FILE__}/)
        end

        it "includes any other options" do
          self.class.options[:other_options].should == "other options"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rspec-1.2.7 spec/spec/example/nested_example_group_spec.rb
rspec-1.2.8 spec/spec/example/nested_example_group_spec.rb
rspec-1.2.2 spec/spec/example/nested_example_group_spec.rb
rspec-1.2.1 spec/spec/example/nested_example_group_spec.rb
rspec-1.2.4 spec/spec/example/nested_example_group_spec.rb
rspec-1.2.3 spec/spec/example/nested_example_group_spec.rb
rspec-1.2.6 spec/spec/example/nested_example_group_spec.rb
rspec-1.2.5 spec/spec/example/nested_example_group_spec.rb