How to solve in `block (2 levels) in <top (required)>' in Ruby : I am extracting a value from xml
And I am using that value to check if it exists in a PDF file

     @reader = file('C:\Users\ecz560\Desktop\30004_Standard.pdf').parse_pdf
     @xml = file('C:\Users\ecz560\Desktop\30004Standard.xml').parse_xmlDoc
     @CustName = @xml.xpath("//Customer[RTLtr_Loancust='0163426']//RTLtr_CustomerName").map(&:text).to_s
     page_index = 0
     @reader.pages.each do |page|
     page_index = page_index+1
       if expect(page.text).to include  @CustName
         valid_text = "Given text is present in -- #{page_index}"
         puts valid_text
       end
     end

But I am getting a error

    ./features/step_definitions/Letters/Test1_Letters.rb:370:in `block (2 levels) in <top (required)>'
    ./features/step_definitions/Letters/Test1_Letters.rb:368:in `each'
    ./features/step_definitions/Letters/Test1_Letters.rb:368:in `/^I validate the PDF content$/'
    C:\Users\ecz560\Documents\GitHub\ATDD Local\features\FeatureFiles\Letters\Test1_Letters.feature:72:in `Then I validate the PDF content'

How can I resolve this ?