Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	lib/license_finder/finder.rb
	spec/finder_spec.rb
  • Loading branch information...
commit a7d1860e1d365510590f6f3c7a13a75ba8e2170a 2 parents 8c44944 + eaf03f9
@travis travis authored
Showing with 15 additions and 3 deletions.
  1. +3 −3 lib/license_finder/finder.rb
  2. +12 −0 spec/finder_spec.rb
View
6 lib/license_finder/finder.rb
@@ -7,11 +7,11 @@ def initialize
when File.exists?('./config/license_finder.yml')
YAML.load(File.open('./config/license_finder.yml').readlines.join)
else
- {'whitelist' => [], 'ignore_groups' => []}
+ {}
end
- @whitelist = config['whitelist']
- @ignore_groups = config['ignore_groups'].map{|g| g.to_sym}
+ @whitelist = config['whitelist'] || []
+ @ignore_groups = (config['ignore_groups'] || []).map{|g| g.to_sym}
@dependencies_dir = config['dependencies_file_dir']
end
View
12 spec/finder_spec.rb
@@ -44,6 +44,12 @@
LicenseFinder::Finder.new.whitelist.should =~ ['MIT', 'Apache']
end
+ it "should load an empty whitelist from license_finder.yml when there are no whitelist items" do
+ stub(File).exists?('./config/license_finder.yml') {true}
+ stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join {"--- \nwhitelist: \nignore_groups: \n- test\n- development\n"}
+ LicenseFinder::Finder.new.whitelist.should =~ []
+ end
+
it "should load a ignore_groups list from license_finder.yml" do
stub(File).exists?('./config/license_finder.yml') {true}
stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join {"--- \nwhitelist: \n- MIT\n- Apache\nignore_groups: \n- test\n- development\n"}
@@ -58,4 +64,10 @@
finder.dependencies_yaml.should == './elsewhere/dependencies.yml'
finder.dependencies_text.should == './elsewhere/dependencies.txt'
end
+
+ it "should load an empty ignore_groups list from license_finder.yml when there are no ignore groups" do
+ stub(File).exists?('./config/license_finder.yml') {true}
+ stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join {"--- \nwhitelist: \n- MIT\n- Apache\nignore_groups:"}
+ LicenseFinder::Finder.new.ignore_groups.should == []
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.