From 41aa985908b7b6e264836bab04047ec233e1a52f Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Sun, 19 Dec 2010 19:50:34 +0200 Subject: [PATCH] Converted @private tests to RSpec. --- spec/aggregator_private_spec.rb | 41 +++++++++++++++++++++++++++++++++ test/tc_jsduck.rb | 7 ------ 2 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 spec/aggregator_private_spec.rb diff --git a/spec/aggregator_private_spec.rb b/spec/aggregator_private_spec.rb new file mode 100644 index 00000000..efb078c5 --- /dev/null +++ b/spec/aggregator_private_spec.rb @@ -0,0 +1,41 @@ +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 diff --git a/test/tc_jsduck.rb b/test/tc_jsduck.rb index dbec9aee..43417ccf 100644 --- a/test/tc_jsduck.rb +++ b/test/tc_jsduck.rb @@ -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 -- GitLab