Sha256: 2d603fbf68f946910916eca9bbe89e5197ccb33aac4032fd413719d5c39a2a3b

Contents?: true

Size: 813 Bytes

Versions: 3

Compression:

Stored size: 813 Bytes

Contents

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-3.1.1 test/any_all_none_test.rb
act_with_flags-3.1.0 test/any_all_none_test.rb
act_with_flags-3.0.1 test/any_all_none_test.rb