title: FIFO Ruby Queues algorithm not working
body: <p>Build the now_serving method which should call out (i.e. puts) the next person in line and then remove them from the front. If there is nobody in line, it should call out (puts) that "There is nobody waiting to be served!". When I try to use the shift method to get rid of the first element in the array. I end up with the wrong output. Here is the Ruby code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>def now_serving(array)
    while array.length != 0
      array.each do |name|
        puts "Currently serving #{name}."
        array.shift
        end
    end
      puts "There is nobody waiting to be served!"
  end</code></pre>
  </div>
  </div>
  </p>
  
  <p>But the array.shift is only working once, How do I get it to drop the first element of an array continuously. Here is the code for the Rspec:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>describe "#now_serving" do
      context "there are no people in line" do
        it "should say that the line is empty" do
          expect($stdout).to receive(:puts).with("There is nobody waiting to be served!")
          now_serving(katz_deli)
        end
      end
  
      context "there are people in line" do
        it "should serve the first person in line and remove them from the queue" do
          expect($stdout).to receive(:puts).with("Currently serving Logan.")
          now_serving(other_deli)
          expect(other_deli).to eq(%w(Avi Spencer))
        end
      end
    end
  
  end</code></pre>
  </div>
  </div>
  </p>