Skip to content

Commit

Permalink
Extract (required) specs to separate file.
Browse files Browse the repository at this point in the history
  • Loading branch information
nene committed Aug 1, 2013
1 parent fd28141 commit deedf50
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 43 deletions.
43 changes: 0 additions & 43 deletions spec/aggregator_attributes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,49 +72,6 @@ def parse_member(string)
end
end

describe "a normal config option" do
before do
@doc = parse_member(<<-EOS)
/**
* @cfg foo Something
*/
EOS
end
it "is not required by default" do
@doc[:required].should_not == true
end
end

describe "a config option labeled as required" do
before do
@doc = parse_member(<<-EOS)
/**
* @cfg foo (required) Something
*/
EOS
end
it "has required flag set to true" do
@doc[:required].should == true
end
end

describe "a class with @cfg (required)" do
before do
@doc = parse(<<-EOS)["MyClass"]
/**
* @class MyClass
* @cfg foo (required)
*/
EOS
end
it "doesn't become a required class" do
@doc[:required].should_not == true
end
it "contains required config" do
@doc[:members][0][:required].should == true
end
end

describe "member with @deprecated" do
before do
@deprecated = parse_member(<<-EOS)[:deprecated]
Expand Down
55 changes: 55 additions & 0 deletions spec/aggregator_required_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
require "mini_parser"

describe JsDuck::Aggregator do
def parse(string)
Helper::MiniParser.parse(string)
end

def parse_member(string)
parse(string)["global"][:members][0]
end

describe "a normal config option" do
before do
@doc = parse_member(<<-EOS)
/**
* @cfg foo Something
*/
EOS
end
it "is not required by default" do
@doc[:required].should_not == true
end
end

describe "a config option labeled as required" do
before do
@doc = parse_member(<<-EOS)
/**
* @cfg foo (required) Something
*/
EOS
end
it "has required flag set to true" do
@doc[:required].should == true
end
end

describe "a class with @cfg (required)" do
before do
@doc = parse(<<-EOS)["MyClass"]
/**
* @class MyClass
* @cfg foo (required)
*/
EOS
end
it "doesn't become a required class" do
@doc[:required].should_not == true
end
it "contains required config" do
@doc[:members][0][:required].should == true
end
end

end

0 comments on commit deedf50

Please sign in to comment.