Permalink
Browse files

rename OrdersMailer to OrderMailer (according to the rails convention…

…) and remove attachments (as we now base64 encode them)
  • Loading branch information...
1 parent 43c3b93 commit 58de0d3e9c79263459a0bdb4a30bef873fffb9c2 @svenfuchs svenfuchs committed Jan 17, 2012
View
2 app/controllers/orders_controller.rb
@@ -43,7 +43,7 @@ def destroy
delegate :billing_address, :shipping_address, to: :order
def send_confirmation
- OrdersMailer.confirmation(order).deliver
+ OrderMailer.confirmation(order).deliver
end
def user
View
11 app/mailers/orders_mailer.rb → app/mailers/order_mailer.rb
@@ -1,4 +1,4 @@
-class OrdersMailer < ActionMailer::Base
+class OrderMailer < ActionMailer::Base
include ApplicationHelper
helper_method :encoded_image
@@ -10,15 +10,6 @@ class OrdersMailer < ActionMailer::Base
def confirmation(order)
@order = order
- attach_images(%w(travis-ci.png footer.png))
mail(:to => order.user.email, :subject => 'Thank you for supporting Travis CI!')
end
-
- protected
-
- def attach_images(images)
- images.each do |name|
- attachments.inline[name] = File.read(Rails.root.join("public/images/#{name}"))
- end
- end
end
View
4 spec/mailers/orders_mailer_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
-describe OrdersMailer do
+describe OrderMailer do
describe 'receipt' do
let(:user) { User.new(name: 'Josh Kalderimis', email: 'josh@email.com') }
let(:address) { Address.new(city: 'Berlin') }
let(:order) { Order.new(user: user, package: :medium, :billing_address => address) }
- let(:email) { OrdersMailer.confirmation(order) }
+ let(:email) { OrderMailer.confirmation(order) }
def part(email, type)
parts = email.respond_to?(:body) ? email.body.parts : email.parts

0 comments on commit 58de0d3

Please sign in to comment.