Skip to content

Commit

Permalink
Move error spec into its own section
Browse files Browse the repository at this point in the history
  • Loading branch information
ConradIrwin committed Jul 2, 2011
1 parent 06963c1 commit cb53676
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions spec/client_spec.rb
Expand Up @@ -96,16 +96,6 @@
@connection.receive_data "* RUBY0001 OK Success\r\n" @connection.receive_data "* RUBY0001 OK Success\r\n"
end end


it "should fail all concurrent commands if something goes wrong" do
a = b = false
@client.create("Encyclop\xc3\xa6dia").errback{ |e| a = true }
@client.create("Brittanica").errback{ |e| b = true }
@connection.should_receive(:close_connection).once
@connection.fail_all EOFError.new("Testing error")
a.should == true
b.should == true
end

describe "login" do describe "login" do
it "should callback on a successful login" do it "should callback on a successful login" do
a = nil a = nil
Expand Down Expand Up @@ -151,4 +141,21 @@
end end
end end
end end

describe "multi-command concurrency" do
before :each do
@client = EM::IMAP::Client.new(@connection)
@connection.receive_data "* OK Ready to test!\r\n"
end

it "should fail all concurrent commands if something goes wrong" do
a = b = false
@client.create("Encyclop\xc3\xa6dia").errback{ |e| a = true }
@client.create("Brittanica").errback{ |e| b = true }
@connection.should_receive(:close_connection).once
@connection.fail_all EOFError.new("Testing error")
a.should == true
b.should == true
end
end
end end

0 comments on commit cb53676

Please sign in to comment.