Skip to content

Instantly share code, notes, and snippets.

@maxcal
Created September 15, 2014 11:20
Show Gist options
  • Select an option

  • Save maxcal/bcf9d4008a1b760264f7 to your computer and use it in GitHub Desktop.

Select an option

Save maxcal/bcf9d4008a1b760264f7 to your computer and use it in GitHub Desktop.
Testing multipart emails with rspec/capybara
# Sets up `text` and `html` variables that can be used to test the different parts of a multipart email
RSpec.shared_context 'multipart email' do
let(:html) do
Capybara::Node::Simple.new( mail.body.parts.find {|p| p.content_type.match /html/}.body.raw_source )
end
let(:text) { mail.body.parts.find {|p| p.content_type.match /plain/}.body.raw_source }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment