Sha256: 2bb9257e15f9242050464946a85804a48d5f2e415605c7192fd8090b509673a7

Contents?: true

Size: 532 Bytes

Versions: 8

Compression:

Stored size: 532 Bytes

Contents

require "test_helper"

describe "Clear flags at save" do
  let(:order) { Order.create }

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

  it "checks sanity" do
    assert_equal 0x8a, order.flags
    assert order.b
  end

  it "clear flags during save" do
    Order.clear_flags_at_save :b
    order.save
    order.reload
    assert_equal 0x0a, order.flags
  end

  it "does not remove accessor" do
    Order.clear_flags_at_save :b
    Order.respond_to? :b
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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