Sha256: 39b34ee8bd1461be105fd20b7ae79702824341f879b77bcf0c8327e8e8a2703d

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

ENV["RAILS_ENV"] = "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require 'reservation'

Rails.backtrace_cleaner.remove_silencers!

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  config.order = 'random'

  config.before(:each) {
    models = [Thing, Place, Reservation::Event, Reservation::Reservation]
    models.each do |model|
      ActiveRecord::Base.connection.execute "DELETE FROM #{model.table_name}"
    end
  }
end


module Helper
  def date d
    Date.parse d
  end

  def time t
    Time.parse t
  end

  def make_interval start, finish
    Reservation::Schedule::Interval.from start, finish
  end
end

RSpec::Core::ExampleGroup.send :include, Helper

File.delete File.dirname(__FILE__) + '/dummy/db/test.sqlite3'
ActiveRecord::Base.establish_connection
ActiveRecord::Base.connection
ActiveRecord::Migration.verbose = false
load(File.dirname(__FILE__) + '/dummy/db/schema.rb')

class Time
  def pretty
    self.strftime("%Y%m%dT%H%M")
  end

  def prettyd
    self.strftime("%a,%Y%m%dT%H%M")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reservation-0.1.0 spec/spec_helper.rb