From 10afc0589d5aae0151fd64310ed32bdf6c483229 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Sun, 12 Feb 2012 17:16:48 +0800 Subject: [PATCH] Rename mailbox to mailcrate. --- .rvmrc | 2 +- README => README.md | 0 Rakefile | 6 +++--- examples/spec/mailer_spec.rb | 16 +++++++------- lib/{mailbox.rb => mailcrate.rb} | 6 +++--- spec/{mailbox_spec.rb => mailcrate_spec.rb} | 24 ++++++++++----------- 6 files changed, 27 insertions(+), 27 deletions(-) rename README => README.md (100%) rename lib/{mailbox.rb => mailcrate.rb} (91%) rename spec/{mailbox_spec.rb => mailcrate_spec.rb} (62%) diff --git a/.rvmrc b/.rvmrc index 9210c64..81b8e6d 100644 --- a/.rvmrc +++ b/.rvmrc @@ -1 +1 @@ -rvm --create use 1.8.7-p352@mailbox +rvm --create use 1.8.7-p352@mailcrate diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/Rakefile b/Rakefile index 66785d3..fd26b8e 100644 --- a/Rakefile +++ b/Rakefile @@ -12,14 +12,14 @@ require 'rubygems/package_task' spec = Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.summary = 'A mock SMTP server that can be run and inspected from tests.' - s.name = 'mailbox' + s.name = 'mailcrate' s.version = '0.0.1' s.requirements << 'none' s.require_path = 'lib' - s.files = 'lib/mailbox.rb' + s.files = 'lib/mailcrate.rb' s.description = 'A mock SMTP server that can be run and inspected from tests. The server runs in memory and received messages can be retrieved.' s.email = 'adam.d.scott@gmail.com' - s.homepage = 'https://github.com/adscott/mailbox' + s.homepage = 'https://github.com/adscott/mailcrate' s.authors = 'Adam Scott' end diff --git a/examples/spec/mailer_spec.rb b/examples/spec/mailer_spec.rb index 981cc41..d8c048e 100644 --- a/examples/spec/mailer_spec.rb +++ b/examples/spec/mailer_spec.rb @@ -1,5 +1,5 @@ require 'examples/app/mailer' -require 'lib/mailbox' +require 'lib/mailcrate' ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.delivery_method = :smtp @@ -12,21 +12,21 @@ describe Mailer do before do - @mailbox = Mailbox.new(2525) - @mailbox.start + @mailcrate = Mailcrate.new(2525) + @mailcrate.start end after do - @mailbox.stop + @mailcrate.stop end - it 'should use Mailbox to send mails' do + it 'should use Mailcrate to send mails' do mail = Mailer.welcome_email('a@b.com') mail.deliver - @mailbox.mails[0][:from].should == '' - @mailbox.mails[0][:to_list].should include '' - @mailbox.mails[0][:body].should include 'Full of awesomeness.' + @mailcrate.mails[0][:from].should == '' + @mailcrate.mails[0][:to_list].should include '' + @mailcrate.mails[0][:body].should include 'Full of awesomeness.' end end \ No newline at end of file diff --git a/lib/mailbox.rb b/lib/mailcrate.rb similarity index 91% rename from lib/mailbox.rb rename to lib/mailcrate.rb index c346bdd..7d6b284 100644 --- a/lib/mailbox.rb +++ b/lib/mailcrate.rb @@ -1,6 +1,6 @@ require 'socket' -class Mailbox +class Mailcrate attr_reader :mails @@ -39,11 +39,11 @@ def get_line end def serve( connection ) - connection.puts( "220 localhost mailbox ready ESTMP" ) + connection.puts( "220 localhost mailcrate ready ESTMP" ) helo = connection.get_line if helo =~ /^EHLO\s+/ - connection.puts "250-localhost mailbox here" + connection.puts "250-localhost mailcrate here" connection.puts "250 HELP" end diff --git a/spec/mailbox_spec.rb b/spec/mailcrate_spec.rb similarity index 62% rename from spec/mailbox_spec.rb rename to spec/mailcrate_spec.rb index 813558e..12fc936 100644 --- a/spec/mailbox_spec.rb +++ b/spec/mailcrate_spec.rb @@ -1,28 +1,28 @@ -require 'mailbox' +require 'mailcrate' require 'port' require 'matchers/eventually' -describe Mailbox do +describe Mailcrate do before do - @mailbox = Mailbox.new(2525) + @mailcrate = Mailcrate.new(2525) end after do - @mailbox.stop + @mailcrate.stop end describe 'ports' do it 'should open a port' do - @mailbox.start + @mailcrate.start port(2525).should be_open end it 'should close a port' do - @mailbox.start - @mailbox.stop + @mailcrate.start + @mailcrate.stop port(2525).should_not be_open end @@ -33,7 +33,7 @@ describe 'should accept SMTP traffic' do it 'should recieve email' do - @mailbox.start + @mailcrate.start socket = TCPSocket.open('localhost', 2525) socket.puts('helo localhost.localdomain') @@ -44,10 +44,10 @@ socket.puts('.') socket.puts('QUIT') - @mailbox.mails.should eventually have(1).items - @mailbox.mails[0][:from].should == 'myaddress@mydomain.com' - @mailbox.mails[0][:to_list].should include 'somone@somedomain.com' - @mailbox.mails[0][:body].should == 'Hello Fred, can you call me?' + @mailcrate.mails.should eventually have(1).items + @mailcrate.mails[0][:from].should == 'myaddress@mydomain.com' + @mailcrate.mails[0][:to_list].should include 'somone@somedomain.com' + @mailcrate.mails[0][:body].should == 'Hello Fred, can you call me?' end end