spec/lib/redimap/imap_conn_spec.rb in redimap-0.1.1 vs spec/lib/redimap/imap_conn_spec.rb in redimap-0.2.0

- old
+ new

@@ -1,9 +1,10 @@ require 'net/imap' require 'spec_helper' + describe Redimap::ImapConn do before(:each) do @fake_net_imap = double(Net::IMAP) @@ -12,11 +13,11 @@ @fake_net_imap.stub(:login) end context "#initialize" do it "should set imap as Net::IMAP" do - Redimap::ImapConn.new.imap.should == @fake_net_imap + Redimap::ImapConn.new.instance_variable_get('@imap').should == @fake_net_imap end it "should #close when block" do Redimap::ImapConn.new do |imap| imap.should_receive(:close) @@ -25,23 +26,25 @@ end context "#close" do before(:each) do @imap = Redimap::ImapConn.new + + @imap_imap = @imap.instance_variable_get('@imap') end it "should disconnect from IMAP" do - @imap.imap.stub(:logout) + @imap_imap.stub(:logout) - @imap.imap.should_receive(:disconnect) + @imap_imap.should_receive(:disconnect) @imap.close end it "should logout from IMAP" do - @imap.imap.stub(:disconnect) + @imap_imap.stub(:disconnect) - @imap.imap.should_receive(:logout) + @imap_imap.should_receive(:logout) @imap.close end end