[rspec-users] Expectation ordering

Ashley Moran ashley.moran at patchspace.co.uk
Tue Oct 7 08:59:52 EDT 2008


Hi

Can I still rely on this RSpec behaviour?

I've got a spec for a TCP socket client:

       it "should do things in a sane order" do
         @socket.should_receive(:write) do
           @socket.should_receive(:read) do
             @socket.should_receive(:close)
           end
         end
         @client.update_news_feeds
       end

But this passes, where I was expecting it to fail:

     def update_news_feeds
       socket = TCPSocket.new(@server, @port)
       socket.read
       socket.write("UPDATE\n")
       socket.close
     end

Has this form of expectation ordering been removed?

Thanks
Ashley

-- 
http://www.patchspace.co.uk/
http://aviewfromafar.net/





More information about the rspec-users mailing list