Commit a0e1efc4 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Converted @static tests to RSpec.

parent 6fa00345
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -176,4 +176,20 @@ describe JsDuck::Aggregator do
    it_should_behave_like "cfg or property String type"
  end

  describe "property with @static" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
         * @property
         * @static
         */
        foo: "",
      EOS
    end
    it_should_behave_like "property"
    it "detects property as static" do
      @doc[:static].should == true
    end
  end

end
+16 −0
Original line number Diff line number Diff line
@@ -255,6 +255,22 @@ describe JsDuck::Aggregator do
    it_should_behave_like "has return"
  end

  describe "method with @static" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
         * Some function
         * @static
         */
        function foo() {}
      EOS
    end
    it_should_behave_like "method documentation"
    it "detects method as static" do
      @doc[:static].should == true
    end
  end

  describe "method without doc-comment" do
    before do
      @docs = parse(<<-EOS)
+0 −16
Original line number Diff line number Diff line
@@ -32,21 +32,5 @@ class TestJsDuck < Test::Unit::TestCase
    end
  end

  def test_static_method
    docs = JsDuck.parse("/**
 * @method
 * @static
 */");
    assert_equal(true, docs[0][:static])
  end

  def test_static_property
    docs = JsDuck.parse("/**
 * @property
 * @static
 */");
    assert_equal(true, docs[0][:static])
  end

end