shared_audits_spec: guard against nil value
The return value from `eol_data` can be `nil`, so we should use a safe navigation operator before `#dig`.
This commit is contained in:
		
							parent
							
								
									98b919f672
								
							
						
					
					
						commit
						53c0780d85
					
				@ -38,8 +38,8 @@ RSpec.describe SharedAudits do
 | 
			
		||||
  describe "::eol_data" do
 | 
			
		||||
    it "returns a parsed JSON object if the product is found" do
 | 
			
		||||
      mock_curl_output stdout: eol_json_text
 | 
			
		||||
      expect(described_class.eol_data("product", "cycle").dig("result", "isEol")).to be(true)
 | 
			
		||||
      expect(described_class.eol_data("product", "cycle").dig("result", "eolFrom")).to eq("2025-01-01")
 | 
			
		||||
      expect(described_class.eol_data("product", "cycle")&.dig("result", "isEol")).to be(true)
 | 
			
		||||
      expect(described_class.eol_data("product", "cycle")&.dig("result", "eolFrom")).to eq("2025-01-01")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "returns nil if the product is not found" do
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user