Sha256: 857eaaff98f81a208eb51b9085058af92c2f7649b62d24fc9a327a007a7a805b

Contents?: true

Size: 709 Bytes

Versions: 14

Compression:

Stored size: 709 Bytes

Contents

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

module ConditionsTests
  class ProtectionTest < ActiveSupport::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
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
schof-searchlogic-0.0.2 test/conditions_tests/protection_test.rb
searchlogic-1.6.1 test/conditions_tests/protection_test.rb
searchlogic-1.5.4 test/conditions_tests/protection_test.rb
searchlogic-1.5.9 test/conditions_tests/protection_test.rb
searchlogic-1.5.6 test/conditions_tests/protection_test.rb
searchlogic-1.6.0 test/conditions_tests/protection_test.rb
searchlogic-1.5.8 test/conditions_tests/protection_test.rb
searchlogic-1.5.10 test/conditions_tests/protection_test.rb
searchlogic-1.5.7 test/conditions_tests/protection_test.rb
searchlogic-1.6.5 test/conditions_tests/protection_test.rb
searchlogic-1.6.4 test/conditions_tests/protection_test.rb
searchlogic-1.6.2 test/conditions_tests/protection_test.rb
searchlogic-1.6.6 test/conditions_tests/protection_test.rb
searchlogic-1.6.3 test/conditions_tests/protection_test.rb