Sha256: 0f82b10a2f291504f46bdb97c41b8924805ad4945c3f1103b303dcd20172a66c

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

require_relative "./spec_helper"

prepare do
  Flag.flush
end

scope "groups" do
  setup do
    Flag.group[:staff] = lambda { |id| id > 1 }
  end

  test "adding groups" do
    assert_equal [:staff], Flag.groups
  end

  test "testing if feature is activated for a group" do
    Flag(:test).on!(:staff)

    assert Flag(:test).on?(:staff)
  end

  test "trying to check for an empty group" do
    Flag(:test).on!(:bogus)

    assert_equal false, Flag(:test).on?(1)
  end

  test "testing if a user beloging to a group get stuff activated" do
    Flag(:test).on!(:staff)

    assert Flag(:test).on?(1) == false
    assert Flag(:test).on?(2) == true
    assert Flag(:test).on?(3) == true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flag-1.0.0 test/groups_test.rb