Sha256: 3c2783955a9e0964cea4f5780dd8ec9e4a123d177055e303d5a91fa4aa22cb15

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

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

module Spec
  module Example
    class ExampleGroupSubclass < ExampleGroup
      class << self
        attr_accessor :examples_ran
      end

      @@class_variable = :class_variable
      CONSTANT = :constant

      before(:each) do
        @instance_variable = :instance_variable
      end
      
      after(:all) do
        self.class.examples_ran = true
      end

      def a_method
        22
      end

      it "can access instance variables defined before(:each)" do
        @instance_variable.should == :instance_variable
      end

      it "can access class variables" do
        @@class_variable.should == :class_variable
      end

      it "can access constants" do
        CONSTANT.should == :constant
      end

      it "can access methods defined in the Example Group" do
        a_method.should == 22
      end
      
    end

    describe ExampleGroupSubclass do
      it "should run" do
        ExampleGroupSubclass.examples_ran.should be_true
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
dchelimsky-rspec-1.1.99.1 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.2 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.3 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.4 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.5 spec/spec/example/example_group_class_definition_spec.rb
newbamboo-evented-rspec-1.1.12 spec/spec/example/example_group_class_definition_spec.rb
newbamboo-rspec-1.1.12 spec/spec/example/example_group_class_definition_spec.rb