Sha256: bad6ba47d586259f9de234c919af38df990fce7040d86218e0d0726a8180f5ea

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

require "test_helper"

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

  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

5 entries across 5 versions & 1 rubygems

Version Path
act_with_flags-3.1.9 test/any_all_none_test.rb
act_with_flags-3.1.6 test/any_all_none_test.rb
act_with_flags-3.1.5 test/any_all_none_test.rb
act_with_flags-3.1.3 test/any_all_none_test.rb
act_with_flags-3.1.2 test/any_all_none_test.rb