Commit 41aa9859 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Converted @private tests to RSpec.

parent a0e1efc4
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
require "jsduck/aggregator"

describe JsDuck::Aggregator do

  def parse(string)
    agr = JsDuck::Aggregator.new
    agr.parse(string)
    agr.result
  end

  shared_examples_for "private" do
    before do
      @doc = parse("/**\n * #{@tagname}\n */")[0]
    end

    it "marks item as private" do
      @doc[:private].should == true
    end
  end

  describe "@private" do
    before { @tagname = "@private" }
    it_should_behave_like "private"
  end

  describe "@hide" do
    before { @tagname = "@hide" }
    it_should_behave_like "private"
  end

  describe "@ignore" do
    before { @tagname = "@ignore" }
    it_should_behave_like "private"
  end

  describe "@protected" do
    before { @tagname = "@protected" }
    it_should_behave_like "private"
  end

end
+0 −7
Original line number Diff line number Diff line
@@ -25,12 +25,5 @@ class TestJsDuck < Test::Unit::TestCase
    assert_equal("Function", docs[0][:type])
  end

  def test_visibility_modifiers
    ["@private", "@hide", "@ignore", "@protected"].each do |tagname|
      docs = JsDuck.parse("/**\n * #{tagname}\n */");
      assert_equal(true, docs[0][:private])
    end
  end

end