Sha256: 316e67ab39b38b7f27166ab2e4665cfb91c67b85aa2243659c0b270d2aeb1df8

Contents?: true

Size: 498 Bytes

Versions: 8

Compression:

Stored size: 498 Bytes

Contents

require "test_helper"

describe "mask" do
  let(:admin) { Order.act_with_flags }

  def setup
    reset_order
    Order.add_to_flags a: 1, b: 7, c: 3
  end

  it "mask empty" do
    assert_equal 0x00, admin.mask
  end

  it "mask of one flag" do
    assert_equal 0x80, admin.mask(:b)
  end

  it "mask of several flags" do
    assert_equal 0x8a, admin.mask(:a, :b, :c)
  end

  it "order is not relevant" do
    mask = admin.mask(:a, :b, :c)
    assert_equal mask, admin.mask(:c, :b, :a)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
act_with_flags-3.1.9 test/mask_test.rb
act_with_flags-3.1.6 test/mask_test.rb
act_with_flags-3.1.5 test/mask_test.rb
act_with_flags-3.1.3 test/mask_test.rb
act_with_flags-3.1.2 test/mask_test.rb
act_with_flags-3.1.1 test/mask_test.rb
act_with_flags-3.1.0 test/mask_test.rb
act_with_flags-3.0.1 test/mask_test.rb