Permalink
Browse files

Add duplicate test

  • Loading branch information...
inescoelho committed Sep 10, 2015
1 parent 81a93f6 commit 59bb6dfaad34e8a98daed832c2594c7d1ada360e
Showing with 35 additions and 9 deletions.
  1. +35 −9 test/mailer_test.rb
View
@@ -2,14 +2,40 @@
require 'lotus/mailer'
describe Lotus::Mailer do
# describe '.load!' do
# describe 'when custom template is set' do
# it 'will look up template' do
# # your old DSL test goes in here
# end
#
# end
#
# end
describe '.duplicate' do
before do
Lotus::Mailer.configure do
root 'test'
end
module Duplicated
Mailer = Lotus::Mailer.duplicate(self)
end
module DuplicatedConfigure
Mailer = Lotus::Mailer.duplicate(self) do
root 'test/fixtures'
end
end
end
it 'duplicates the configuration of the framework' do
actual = Duplicated::Mailer.configuration
actual.root.must_equal Lotus::Mailer.configuration.root
end
it 'optionally accepts a block to configure the duplicated module' do
configuration = DuplicatedConfigure::Mailer.configuration
configuration.root.must_equal(Pathname.new('test/fixtures').realpath)
configuration.root.wont_equal(Pathname.new('test').realpath)
end
after do
Lotus::Mailer.configuration.reset!
Object.send(:remove_const, :Duplicated)
Object.send(:remove_const, :DuplicatedConfigure)
end
end
end

0 comments on commit 59bb6df

Please sign in to comment.