Sha256: eec55695902a8e89dd79ef59127e2ee4a4d104fe38607f7c6331ce5eaf3b914c

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'
require 'helpers/examples'

require 'yard-parameters/parameter_handler'
require 'yard-parameters/legacy/parameter_handler'

describe "ParameterHandler" do
  include Helpers::Examples

  describe "valid" do
    before(:all) do
      parse_file :simple_parameter
    end

    it "should register a class reader method for the parameter" do
      yard('SimpleParameter.x').should be_instance_of(CodeObjects::MethodObject)
    end

    it "should register a class writer method for the parameter" do
      yard('SimpleParameter.x=').should be_instance_of(CodeObjects::MethodObject)
    end

    it "should register a instance reader method for the parameter" do
      yard('SimpleParameter#x').should be_instance_of(CodeObjects::MethodObject)
    end

    it "should register a instance writer method for the parameter" do
      yard('SimpleParameter#x=').should be_instance_of(CodeObjects::MethodObject)
    end
  end

  describe "invalid" do
    before(:all) do
      parse_file :bad_parameter
    end

    it "should not register class reader methods for variables" do
      yard('BadParameter.x').should be_nil
    end

    it "should not register class writer methods for variables" do
      yard('BadParameter.x=').should be_nil
    end

    it "should not register instance reader methods for variables" do 
      yard('BadParameter#x').should be_nil
    end

    it "should not register instance writer methods for variables" do
      yard('BadParameter#x=').should be_nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yard-parameters-0.1.1 spec/parameter_handler_spec.rb
yard-parameters-0.1.0 spec/parameter_handler_spec.rb