Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 3307 Bytes
1 | require File.dirname(__FILE__) + "/../spec_helper" |
2 | |
3 | describe InheritableClassAttributes, "when included in a class" do |
4 | class BasicInheritable |
5 | include InheritableClassAttributes |
6 | cattr_inheritable_accessor :accessor |
7 | end |
8 | |
9 | it "should add inheritable attribute declaration methods to the class" do |
10 | BasicInheritable.should respond_to(:cattr_inheritable_reader) |
11 | BasicInheritable.should respond_to(:cattr_inheritable_writer) |
12 | BasicInheritable.should respond_to(:cattr_inheritable_accessor) |
13 | end |
14 | |
15 | it "should allow child classes to override the value without affecting the parent" do |
16 | BasicInheritable.accessor = :unchanged |
17 | Kernel.module_eval { class AnotherAccessor < BasicInheritable; end} |
18 | AnotherAccessor.accessor = :changed |
19 | BasicInheritable.accessor.should == :unchanged |
20 | AnotherAccessor.accessor.should == :changed |
21 | end |
22 | |
23 | it "should copy the attribute value to child classes when subclassed" do |
24 | BasicInheritable.accessor = :unchanged |
25 | Kernel.module_eval { class AccessorInherited < BasicInheritable; end} |
26 | AccessorInherited.accessor.should == :unchanged |
27 | end |
28 | end |
29 | |
30 | describe InheritableClassAttributes, "when a reader is defined on a class" do |
31 | class WithInheritableReader |
32 | include InheritableClassAttributes |
33 | cattr_inheritable_reader :reader |
34 | @reader = "testing!" |
35 | end |
36 | |
37 | it "should create a reader method on the class for the attribute" do |
38 | WithInheritableReader.should respond_to(:reader) |
39 | WithInheritableReader.should_not respond_to(:reader=) |
40 | end |
41 | |
42 | it "should return the value of the corresponding class instance variable" do |
43 | WithInheritableReader.reader.should == "testing!" |
44 | end |
45 | |
46 | it "should pass the reader down to its child classes" do |
47 | Kernel.module_eval { class ReaderInherited < WithInheritableReader; end } |
48 | ReaderInherited.should respond_to(:reader) |
49 | end |
50 | end |
51 | |
52 | describe InheritableClassAttributes, "when a writer is defined on a class" do |
53 | class WithInheritableWriter |
54 | include InheritableClassAttributes |
55 | cattr_inheritable_writer :writer |
56 | end |
57 | |
58 | it "should create a writer method on the class for the attribute" do |
59 | WithInheritableWriter.should respond_to(:writer=) |
60 | WithInheritableWriter.should_not respond_to(:writer) |
61 | end |
62 | |
63 | it "should assign the value of the corresponding class instance variable" do |
64 | WithInheritableWriter.writer = :writer |
65 | WithInheritableWriter.instance_variable_get("@writer").should == :writer |
66 | end |
67 | |
68 | it "should pass the writer down to its child classes" do |
69 | Kernel.module_eval { class WriterInherited < WithInheritableWriter; end } |
70 | WriterInherited.should respond_to(:writer=) |
71 | end |
72 | end |
73 | |
74 | describe InheritableClassAttributes, "when an accessor is defined on a class" do |
75 | class WithInheritableAccessor |
76 | include InheritableClassAttributes |
77 | cattr_inheritable_accessor :accessor |
78 | end |
79 | |
80 | it "should create reader and writer methods on the class for the attribute" do |
81 | WithInheritableAccessor.should respond_to(:accessor) |
82 | WithInheritableAccessor.should respond_to(:accessor=) |
83 | end |
84 | |
85 | it "should pass the writer and reader down to its child classes" do |
86 | Kernel.module_eval { class Accessor < WithInheritableAccessor; end } |
87 | Accessor.should respond_to(:accessor) |
88 | Accessor.should respond_to(:accessor=) |
89 | end |
90 | end |