Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nil case should be false

  • Loading branch information...
commit 6a932bd379c814855380db394bb3dd5085b29d23 1 parent 838f51a
@plukevdh plukevdh authored
View
2  lib/arturo.rb
@@ -21,7 +21,7 @@ def feature_enabled_for?(feature_name, recipient)
def feature_enabled?(feature_name)
f = self::Feature.to_feature(feature_name)
- method_missing :feature_enabled?, feature_name unless f.class == Arturo::GlobalFeature
+ method_missing :feature_enabled?, feature_name if f && f.class != Arturo::GlobalFeature
f && f.enabled?
end
View
4 test/dummy_app/test/unit/global_feature_test.rb
@@ -18,6 +18,10 @@ def test_responds_to_feature_enabled_helper
assert ::Arturo.feature_enabled?(feature.symbol)
end
+ def test_feature_enabled_false_for_nil_feature
+ assert !::Arturo.feature_enabled?(:not_found)
+ end
+
def test_to_feature_finds_global_feature
assert_equal feature, ::Arturo::Feature.to_feature(feature)
assert_equal feature, ::Arturo::Feature.to_feature(feature.symbol)
Please sign in to comment.
Something went wrong with that request. Please try again.