spec/property_handler_spec.rb in yard-dm-0.1.0 vs spec/property_handler_spec.rb in yard-dm-0.1.1
- old
+ new
@@ -5,24 +5,47 @@
require 'yard-dm/legacy/property_handler'
describe "PropertyHandler" do
include Helpers::Examples
- before(:all) do
- parse_file :simple_properties
- end
+ describe "valid" do
+ before(:all) do
+ parse_file :simple_properties
+ end
- it "should define class methods for the properties" do
- yard('SimpleProperties.id').should be_instance_of(CodeObjects::MethodObject)
- yard('SimpleProperties.name').should be_instance_of(CodeObjects::MethodObject)
- end
+ it "should define class methods for the properties" do
+ yard('SimpleProperties.id').should be_instance_of(CodeObjects::MethodObject)
+ yard('SimpleProperties.name').should be_instance_of(CodeObjects::MethodObject)
+ end
- it "should define reader methods for the properties" do
- yard('SimpleProperties#id').should be_instance_of(CodeObjects::MethodObject)
- yard('SimpleProperties#name').should be_instance_of(CodeObjects::MethodObject)
+ it "should define reader methods for the properties" do
+ yard('SimpleProperties#id').should be_instance_of(CodeObjects::MethodObject)
+ yard('SimpleProperties#name').should be_instance_of(CodeObjects::MethodObject)
+ end
+
+ it "should define writer methods for the properties" do
+ yard('SimpleProperties#id=').should be_instance_of(CodeObjects::MethodObject)
+ yard('SimpleProperties#name=').should be_instance_of(CodeObjects::MethodObject)
+ end
end
- it "should define writer methods for the properties" do
- yard('SimpleProperties#id=').should be_instance_of(CodeObjects::MethodObject)
- yard('SimpleProperties#name=').should be_instance_of(CodeObjects::MethodObject)
+ describe "invalid" do
+ before(:all) do
+ parse_file :invalid_properties
+ end
+
+ it "should not define class methods for 'property' variables" do
+ yard('InvalidProperties.id').should be_nil
+ yard('InvalidProperties.name').should be_nil
+ end
+
+ it "should not define reader methods for 'property' variables" do
+ yard('InvalidProperties#id').should be_nil
+ yard('InvalidProperties#name').should be_nil
+ end
+
+ it "should not define writer methods for 'property' variables" do
+ yard('InvalidProperties#id=').should be_nil
+ yard('InvalidProperties#name=').should be_nil
+ end
end
end