]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/spec/spec/example/example_group_class_definition_spec.rb
Show whether a trace is public or private in the trace list, so that a user can easil...
[rails.git] / vendor / gems / rspec-1.1.2 / spec / spec / example / example_group_class_definition_spec.rb
1 require File.dirname(__FILE__) + '/../../spec_helper'
2
3 module Spec
4   module Example
5     class ExampleGroupSubclass < ExampleGroup
6       class << self
7         attr_accessor :examples_ran
8       end
9
10       @@klass_variable_set = true
11       CONSTANT = :foobar
12
13       before do
14         @instance_variable = :hello
15       end
16
17       it "should run" do
18         self.class.examples_ran = true
19       end
20
21       it "should have access to instance variables" do
22         @instance_variable.should == :hello
23       end
24
25       it "should have access to class variables" do
26         @@klass_variable_set.should == true
27       end
28
29       it "should have access to constants" do
30         CONSTANT.should == :foobar
31       end
32
33       it "should have access to methods defined in the Example Group" do
34         a_method.should == 22
35       end
36
37       def a_method
38         22
39       end
40     end
41
42     describe ExampleGroupSubclass do
43       it "should run" do
44         ExampleGroupSubclass.examples_ran.should be_true
45       end
46     end
47   end
48 end