Skip to content

Commit 18fc3d7

Browse files
committed
remove infinity hack in favor of open range (available in Ruby 2.6)
1 parent 6e1dfba commit 18fc3d7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/cocoapods-core/source/manager.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,7 @@ def name_for_url(url)
471471
end
472472

473473
name = base
474-
infinity = 1.0 / 0
475-
(1..infinity).each do |i|
474+
(1..).each do |i|
476475
break unless source_dir(name).exist?
477476
name = "#{base}-#{i}"
478477
end

spec/source/manager_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,13 @@ module Pod
291291
url = 'https://sourceforge.org/Artsy/Specs.git'
292292
Pathname.any_instance.stubs(:exist?).
293293
returns(true).then.returns(false)
294-
@sources_manager.send(:name_for_url, url).
295-
should == 'sourceforge-artsy-1'
294+
@sources_manager.send(:name_for_url, url).should == 'sourceforge-artsy-1'
295+
296+
url = 'https://sourceforge.org/Artsy/Specs.git'
297+
Pathname.any_instance.stubs(:exist?).
298+
returns(true).then.
299+
returns(true).then.returns(false)
300+
@sources_manager.send(:name_for_url, url).should == 'sourceforge-artsy-2'
296301
end
297302
end
298303

0 commit comments

Comments
 (0)