|
104 | 104 | delivery_method.deliver!(mail) |
105 | 105 | end |
106 | 106 | end |
| 107 | + |
| 108 | + context 'with reply_to address' do |
| 109 | + let(:mail) do |
| 110 | + Mail.new( |
| 111 | + to: 'user@example.com', |
| 112 | + from: 'sender@example.com', |
| 113 | + reply_to: 'reply@example.com', |
| 114 | + subject: 'Test Subject', |
| 115 | + body: 'Hello world' |
| 116 | + ) |
| 117 | + end |
| 118 | + |
| 119 | + it 'includes reply_to in the payload' do |
| 120 | + expected_payload = { |
| 121 | + to: ['user@example.com'], |
| 122 | + from: ['sender@example.com'], |
| 123 | + reply_to: ['reply@example.com'], |
| 124 | + subject: 'Test Subject', |
| 125 | + body: { type: :text, content: 'Hello world' }, |
| 126 | + theme: nil |
| 127 | + } |
| 128 | + |
| 129 | + expect(messages).to receive(:push).with(expected_payload) |
| 130 | + delivery_method.deliver!(mail) |
| 131 | + end |
| 132 | + end |
| 133 | + |
| 134 | + context 'without reply_to address' do |
| 135 | + let(:mail) do |
| 136 | + Mail.new( |
| 137 | + to: 'user@example.com', |
| 138 | + from: 'sender@example.com', |
| 139 | + subject: 'Test Subject', |
| 140 | + body: 'Hello world' |
| 141 | + ) |
| 142 | + end |
| 143 | + |
| 144 | + it 'omits reply_to from the payload' do |
| 145 | + expected_payload = { |
| 146 | + to: ['user@example.com'], |
| 147 | + from: ['sender@example.com'], |
| 148 | + subject: 'Test Subject', |
| 149 | + body: { type: :text, content: 'Hello world' }, |
| 150 | + theme: nil |
| 151 | + } |
| 152 | + |
| 153 | + expect(messages).to receive(:push).with(expected_payload) |
| 154 | + delivery_method.deliver!(mail) |
| 155 | + end |
| 156 | + end |
107 | 157 | end |
108 | 158 | end |
0 commit comments