fake_smtp 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,12 +36,12 @@ module FakeSmtp
36
36
  def run
37
37
  log("New session: #{@socket}")
38
38
 
39
- handlers[:start].call if handlers[:start]
39
+ instance_eval &handlers[:start] if handlers[:start]
40
40
  until done
41
41
  break unless cmd = read_line
42
42
  handle_command cmd
43
43
  end
44
- handlers[:end].call if handlers[:end]
44
+ instance_eval &handlers[:end] if handlers[:end]
45
45
 
46
46
  @socket.close
47
47
  log("Session finished: #{@socket}")
@@ -63,6 +63,7 @@ module FakeSmtp
63
63
  end
64
64
 
65
65
  def respond_with(msg)
66
+ log "Response: #{msg}"
66
67
  @socket.puts msg
67
68
  end
68
69
 
@@ -75,9 +76,12 @@ module FakeSmtp
75
76
  end
76
77
 
77
78
  class SmtpSession < Session
79
+ on :start do
80
+ respond_with '220 smtp.example.com SMTP FakeSmtp'
81
+ end
78
82
  on /^HELO|^EHLO/ do
79
83
  words = cmd.split(' ')
80
- respond_with "Hello #{words[1]} I am glad to meet you"
84
+ respond_with "250: Hello #{words[1]} I am glad to meet you"
81
85
  end
82
86
 
83
87
  on /^QUIT/ do
@@ -1,3 +1,3 @@
1
1
  module FakeSmtp
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_smtp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: