Sha256: 0f5d6514153158e153fd8166d7a85d4086d8be943e1c1afc56db97f53798deea

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

require 'test/unit'
require_relative '../../lib/array_logic'

module ArrayLogic
  class TestCase < Test::Unit::TestCase
    
    def self.things
      @things ||= Thing.make(10)
    end
    
    def get_things(thing_ids)
      @things = thing_ids.collect{|id| self.class.things[id]}
    end
    
    def assert_thing_match(thing_ids, rule)
      get_things(thing_ids)
      assert(rule.match(@things), "#{thing_ids.inspect} should match '#{rule.rule}'")
      assert(!rule.block(@things), "#{thing_ids.inspect} should not block '#{rule.rule}'")
    end
    
    def assert_no_thing_match(thing_ids, rule)
      get_things(thing_ids)
      assert(!rule.match(@things), "#{thing_ids.inspect} should not match '#{rule.rule}'")
      assert(rule.block(@things), "#{thing_ids.inspect} should block '#{rule.rule}'")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
array_logic-0.1.2 test/array_logic/test_case.rb
array_logic-0.1.1 test/array_logic/test_case.rb