mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	[rubygems/rubygems] Implement Bundler::Source::Rubygems#no_remotes?
This method is created to tell whether any remote exist in the object or not and it will be used by `Bundler:SourceList` to tell if a global source has been defined implicitly or not.
47e3ff0e47
			
			
This commit is contained in:
		
							parent
							
								
									095b5bbcc1
								
							
						
					
					
						commit
						91a3f06e98
					
				
					 2 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -71,6 +71,10 @@ module Bundler
 | 
				
			||||||
        @remotes.size > 1
 | 
					        @remotes.size > 1
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      def no_remotes?
 | 
				
			||||||
 | 
					        @remotes.size == 0
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def can_lock?(spec)
 | 
					      def can_lock?(spec)
 | 
				
			||||||
        return super unless multiple_remotes?
 | 
					        return super unless multiple_remotes?
 | 
				
			||||||
        include?(spec.source)
 | 
					        include?(spec.source)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,4 +30,18 @@ RSpec.describe Bundler::Source::Rubygems do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe "#no_remotes?" do
 | 
				
			||||||
 | 
					    context "when no remote provided" do
 | 
				
			||||||
 | 
					      it "returns a truthy value" do
 | 
				
			||||||
 | 
					        expect(described_class.new("remotes" => []).no_remotes?).to be_truthy
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    context "when a remote provided" do
 | 
				
			||||||
 | 
					      it "returns a falsey value" do
 | 
				
			||||||
 | 
					        expect(described_class.new("remotes" => ["https://rubygems.org"]).no_remotes?).to be_falsey
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue