Sha256: ec451bcfffcbf87f6e311f20ab8ea886b0b49c5fa43464f3a301a301a4b005fd

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

# rubocop: disable all

require 'test_helper'

describe 'any? all? and none?' do
  let(:order) { Order.create }

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

  it 'checks any?' do
    order.a = true
    assert order.flags_any?(:a, :b)
    order.a = false
    refute order.flags_any?(:a, :b)
  end

  it 'checks any? #2' do
    order.b = true
    assert order.flags_any?(:a, :b)
    order.b = false
    refute order.flags_any?(:a, :b)
  end

  it 'checks all?' do
    order.a = order.b = true
    assert order.flags_all?(:a, :b)
    order.a = false
    refute order.flags_all?(:a, :b)
  end

  it 'checks none? #2' do
    order.a = order.b = true
    refute order.flags_none?(:a, :b)
    order.a = false
    refute order.flags_none?(:a, :b)
    order.b = false
    assert order.flags_none?(:a, :b)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
act_with_flags-0.2.4 test/any_all_none_test.rb
act_with_flags-0.2.3 test/any_all_none_test.rb
act_with_flags-0.2.0 test/any_all_none_test.rb