Permalink
Browse files

Spec the happy path of IDLE

  • Loading branch information...
1 parent d2f9b82 commit fae44bcbe53d8f5671e8612b37c5579ed0150e5a @ConradIrwin ConradIrwin committed Jul 2, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 spec/client_spec.rb
View
@@ -96,6 +96,25 @@
@connection.receive_data "* RUBY0001 OK Success\r\n"
end
+ it "should execute an IDLE correctly" do
+ stopped = false
+ received = nil
+ @connection.should_receive(:send_data).with("RUBY0001 IDLE\r\n")
+ idler = @client.idle do |response|
+ received = response
+ end.callback do
+ stopped = true
+ end
+ @connection.receive_data("+ idling\r\n")
+ received.should be_a Net::IMAP::ContinuationRequest
+
+ @connection.should_receive(:send_data).with("DONE\r\n")
+ idler.stop
+ @connection.receive_data("RUBY0001 OK IDLE terminated (Success)\r\n")
+ received.should be_a Net::IMAP::TaggedResponse
+ stopped.should be_true
+ end
+
describe "login" do
it "should callback on a successful login" do
a = nil

0 comments on commit fae44bc

Please sign in to comment.