changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/spec/spec/example/example_group_class_definition_spec.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
1require File.dirname(__FILE__) + '/../../spec_helper'
2
3module 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
48end