spec/spec_helper.rb in jnicklas-carrierwave-0.2.2 vs spec/spec_helper.rb in jnicklas-carrierwave-0.2.3
- old
+ new
@@ -12,13 +12,17 @@
end
require 'tempfile'
#require 'ruby-debug'
require 'spec'
+require 'spec/autorun'
require 'carrierwave'
+require 'logger'
+CarrierWave.logger = Logger.new(File.join(File.dirname(__FILE__), 'test.log'))
+
alias :running :lambda
def file_path( *paths )
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', *paths))
end
@@ -30,10 +34,18 @@
CarrierWave.config[:public] = public_path
CarrierWave.config[:root] = File.expand_path(File.dirname(__FILE__))
module CarrierWave
module Test
+ module MockStorage
+ def mock_storage(kind)
+ storage = mock("storage for #{kind} uploader")
+ storage.stub!(:setup!)
+ storage
+ end
+ end
+
module MockFiles
def stub_merb_tempfile(filename)
raise "#{path} file does not exist" unless File.exist?(file_path(filename))
t = Tempfile.new(filename)
@@ -79,6 +91,7 @@
end
Spec::Runner.configure do |config|
config.include CarrierWave::Test::Matchers
config.include CarrierWave::Test::MockFiles
+ config.include CarrierWave::Test::MockStorage
end
\ No newline at end of file