Sha256: 63bee0707f97b0c3c6e1f417318a85d49de3ad50309627a03e1f0b224118c161

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

require 'lib/fossil'
require 'spec'
require 'rr'
require 'pp'

unless defined?(DB_DEMO)
  DB_DEMO = Sequel.odbc('demodata')#, :loggers=>[Logger.new($stdout)])
  DB_DEMO.extend(Sequel::Pervasive::DatabaseMethods)
                                                  
  DB_FOS = Sequel.odbc('fos', :loggers=>[Logger.new($stdout)])
  DB_FOS.extend(Sequel::Pervasive::DatabaseMethods)
end

require File.dirname(__FILE__) + "/helper_methods"
require File.dirname(__FILE__) + "/helper_classes"
##### custom matchers #####
require File.dirname(__FILE__) + "/be_model_with_values_matcher"

Spec::Runner.configure do |config|
  config.include(HelperMethods)
  config.mock_with :rr
  config.include(BeModelWithValuesMatcher)
end

# These are special modifictations for testing with mysql db instead of pervasive
# if its not windows or linux where pervasive db is running ) .. modify the
# pervasive adapter to act more like mysql, so that the tests can still run.
# This is not ideal, but it works
unless RUBY_PLATFORM =~ /mswin32|linux/

  module Sequel::Pervasive::DatabaseMethods
    def auto_increment_sql; "AUTO_INCREMENT" end
    def begin_transaction_sql; "BEGIN" end
    def commit_transaction_sql; "COMMIT" end
    def rollback_transaction_sql; "ROLLBACK" end
  end

  module Sequel::Pervasive::DatasetMethods
    def quoted_identifier(name, convert=true)
      convert ? "`#{convert_aliased_col_to_real_col(name)}`" : "`#{name}`"
    end

    def select_clause_methods
      super
    end

    def select_limit_sql(sql)
      super(sql)
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fossil-0.3.49 spec/spec_helper.rb
fossil-0.3.48 spec/spec_helper.rb
fossil-0.3.47 spec/spec_helper.rb
fossil-0.3.46 spec/spec_helper.rb
fossil-0.3.45 spec/spec_helper.rb