Sha256: 628a253eb3ceb52b1a3c3f98c1c432cc847b3f4475f03e0d43339375d1a51f1c

Contents?: true

Size: 1.41 KB

Versions: 14

Compression:

Stored size: 1.41 KB

Contents

ENV["RAILS_ENV"] = "test"

# ---------------------------------------------------------------------

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

require "rails/test_help"
require 'minitest/rails'
require 'minitest/spec'
require 'slim'
require 'database_cleaner'
require 'mongoid'
require 'simple_form_attachments'

# ---------------------------------------------------------------------

if ENV["CI"]
  require "coveralls"
  Coveralls.wear!
end

ENV["MONGOID_TEST_HOST"] ||= "localhost"
ENV["MONGOID_TEST_PORT"] ||= "27017"

HOST = ENV["MONGOID_TEST_HOST"]
PORT = ENV["MONGOID_TEST_PORT"].to_i

def database_id
  "simple_form_attachments_test"
end

CONFIG = {
  sessions: {
    default: {
      database: database_id,
      hosts: [ "#{HOST}:#{PORT}" ]
    }
  }
}

Mongoid.configure do |config|
  config.load_configuration(CONFIG)
end

DatabaseCleaner.orm = :mongoid
DatabaseCleaner.strategy = :truncation

class MiniTest::Spec
  before(:each) { DatabaseCleaner.start }
  after(:each) { DatabaseCleaner.clean }
end

# ---------------------------------------------------------------------

class Attachment
  include SimpleFormAttachments::Attachment
end

class Parent
  include Mongoid::Document
  include SimpleFormAttachments::HasAttachments

  has_one_attachment :attachment, class_name: 'Attachment', dependent: :destroy
  has_many_attachments :attachments, class_name: 'Attachment', dependent: :destroy
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
simple_form_attachments-0.1.5 test/test_helper.rb
simple_form_attachments-0.1.4 test/test_helper.rb
simple_form_attachments-0.1.3 test/test_helper.rb
simple_form_attachments-0.1.2 test/test_helper.rb
simple_form_attachments-0.1.1 test/test_helper.rb
simple_form_attachments-0.1.0 test/test_helper.rb
simple_form_attachments-0.0.9 test/test_helper.rb
simple_form_attachments-0.0.8 test/test_helper.rb
simple_form_attachments-0.0.7 test/test_helper.rb
simple_form_attachments-0.0.6 test/test_helper.rb
simple_form_attachments-0.0.5 test/test_helper.rb
simple_form_attachments-0.0.4 test/test_helper.rb
simple_form_attachments-0.0.3 test/test_helper.rb
simple_form_attachments-0.0.1 test/test_helper.rb