Sha256: 21f703e8fb71a2c3235522b26f590ed3d85b1735dabc8a0c62037f8293eeef55

Contents?: true

Size: 569 Bytes

Versions: 3

Compression:

Stored size: 569 Bytes

Contents

require 'test_helper'

describe 'Clear Flags at Save' do
  let(:admin) { Order.act_with_flags }
  let(:order) { Order.new }

  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

3 entries across 3 versions & 1 rubygems

Version Path
act_with_flags-0.0.7 test/clear_test.rb
act_with_flags-0.0.6 test/clear_test.rb
act_with_flags-0.0.4 test/clear_test.rb