Sha256: 1a74f6433438c6a8fc43ed8e3f9b1fb1b65657b63912b721f15315bd5c330c4a

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'
Dir[File.dirname(__FILE__) + '/../shared/*.rb'].each {|file| require file }

describe ActiveRecord do
  before(:all) do
    ActiveRecord::Base.default_timezone = :utc
    # ActiveRecord::Base.logger = Logger.new(STDOUT)
    database_file = File.dirname(__FILE__) + '/../../database.yml'
    parsed_config = ERB.new(File.read(database_file)).result
    db_config = YAML.safe_load(parsed_config)
    if db_config.has_key?('sqlite') && db_config['sqlite'].has_key?('database')
      db_config['sqlite']['database'] = File.dirname(__FILE__) + '/../../tmp/' + db_config['sqlite']['database']
    end

    ActiveRecord::Base.configurations = db_config
    ActiveRecord::Base.establish_connection(ENV['DB'].try(:to_sym) || :sqlite)
    load File.dirname(__FILE__) + '/../../fixtures/active_record/schema.rb'
    load File.dirname(__FILE__) + '/../../fixtures/active_record/models.rb'
    load File.dirname(__FILE__) + '/../../fixtures/shared/seeds.rb'

    ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/../../tmp/activerecord.log')
  end

  it_behaves_like 'between_times'
  it_behaves_like 'between_dates'
  it_behaves_like 'at_time'
  it_behaves_like 'offset parameter'
  it_behaves_like 'order parameter'
  it_behaves_like 'index_scope parameter'
  it_behaves_like 'by day'
  it_behaves_like 'by direction'
  it_behaves_like 'by fortnight'
  it_behaves_like 'by month'
  it_behaves_like 'by calendar month'
  it_behaves_like 'by quarter'
  it_behaves_like 'by week'
  it_behaves_like 'by cweek'
  it_behaves_like 'by weekend'
  it_behaves_like 'by year'
  it_behaves_like 'relative'
end if testing_active_record?

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ta_by_star-4.1.0 spec/integration/active_record/active_record_spec.rb
ta_by_star-4.0.0 spec/integration/active_record/active_record_spec.rb
by_star-4.0.0 spec/integration/active_record/active_record_spec.rb