Sha256: 1db5b945008019c9b37c0bc00a417bfd3438efed0e2ad44f9477c42c40668b5e

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 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::Base.silence do
  ActiveRecord::Migration.verbose = false
  load(File.dirname(__FILE__) + '/dummy/db/schema.rb')
end

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

5 entries across 5 versions & 1 rubygems

Version Path
reservation-0.0.6 spec/spec_helper.rb
reservation-0.0.5 spec/spec_helper.rb
reservation-0.0.4 spec/spec_helper.rb
reservation-0.0.3 spec/spec_helper.rb
reservation-0.0.2 spec/spec_helper.rb