Permalink
Browse files

symbolize Configuration ignore groups on read

  • Loading branch information...
1 parent e39cb2d commit e71f2975936e74f40a72108a389d79c4777fe5a8 Matthew Kane Parker and Rob Gallagher committed Sep 27, 2012
@@ -1,5 +1,9 @@
module LicenseFinder
class Configuration < LicenseFinder::Persistence::Configuration
+ def ignore_groups
+ super.map &:to_sym
+ end
+
def whitelisted?(license_name)
license = License.find_by_name(license_name) || license_name
whitelisted_licenses.include? license
@@ -3,9 +3,9 @@
describe LicenseFinder::Configuration do
it_behaves_like "a persistable configuration"
- describe "whitelisted?" do
- let(:config) { LicenseFinder::Configuration.new }
+ let(:config) { LicenseFinder::Configuration.new }
+ describe "whitelisted?" do
context "canonical name whitelisted" do
before { config.whitelist = [LicenseFinder::License::Apache2.names[rand(0...LicenseFinder::License::Apache2.names.count)]]}
@@ -24,4 +24,15 @@
end
end
end
+
+ describe "#ignore_groups" do
+ it "should default to an empty array" do
+ config.ignore_groups.should == []
+ end
+
+ it "should always return symbolized versions of the ignore groups" do
+ config.ignore_groups = %w[test development]
+ config.ignore_groups.should == [:test, :development]
+ end
+ end
end
@@ -25,10 +25,4 @@
klass.new.whitelist.should == []
end
end
-
- describe "#ignore_groups" do
- it "should default to an empty array" do
- klass.new.ignore_groups.should == []
- end
- end
end

0 comments on commit e71f297

Please sign in to comment.