Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 34 lines (29 sloc) 0.655 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
require 'rubygems'
require 'spec'
require 'active_support'
require 'active_record'
require 'action_controller'
require 'action_view'
require 'cancan'
require 'cancan/matchers'

Spec::Runner.configure do |config|
  config.mock_with :rr
end

class Ability
  include CanCan::Ability

  def initialize(user)
  end
end

# this class helps out in testing nesting
class Person
end

class SqlSanitizer
  def self.sanitize_sql(hash_cond)
    case hash_cond
    when Hash then hash_cond.map{|name, value| "#{name}=#{value}"}.join(' AND ')
    when Array
      hash_cond.shift.gsub('?'){"#{hash_cond.shift.inspect}"}
    when String then hash_cond
    end
  end
end
Something went wrong with that request. Please try again.