Sha256: 4ee5f23e1d6a7c67897240578da43f5c862a9654d5101d759f1c3aa5ec9a385e
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require 'flexmock/test_unit' require 'net/pop3_ssl' require 'shoulda' require 'test/unit' require 'unfuddle_my_email' class FetcherTest < Test::Unit::TestCase include UnfuddleMyEmail context "a Fetcher instance" do setup do @fetcher = Fetcher.new('pop.example.com', 110, false, 'user', 'password') @message = flexmock('message', :tested => true) @message.should_receive(:pop).and_return( "From: john@example.com\n" + "Subject: Test subject\n\n" + "This is a test.\n\n" ) @pop3_int = flexmock('pop3_int') @pop3_int.should_receive(:each_mail).and_yield(@message) @pop3_lib = flexmock(Net::POP3) @pop3_lib.should_receive(:start).and_yield(@pop3_int) end should "yield each message" do test_message = nil @fetcher.each do |message| test_message = message end assert_equal "john@example.com", test_message.from assert_equal "Test subject", test_message.subject assert_equal "This is a test.", test_message.body end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
unfuddle_my_email-0.2.2 | test/fetcher_test.rb |
unfuddle_my_email-0.2.1 | test/fetcher_test.rb |
unfuddle_my_email-0.2.0 | test/fetcher_test.rb |