/
spec_helper.rb
64 lines (56 loc) · 1.4 KB
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
ENV["RAILS_ENV"] = "test"
require 'coveralls'
Coveralls.wear!
require 'rubygems'
require 'rspec'
require 'bundler/setup'
require 'paperclip'
require 'paperclip/railtie'
# Prepare activerecord
require "active_record"
require 'paperclip/av/transcoder'
Bundler.require(:default)
# Connect to sqlite
ActiveRecord::Base.establish_connection("adapter" => "sqlite3", "database" => ":memory:")
ActiveRecord::Base.logger = Logger.new(STDOUT)
load(File.join(File.dirname(__FILE__), 'schema.rb'))
Paperclip::Railtie.insert
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.filter_run focus: true
end
class Document < ActiveRecord::Base
has_attached_file :video,
storage: :filesystem,
path: "./spec/tmp/:id.:extension",
url: "/spec/tmp/:id.:extension",
whiny: true,
styles: {
small: {
format: 'ogv',
convert_options: {
output: {
ab: '256k',
ar: 44100,
ac: 2
}
}
},
thumb: {
format: 'jpg',
time: 0
}
},
processors: [:transcoder]
has_attached_file :image,
storage: :filesystem,
path: "./spec/tmp/:id.:extension",
url: "/spec/tmp/:id.:extension",
whiny: true,
styles: {
small: "100x100"
},
processors: [:transcoder, :thumbnail]
do_not_validate_attachment_file_type :video
do_not_validate_attachment_file_type :image
end