Sha256: 48e49b4da108c167fccc2fa9d13390968d2fd380e47ecdc3e05b0cfcf5564a1d
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
RSpec.configure do |config| config.before :suite do DatabaseCleaner[:active_record].strategy = :transaction DatabaseCleaner.clean_with(:truncation) end config.around(:each) do |example| DatabaseCleaner.cleaning do example.run end end end RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.before(:suite) do begin DatabaseCleaner.start FactoryGirl.lint ensure DatabaseCleaner.clean end end end class HelperClass include ActiveHashRelation end module Helpers def strip(query) query.gsub("\"","").gsub(/\s+/, ' ') end def select_all(table) ExpectedQuery.new("SELECT #{table}.* FROM users WHERE") end alias_method :select_all_where, :select_all def query(str) ExpectedQuery.new(str, subquery: true) end def q(*args) args.each.with_index.inject(''){|memo, (str, index)| if args[index-1] == '(' "#{memo}#{str}" elsif str == ')' "#{memo}#{str}" else "#{memo} #{str}" end }.strip end end class Array def avg sum / size.to_f end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
active_hash_relation-1.4.1 | spec/support/support.rb |
active_hash_relation-1.4.0 | spec/support/support.rb |
active_hash_relation-1.2.0 | spec/support/support.rb |