Sha256: 6aa1b1b3b16ec0a623a11b4fee44fd81ac83af779605278370970d67d0583053

Contents?: true

Size: 1.59 KB

Versions: 14

Compression:

Stored size: 1.59 KB

Contents

# encoding: utf-8
require 'rubygems'

ENV["RAILS_ENV"] ||= 'test'

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

require 'rails/all'
require 'active_metadata'
require 'rack/test/uploaded_file'
require 'support/migrations'

ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
require 'rspec/rails'


RSpec.configure do |config|
  # == Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr
  config.mock_with :rspec

  config.before(:suite) do
    TestDb.up
    Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
  end

  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  # config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  # config.use_transactional_fixtures = true


  config.before(:each) do
    [Document, Section, Chapter, User, ActiveMetadata::Note,
     ActiveMetadata::Watcher, ActiveMetadata::Attachment, ActiveMetadata::History].each do |i|
      i.delete_all
    end
    FileUtils.remove_dir File.expand_path('public/system/') if Dir.exist?(File.expand_path('public/system/'))
    Rails.cache.clear
  end

  config.after(:suite) do
    #TestDb.down
  end

end

def test_pdf name='pdf_test'
  doc = File.expand_path("../support/#{name}.pdf", __FILE__)
  Rack::Test::UploadedFile.new(doc, "application/pdf")
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active_metadata-0.8.9 spec/spec_helper.rb
active_metadata-0.8.8 spec/spec_helper.rb
active_metadata-0.8.7.1 spec/spec_helper.rb
active_metadata-0.8.7 spec/spec_helper.rb
active_metadata-0.8.6 spec/spec_helper.rb
active_metadata-0.8.5.2 spec/spec_helper.rb
active_metadata-0.8.5.1 spec/spec_helper.rb
active_metadata-0.8.5 spec/spec_helper.rb
active_metadata-0.8.4 spec/spec_helper.rb
active_metadata-0.8.3.1 spec/spec_helper.rb
active_metadata-0.8.3 spec/spec_helper.rb
active_metadata-0.8.2 spec/spec_helper.rb
active_metadata-0.8.1 spec/spec_helper.rb
active_metadata-0.8.0 spec/spec_helper.rb