Skip to content

Commit

Permalink
Fixed rspec-mocks deprecation warnings
Browse files Browse the repository at this point in the history
Upped rspec dependency to ~> 2.14
  • Loading branch information
rmm5t committed Jul 9, 2013
1 parent dc18c97 commit 31feb15
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion carrierwave-mongoid.gemspec
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions spec/mongoid_spec.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions spec/spec_helper.rb
Expand Up @@ -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
Expand All @@ -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

Expand Down
20 changes: 10 additions & 10 deletions spec/storage/grid_fs_spec.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 31feb15

Please sign in to comment.