Permalink
Browse files

Fixed rspec-mocks deprecation warnings

Upped rspec dependency to ~> 2.14
  • Loading branch information...
1 parent dc18c97 commit 31feb15772a4d6d44839e4a8afab4f595245ca25 @rmm5t rmm5t committed Jul 9, 2013
Showing with 23 additions and 23 deletions.
  1. +1 −1 carrierwave-mongoid.gemspec
  2. +3 −3 spec/mongoid_spec.rb
  3. +9 −9 spec/spec_helper.rb
  4. +10 −10 spec/storage/grid_fs_spec.rb
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency "carrierwave", [">= 0.8.0", "< 0.10.0"]
s.add_dependency "mongoid", [">= 3.0", "< 5.0"]
s.add_dependency "mongoid-grid_fs", ["~> 1.3"]
- s.add_development_dependency "rspec", ["~> 2.6"]
+ s.add_development_dependency "rspec", ["~> 2.14"]
s.add_development_dependency "rake", ["~> 10.0"]
s.add_development_dependency "mini_magick"
s.add_development_dependency "pry"
View
@@ -396,7 +396,7 @@ def extension_white_list
end
it "should not remove old file if old file had a different path but config is false" do
- @uploader.stub!(:remove_previously_stored_files_after_update).and_return(false)
+ @uploader.stub(:remove_previously_stored_files_after_update).and_return(false)
@doc.image = stub_file('new.jpeg')
@doc.save.should be_true
File.exists?(public_path('uploads/new.jpeg')).should be_true
@@ -456,7 +456,7 @@ def filename
end
it "should not remove old file if old file had a different path but config is false" do
- @embedded_doc.image.stub!(:remove_previously_stored_files_after_update).and_return(false)
+ @embedded_doc.image.stub(:remove_previously_stored_files_after_update).and_return(false)
@embedded_doc.image = stub_file('new.jpeg')
@embedded_doc.save.should be_true
File.exists?(public_path('uploads/new.jpeg')).should be_true
@@ -494,7 +494,7 @@ def filename
end
it "should not remove old file if old file had a different path but config is false" do
- @double_embedded_doc.image.stub!(:remove_previously_stored_files_after_update).and_return(false)
+ @double_embedded_doc.image.stub(:remove_previously_stored_files_after_update).and_return(false)
@double_embedded_doc.image = stub_file('new.jpeg')
@double_embedded_doc.save.should be_true
File.exists?(public_path('uploads/new.jpeg')).should be_true
View
@@ -35,9 +35,9 @@ def stub_tempfile(filename, mime_type=nil, fake_name=nil)
t = Tempfile.new(filename)
FileUtils.copy_file(file_path(filename), t.path)
- t.stub!(:local_path => "",
- :original_filename => filename || fake_name,
- :content_type => mime_type)
+ t.stub(:local_path => "",
+ :original_filename => filename || fake_name,
+ :content_type => mime_type)
return t
end
@@ -59,12 +59,12 @@ def change_locale_and_store_translations(locale, translations, &block)
end
end
-class SIO < StringIO
- attr_accessor :filename
-
- def initialize(filename, *args, &block)
- @filename = filename
- super(*args, &block)
+class SIO < StringIO
+ attr_accessor :filename
+
+ def initialize(filename, *args, &block)
+ @filename = filename
+ super(*args, &block)
end
end
@@ -7,7 +7,7 @@
shared_examples_for "a GridFS connection" do
describe '#store!' do
before do
- @uploader.stub!(:store_path).and_return('uploads/bar.txt')
+ @uploader.stub(:store_path).and_return('uploads/bar.txt')
@grid_fs_file = @storage.store!(@file)
end
@@ -49,7 +49,7 @@
before do
@grid.clear
@grid['uploads/bar.txt'] = StringIO.new('A test, 1234')
- @uploader.stub!(:store_path).with('bar.txt').and_return('uploads/bar.txt')
+ @uploader.stub(:store_path).with('bar.txt').and_return('uploads/bar.txt')
@grid_fs_file = @storage.retrieve!('bar.txt')
end
@@ -66,17 +66,17 @@
end
it "should return a relative URL path if access_url is set to the root path" do
- @uploader.stub!(:grid_fs_access_url).and_return("/")
+ @uploader.stub(:grid_fs_access_url).and_return("/")
@grid_fs_file.url.should == "/uploads/bar.txt"
end
it "should return a URL path if access_url is set to a file path" do
- @uploader.stub!(:grid_fs_access_url).and_return("/image/show")
+ @uploader.stub(:grid_fs_access_url).and_return("/image/show")
@grid_fs_file.url.should == "/image/show/uploads/bar.txt"
end
it "should return an absolute URL if access_url is set to an absolute URL" do
- @uploader.stub!(:grid_fs_access_url).and_return("http://example.com/images/")
+ @uploader.stub(:grid_fs_access_url).and_return("http://example.com/images/")
@grid_fs_file.url.should == "http://example.com/images/uploads/bar.txt"
end
@@ -88,12 +88,12 @@
describe '#retrieve! on a store_dir with leading slash' do
before do
- @uploader.stub!(:store_path).with('bar.txt').and_return('/uploads/bar.txt')
+ @uploader.stub(:store_path).with('bar.txt').and_return('/uploads/bar.txt')
@grid_fs_file = @storage.retrieve!('bar.txt')
end
it "should return a relative URL path if access_url is set to the root path" do
- @uploader.stub!(:grid_fs_access_url).and_return("/")
+ @uploader.stub(:grid_fs_access_url).and_return("/")
@grid_fs_file.url.should == "/uploads/bar.txt"
end
end
@@ -103,13 +103,13 @@
describe CarrierWave::Storage::GridFS do
before do
- @uploader = mock('an uploader')
- @uploader.stub!(:grid_fs_access_url).and_return(nil)
+ @uploader = double('an uploader')
+ @uploader.stub(:grid_fs_access_url).and_return(nil)
end
context "when reusing an existing connection manually" do
before do
- @uploader.stub!(:grid_fs_connection).and_return(@database)
+ @uploader.stub(:grid_fs_connection).and_return(@database)
@grid = ::Mongoid::GridFs

0 comments on commit 31feb15

Please sign in to comment.