spec/renum_spec.rb in renum-0.0.1 vs spec/renum_spec.rb in renum-0.0.3
- old
+ new
@@ -7,10 +7,14 @@
def abbr
name[0..0]
end
end
+module MyNamespace
+ enum :FooValue, [ :Bar, :Baz, :Bat ]
+end
+
describe "enum" do
it "creates a class for the value type" do
Status.class.should == Class
end
@@ -41,8 +45,16 @@
Color::RED.abbr.should == "R"
end
it "provides a reasonable to_s for values" do
Status::NOT_STARTED.to_s.should == "Status::NOT_STARTED"
+ end
+
+ it "makes values comparable" do
+ Color::RED.should < Color::GREEN
+ end
+
+ it "allows enums to be nested in other modules or classes" do
+ MyNamespace::FooValue::Bar.class.should == MyNamespace::FooValue
end
end
\ No newline at end of file