Sha256: 90cb3f0b15f1bedf6bd0f82742d9b267a2649e1d7a715d6c57f066230921a9bd

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8
require "rubygems"
require "rspec"
require "rspec/autorun"
require "rails"
require "active_record"
require "carrierwave"
require "carrierwave/orm/activerecord"
require 'dotenv'

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),"..","lib"))

require "carrierwave-qiniu"

module Rails
  class <<self
    def root
      [File.expand_path(__FILE__).split('/')[0..-3].join('/'),"spec"].join("/")
    end
  end
end

Dotenv.load

ActiveRecord::Migration.verbose = false

# 测试的时候载入环境变量
# 或者在根目录下新建 `.env` 文件,包含 <key>=<value>
::CarrierWave.configure do |config|
  config.storage             = :qiniu
  config.qiniu_access_key    = ENV['qiniu_access_key']
  config.qiniu_secret_key    = ENV['qiniu_secret_key']

  config.qiniu_bucket        = ENV['qiniu_bucket']
  config.qiniu_bucket_domain = ENV['qiniu_bucket_domain']

  config.qiniu_block_size    = 4*1024*1024
  config.qiniu_protocol      = "http"
end

def load_file(fname)
  File.open([Rails.root,fname].join("/"))
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
carrierwave-qiniu-0.1.8.2 spec/spec_helper.rb
carrierwave-qiniu-0.1.8.1 spec/spec_helper.rb
carrierwave-qiniu-new-0.1.8.2 spec/spec_helper.rb