Sha256: e9093e874dd3536a4fee05136bc9e7c431c4f0feb602d39bf292a63aac07f299
Contents?: true
Size: 1.59 KB
Versions: 5
Compression:
Stored size: 1.59 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{RUBY18 ? "Legacy::" : ""}ClassConditionHandler" do before(:all) { parse_file :class_condition_handler_001, __FILE__ } def verify_method(*names) names.each {|name| Registry.at("A##{name}").should_not be_nil } names.each {|name| Registry.at("A##{name}not").should be_nil } end it "should parse all unless blocks for complex conditions" do verify_method :g end it "should not parse conditionals inside methods" do verify_method :h end it "should only parse then block if condition is literal value `true`" do verify_method :p end it "should only parse then block if condition is literal integer != 0" do verify_method :o end it "should invert block to parse for literal condition if it's an unless block" do verify_method :e end it "should handle conditions such as 'defined? VALUE'" do verify_method :j, :k end it "should parse all if/elsif blocks for complex conditions" do verify_method :a, :b, :c, :d end it "should only parse else block if condition is literal value `false`" do verify_method :q end it "should only parse else block if condition is literal integer == 0" do verify_method :n end it "should not fail on complex conditions" do lambda { YARD.parse_string("if defined?(A) && defined?(B); puts 'hi' end") }.should_not raise_error lambda do YARD.parse_string(<<-eof) (<<-TEST) unless defined?(ABCD_MODEL_TEST) 'String' TEST eof end.should_not raise_error end end
Version data entries
5 entries across 5 versions & 1 rubygems