Skip to content

Commit 5b1d25f

Browse files
committed
Replace stub! with stub
1 parent 17bb8e6 commit 5b1d25f

File tree

10 files changed

+27
-27
lines changed

10 files changed

+27
-27
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ group :test do
1212
gem 'childlabor'
1313
gem 'coveralls', '>=0.5.7', :require => false
1414
gem 'fakeweb', '>= 1.3'
15-
gem 'rspec', '>= 2.11'
15+
gem 'rspec', '>= 2.14'
1616
gem 'rspec-mocks', '>= 2.12.2'
1717
gem 'simplecov', :require => false
1818
end

spec/actions/create_file_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
def create_file(destination=nil, config={}, options={})
1010
@base = MyCounter.new([1, 2], options, { :destination_root => destination_root })
11-
@base.stub!(:file_name).and_return('rdoc')
11+
@base.stub(:file_name).and_return('rdoc')
1212

1313
@action = Thor::Actions::CreateFile.new(@base, destination, "CONFIGURATION",
1414
{ :verbose => !@silence }.merge(config))

spec/actions/create_link_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
def create_link(destination=nil, config={}, options={})
1313
@base = MyCounter.new([1,2], options, { :destination_root => destination_root })
14-
@base.stub!(:file_name).and_return('rdoc')
14+
@base.stub(:file_name).and_return('rdoc')
1515

1616
@tempfile = Tempfile.new("config.rb")
1717

spec/actions/directory_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
describe Thor::Actions::Directory do
55
before do
66
::FileUtils.rm_rf(destination_root)
7-
invoker.stub!(:file_name).and_return("rdoc")
7+
invoker.stub(:file_name).and_return("rdoc")
88
end
99

1010
def invoker

spec/actions/empty_directory_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def base
100100
describe "#convert_encoded_instructions" do
101101
before do
102102
empty_directory("test_dir")
103-
@action.base.stub!(:file_name).and_return("expected")
103+
@action.base.stub(:file_name).and_return("expected")
104104
end
105105

106106
it "accepts and executes a 'legal' %\w+% encoded instruction" do

spec/actions_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def file
277277

278278
describe "#run_ruby_script" do
279279
before do
280-
Thor::Util.stub!(:ruby_command).and_return("/opt/jruby")
280+
Thor::Util.stub(:ruby_command).and_return("/opt/jruby")
281281
runner.should_receive(:system).with("/opt/jruby script.rb")
282282
end
283283

spec/runner_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ def when_no_thorfiles_exist
130130
root_file = File.join(Thor::Util.thor_root, "thor.yml")
131131

132132
# Stub load and save to avoid thor.yaml from being overwritten
133-
YAML.stub!(:load_file).and_return(@original_yaml)
134-
File.stub!(:exists?).with(root_file).and_return(true)
135-
File.stub!(:open).with(root_file, "w")
133+
YAML.stub(:load_file).and_return(@original_yaml)
134+
File.stub(:exists?).with(root_file).and_return(true)
135+
File.stub(:open).with(root_file, "w")
136136
end
137137

138138
describe "list" do
@@ -214,9 +214,9 @@ def when_no_thorfiles_exist
214214

215215
describe "install/update" do
216216
before do
217-
FileUtils.stub!(:mkdir_p)
218-
FileUtils.stub!(:touch)
219-
$stdin.stub!(:gets).and_return("Y")
217+
FileUtils.stub(:mkdir_p)
218+
FileUtils.stub(:touch)
219+
$stdin.stub(:gets).and_return("Y")
220220

221221
path = File.join(Thor::Util.thor_root, Digest::MD5.hexdigest(@location + "random"))
222222
File.should_receive(:open).with(path, "w")

spec/shell/basic_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,33 +260,33 @@ def #456 Lanç...
260260
end
261261

262262
it "returns true if the user chooses default option" do
263-
$stdout.stub!(:print)
263+
$stdout.stub(:print)
264264
$stdin.should_receive(:gets).and_return('')
265265
expect(shell.file_collision('foo')).to be_true
266266
end
267267

268268
it "returns false if the user chooses no" do
269-
$stdout.stub!(:print)
269+
$stdout.stub(:print)
270270
$stdin.should_receive(:gets).and_return('n')
271271
expect(shell.file_collision('foo')).to be_false
272272
end
273273

274274
it "returns true if the user chooses yes" do
275-
$stdout.stub!(:print)
275+
$stdout.stub(:print)
276276
$stdin.should_receive(:gets).and_return('y')
277277
expect(shell.file_collision('foo')).to be_true
278278
end
279279

280280
it "shows help usage if the user chooses help" do
281-
$stdout.stub!(:print)
281+
$stdout.stub(:print)
282282
$stdin.should_receive(:gets).and_return('h')
283283
$stdin.should_receive(:gets).and_return('n')
284284
help = capture(:stdout) { shell.file_collision('foo') }
285285
expect(help).to match(/h \- help, show this help/)
286286
end
287287

288288
it "quits if the user chooses quit" do
289-
$stdout.stub!(:print)
289+
$stdout.stub(:print)
290290
$stdout.should_receive(:puts).with('Aborting...')
291291
$stdin.should_receive(:gets).and_return('q')
292292

@@ -313,7 +313,7 @@ def #456 Lanç...
313313
end
314314

315315
it "invokes the diff command" do
316-
$stdout.stub!(:print)
316+
$stdout.stub(:print)
317317
$stdin.should_receive(:gets).and_return('d')
318318
$stdin.should_receive(:gets).and_return('n')
319319
shell.should_receive(:system).with(/diff -u/)

spec/shell/color_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def shell
8080
describe "#file_collision" do
8181
describe "when a block is given" do
8282
it "invokes the diff command" do
83-
$stdout.stub!(:print)
84-
$stdout.stub!(:tty?).and_return(true)
83+
$stdout.stub(:print)
84+
$stdout.stub(:tty?).and_return(true)
8585
$stdin.should_receive(:gets).and_return('d')
8686
$stdin.should_receive(:gets).and_return('n')
8787

spec/util_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def self.clear_user_home!
120120

121121
describe "#user_home" do
122122
before do
123-
ENV.stub!(:[])
123+
ENV.stub(:[])
124124
Thor::Util.clear_user_home!
125125
end
126126

@@ -145,30 +145,30 @@ def self.clear_user_home!
145145
end
146146

147147
it "returns HOME/.thor if set" do
148-
ENV.stub!(:[]).with("HOME").and_return("/home/user/")
148+
ENV.stub(:[]).with("HOME").and_return("/home/user/")
149149
expect(Thor::Util.user_home).to eq("/home/user/")
150150
end
151151

152152
it "returns path with HOMEDRIVE and HOMEPATH if set" do
153-
ENV.stub!(:[]).with("HOMEDRIVE").and_return("D:/")
154-
ENV.stub!(:[]).with("HOMEPATH").and_return("Documents and Settings/James")
153+
ENV.stub(:[]).with("HOMEDRIVE").and_return("D:/")
154+
ENV.stub(:[]).with("HOMEPATH").and_return("Documents and Settings/James")
155155
expect(Thor::Util.user_home).to eq("D:/Documents and Settings/James")
156156
end
157157

158158
it "returns APPDATA/.thor if set" do
159-
ENV.stub!(:[]).with("APPDATA").and_return("/home/user/")
159+
ENV.stub(:[]).with("APPDATA").and_return("/home/user/")
160160
expect(Thor::Util.user_home).to eq("/home/user/")
161161
end
162162
end
163163

164164
describe "#thor_root_glob" do
165165
before do
166-
ENV.stub!(:[])
166+
ENV.stub(:[])
167167
Thor::Util.clear_user_home!
168168
end
169169

170170
it "escapes globs in path" do
171-
ENV.stub!(:[]).with("HOME").and_return("/home/user{1}/")
171+
ENV.stub(:[]).with("HOME").and_return("/home/user{1}/")
172172
Dir.should_receive(:[]).with("/home/user\\{1\\}/.thor/*").and_return([])
173173
expect(Thor::Util.thor_root_glob).to eq([])
174174
end

0 commit comments

Comments
 (0)