Sha256: 24c23ed571e81b654a130c91c32f8635bb3bdce574ccecd7eda07ad598b6f516

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'
require 'helpers/examples'

require 'yard-dm/property_handler'
require 'yard-dm/legacy/property_handler'

describe "PropertyHandler" do
  include Helpers::Examples

  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 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

  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yard-dm-0.1.1 spec/property_handler_spec.rb