spec/deprecated_spec.rb in bindata-1.1.0 vs spec/deprecated_spec.rb in bindata-1.2.0

- old
+ new

@@ -19,5 +19,36 @@ class SubclassMultiValue < BinData::MultiValue end }.should raise_error end end + +describe BinData::Base, "when defining" do + it "should handle deprecated #register method" do + lambda { + class DeprecatedRegisterBase < BinData::Base + register(self.name, self) + end + }.should_not raise_error + end + + it "should handle deprecated #register method for subclasses" do + lambda { + class DeprecatedSuperBase < BinData::Base + def self.inherited(subclass) + register(subclass.name, subclass) + end + end + + class DeprecatedSubBase < DeprecatedSuperBase + end + }.should_not raise_error + end + + it "should handle deprecated #register method with custom calling" do + lambda { + class DeprecatedCustomBase < BinData::Base + register(name, Object) + end + }.should_not raise_error + end +end