Sha256: 1e0eafcc27b7ab1bcca189fe1e165cf8ea58537bd1d7b1d2a393ab1b43d623ba

Contents?: true

Size: 1.08 KB

Versions: 14

Compression:

Stored size: 1.08 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 (Ruby 1.8 only)" do
        with_ruby 1.8 do
          @@class_variable.should == :class_variable
        end
      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

14 entries across 14 versions & 2 rubygems

Version Path
dchelimsky-rspec-1.1.99.13 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.6 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.7 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.8 spec/spec/example/example_group_class_definition_spec.rb
dchelimsky-rspec-1.1.99.9 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.7 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.8 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.2 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.1 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.0 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.6 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.4 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.5 spec/spec/example/example_group_class_definition_spec.rb
rspec-1.2.3 spec/spec/example/example_group_class_definition_spec.rb