Sha256: 80c0b60fecde507e6fc0c5a825b37661f8a9c495c87ea2c5b95e8a003ba7ec00

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

require 'test_helper'

class WherexTest < TEST_CLASS
  def test_user_example
    assert u = User.where( :zipcode => /^9[345][0-9]{3}$/ )
    assert_equal 3, u.count
    [:two, :three, :four ].each do |id|
      assert u.include?( users(id) )
    end
  end

  def test_product_example
    assert p = Product.find_by_code( /^[NRW][^-]+-[456]/ )
    assert_equal products(:one), p

    assert p = Product.where( code: /^[NRW][^-]+-[456]/ )
    assert_equal 1, p.count
    assert_equal products(:one), p.first
  end

  def test_student_example
    assert s = Student.where( :name => /[^a-zA-Z ]/ )
    assert_equal 3, s.count
    [ :two, :three, :four ].each do |id|
      assert s.include?( students(id) )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wherex-1.1.1 test/wherex_test.rb
wherex-1.1.0 test/wherex_test.rb