Sha256: 398437e20627148d1d7758fba1da65f159c35e68ca8589a6dd9adab2008ac3a7
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require 'minitest/autorun' require 'flippeur' require 'flippeur/rails_helpers' class View include Flippeur::ViewHelpers def initialize @controller = OpenStruct.new(current_person: Object.new) end end class ViewHelpersTest < MiniTest::Unit::TestCase def setup @view = View.new end def test_unknown_feature_raises_exception Flippeur.setup { } assert_raises Flippeur::UnknownFeature do @view.feature? :foo end end def test_available_feature_as_boolean Flippeur.setup do feature(:foo) { |user| true } end assert @view.feature?(:foo) end def test_available_feature_with_block Flippeur.setup do feature(:foo) { |user| true } end block_called = false @view.feature?(:foo) do block_called = true end assert block_called end def test_unavailable_feature_as_boolean Flippeur.setup do feature(:foo) { |user| false } end refute @view.feature?(:foo) end def test_unavailable_feature_with_block Flippeur.setup do feature(:foo) { |user| false } end block_called = false @view.feature?(:foo) do block_called = true end refute block_called end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flippeur-1.0.0 | test/view_helpers_test.rb |