Sha256: de48edc795ab20d0cc28844908de30d94a34e11e214fda1f39ba5e7345f85220

Contents?: true

Size: 665 Bytes

Versions: 16

Compression:

Stored size: 665 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class TestConditionsProtection < Test::Unit::TestCase
  def test_protection
    assert_raise(ArgumentError) { Account.new_search(:conditions => "(DELETE FROM users)") }
    assert_nothing_raised { Account.new_search!(:conditions => "(DELETE FROM users)") }
    
    account = Account.first
    
    assert_raise(ArgumentError) { account.users.new_search(:conditions => "(DELETE FROM users)") }
    assert_nothing_raised { account.users.new_search!(:conditions => "(DELETE FROM users)") }
    
    search = Account.new_search
    assert_raise(ArgumentError) { search.conditions = "(DELETE FROM users)" }
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
searchgasm-1.2.2 test/test_conditions_protection.rb
searchgasm-1.3.2 test/test_conditions_protection.rb
searchgasm-1.3.0 test/test_conditions_protection.rb
searchgasm-1.3.1 test/test_conditions_protection.rb
searchgasm-1.3.4 test/test_conditions_protection.rb
searchgasm-1.2.0 test/test_conditions_protection.rb
searchgasm-1.2.1 test/test_conditions_protection.rb
searchgasm-1.3.3 test/test_conditions_protection.rb
searchgasm-1.5.0 test/test_conditions_protection.rb
searchgasm-1.3.5 test/test_conditions_protection.rb
searchgasm-1.4.1 test/test_conditions_protection.rb
searchgasm-1.5.3 test/test_conditions_protection.rb
searchgasm-1.5.2 test/test_conditions_protection.rb
searchgasm-1.4.0 test/test_conditions_protection.rb
searchgasm-1.5.1 test/test_conditions_protection.rb
searchlogic-1.5.3 test/test_conditions_protection.rb