Sha256: 8f30649cc5552b284e6a5eae6b09efbc81be774fbd44ec5974fe55eecfa1f6ae

Contents?: true

Size: 750 Bytes

Versions: 5

Compression:

Stored size: 750 Bytes

Contents

require 'helper'

class TestWherex < Test::Unit::TestCase
  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.find_all_by_code( /^[NRW][^-]+-[456]/ )
    assert_equal 1, p.count
    assert_equal products(:one), p.first
  end

  def test_student_example
    assert s = Student.all( :conditions => { :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

5 entries across 5 versions & 1 rubygems

Version Path
wherex-1.0.6 test/test_wherex.rb
wherex-1.0.3 test/test_wherex.rb
wherex-1.0.2 test/test_wherex.rb
wherex-1.0.1 test/test_wherex.rb
wherex-1.0.0 test/test_wherex.rb