Loading spec/aggregator_spec.rb +122 −119 Original line number Diff line number Diff line Loading @@ -131,11 +131,12 @@ describe JsDuck::Aggregator do describe "explicit @method without @param-s" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * @method foo * Some function */")[0] */ EOS end it_should_behave_like "method documentation" it_should_behave_like "no parameters" Loading @@ -144,13 +145,14 @@ describe JsDuck::Aggregator do describe "explicit @method with @param-s" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * @method foo * Some function * @param {String} x First parameter * @param {Number} y Second parameter */")[0] */ EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -161,13 +163,14 @@ describe JsDuck::Aggregator do describe "explicit @method after @params-s" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} x First parameter * @param {Number} y Second parameter * @method foo */")[0] */ EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -178,7 +181,7 @@ describe JsDuck::Aggregator do describe "explicit @method with @param-s overriding implicit code" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} x First parameter Loading @@ -186,7 +189,7 @@ describe JsDuck::Aggregator do * @method foo */ function bar(q, z) {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -196,13 +199,13 @@ function bar(q, z) {} describe "@param-s partially overriding implicit params" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} x */ function foo(q, y) {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -210,14 +213,14 @@ function foo(q, y) {} describe "@param-s declaring only types" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} * @param {Number} */ function foo(x, y) {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -226,13 +229,13 @@ function foo(x, y) {} describe "@return documenting return value" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @return {String} return value */ function foo() {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "has return" Loading @@ -240,13 +243,13 @@ function foo() {} describe "@returns being alias for @return" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @returns {String} return value */ function foo() {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "has return" Loading @@ -254,10 +257,10 @@ function foo() {} describe "method without doc-comment" do before do @docs = parse(" @docs = parse(<<-EOS) // My comment function foo(x, y) {} ") EOS end it "remains undocumented" do @docs.length.should == 0 Loading @@ -267,17 +270,17 @@ function foo(x, y) {} describe "@member" do it "defines the class where item belongs" do items = parse(" items = parse(<<-EOS) /** * @cfg foo * @member Bar */ ") EOS items[0][:member].should == "Bar" end it "forces item to be moved into that class" do items = parse(" items = parse(<<-EOS) /** * @class Bar */ Loading @@ -288,13 +291,13 @@ function foo(x, y) {} * @cfg foo * @member Bar */ ") EOS items[0][:cfg].length.should == 1 items[1][:cfg].length.should == 0 end it "even when @member comes before the class itself" do items = parse(" items = parse(<<-EOS) /** * @cfg foo * @member Bar Loading @@ -302,14 +305,14 @@ function foo(x, y) {} /** * @class Bar */ ") EOS items[0][:cfg].length.should == 1 end end describe "one class many times" do before do @classes = parse(" @classes = parse(<<-EOS) /** * @class Foo * @cfg c1 Loading Loading @@ -339,7 +342,7 @@ function foo(x, y) {} /** @method fun3 */ /** @event eve3 */ /** @property prop3 */ ") EOS end it "results in only one class" do Loading Loading
spec/aggregator_spec.rb +122 −119 Original line number Diff line number Diff line Loading @@ -131,11 +131,12 @@ describe JsDuck::Aggregator do describe "explicit @method without @param-s" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * @method foo * Some function */")[0] */ EOS end it_should_behave_like "method documentation" it_should_behave_like "no parameters" Loading @@ -144,13 +145,14 @@ describe JsDuck::Aggregator do describe "explicit @method with @param-s" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * @method foo * Some function * @param {String} x First parameter * @param {Number} y Second parameter */")[0] */ EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -161,13 +163,14 @@ describe JsDuck::Aggregator do describe "explicit @method after @params-s" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} x First parameter * @param {Number} y Second parameter * @method foo */")[0] */ EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -178,7 +181,7 @@ describe JsDuck::Aggregator do describe "explicit @method with @param-s overriding implicit code" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} x First parameter Loading @@ -186,7 +189,7 @@ describe JsDuck::Aggregator do * @method foo */ function bar(q, z) {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -196,13 +199,13 @@ function bar(q, z) {} describe "@param-s partially overriding implicit params" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} x */ function foo(q, y) {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -210,14 +213,14 @@ function foo(q, y) {} describe "@param-s declaring only types" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @param {String} * @param {Number} */ function foo(x, y) {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "two parameters" Loading @@ -226,13 +229,13 @@ function foo(x, y) {} describe "@return documenting return value" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @return {String} return value */ function foo() {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "has return" Loading @@ -240,13 +243,13 @@ function foo() {} describe "@returns being alias for @return" do before do @doc = parse(" @doc = parse(<<-EOS)[0] /** * Some function * @returns {String} return value */ function foo() {} ")[0] EOS end it_should_behave_like "method documentation" it_should_behave_like "has return" Loading @@ -254,10 +257,10 @@ function foo() {} describe "method without doc-comment" do before do @docs = parse(" @docs = parse(<<-EOS) // My comment function foo(x, y) {} ") EOS end it "remains undocumented" do @docs.length.should == 0 Loading @@ -267,17 +270,17 @@ function foo(x, y) {} describe "@member" do it "defines the class where item belongs" do items = parse(" items = parse(<<-EOS) /** * @cfg foo * @member Bar */ ") EOS items[0][:member].should == "Bar" end it "forces item to be moved into that class" do items = parse(" items = parse(<<-EOS) /** * @class Bar */ Loading @@ -288,13 +291,13 @@ function foo(x, y) {} * @cfg foo * @member Bar */ ") EOS items[0][:cfg].length.should == 1 items[1][:cfg].length.should == 0 end it "even when @member comes before the class itself" do items = parse(" items = parse(<<-EOS) /** * @cfg foo * @member Bar Loading @@ -302,14 +305,14 @@ function foo(x, y) {} /** * @class Bar */ ") EOS items[0][:cfg].length.should == 1 end end describe "one class many times" do before do @classes = parse(" @classes = parse(<<-EOS) /** * @class Foo * @cfg c1 Loading Loading @@ -339,7 +342,7 @@ function foo(x, y) {} /** @method fun3 */ /** @event eve3 */ /** @property prop3 */ ") EOS end it "results in only one class" do Loading