Sha256: 39609ad782d1536479b22ed5468838edc11557eb67c0c4ffb6900767feae13a2

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

require 'helper'

class Features < FeatureDefinitions
  define_feature :AWESOME, using: [:is_awesome?] do |awesome|
    awesome
  end
end

class TestFeatureDefinitions < MiniTest::Unit::TestCase
  def test_feature_enabled
    Features.context = OpenStruct.new(is_awesome?: true)
    assert Features.AWESOME.enabled?
  end
  def test_feature_disabled
    Features.context = OpenStruct.new(is_awesome?: false)
    refute Features.AWESOME.enabled?
  end
  def test_feature_toggle
    Features.context = OpenStruct.new(is_awesome?: true)
    assert Features.AWESOME.enabled?
    Features.context = OpenStruct.new(is_awesome?: false)
    refute Features.AWESOME.enabled?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feature_definitions-0.1.1 test/test_feature_definitions.rb