Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Spec the happy path of IDLE

  • Loading branch information...
commit fae44bcbe53d8f5671e8612b37c5579ed0150e5a 1 parent d2f9b82
@ConradIrwin authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 spec/client_spec.rb
View
19 spec/client_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.