Sha256: fc8b35dd4e395904878923a8b8b17eed4d8e5f2c7dff58307ecf083f3b97f5bb

Contents?: true

Size: 570 Bytes

Versions: 3

Compression:

Stored size: 570 Bytes

Contents

require "test_helper"

describe "Internal check add flag" do
  let(:order) { Order.create }

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

  it "skip reserved position" do
    Order.add_to_flags :xx
    order.xx = true
    assert_equal 0x100, order.flags

    Order.add_to_flags :yy
    order.yy = true
    assert_equal 0x300, order.flags
  end

  it "rejects redefinition" do
    Order.add_to_flags :z
    assert_raises { Order.add_to_flags :z }
  end

  it "rejects reuse of position" do
    assert_raises { Order.add_to_flags qq: 1 }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
act_with_flags-3.1.1 test/coding_check_add_test.rb
act_with_flags-3.1.0 test/coding_check_add_test.rb
act_with_flags-3.0.1 test/coding_check_add_test.rb