test/helper.rb in paperclip-3.5.4 vs test/helper.rb in paperclip-4.0.0
- old
+ new
@@ -38,10 +38,11 @@
silence_warnings do
Object.const_set(:Rails, stub('Rails'))
Rails.stubs(:root).returns(Pathname.new(ROOT).join('tmp'))
Rails.stubs(:env).returns('test')
Rails.stubs(:const_defined?).with(:Railtie).returns(false)
+ ActiveSupport::Deprecation.silenced = true
end
end
def teardown
end
@@ -123,17 +124,19 @@
end
def rebuild_class options = {}
reset_class("Dummy").tap do |klass|
klass.has_attached_file :avatar, options
+ klass.do_not_validate_attachment_file_type :avatar
Paperclip.reset_duplicate_clash_check!
end
end
def rebuild_meta_class_of obj, options = {}
(class << obj; self; end).tap do |metaklass|
metaklass.has_attached_file :avatar, options
+ metaklass.do_not_validate_attachment_file_type :avatar
Paperclip.reset_duplicate_clash_check!
end
end
class FakeModel
@@ -167,25 +170,25 @@
$VERBOSE = old_verbose
end
def should_accept_dummy_class
should "accept the class" do
- assert_accepts @matcher, @dummy_class
+ assert_accepts @matcher, Dummy
end
should "accept an instance of that class" do
- assert_accepts @matcher, @dummy_class.new
+ assert_accepts @matcher, Dummy.new
end
end
def should_reject_dummy_class
should "reject the class" do
- assert_rejects @matcher, @dummy_class
+ assert_rejects @matcher, Dummy
end
should "reject an instance of that class" do
- assert_rejects @matcher, @dummy_class.new
+ assert_rejects @matcher, Dummy.new
end
end
def with_exitstatus_returning(code)
saved_exitstatus = $?.nil? ? 0 : $?.exitstatus
@@ -193,9 +196,13 @@
`ruby -e 'exit #{code.to_i}'`
yield
ensure
`ruby -e 'exit #{saved_exitstatus.to_i}'`
end
+end
+
+def stringy_file
+ StringIO.new('.\n')
end
def fixture_file(filename)
File.join(File.dirname(__FILE__), 'fixtures', filename)
end