test/test_mailer_generator.rb in padrino-gen-0.12.8.1 vs test/test_mailer_generator.rb in padrino-gen-0.12.9
- old
+ new
@@ -15,9 +15,14 @@
out, err = capture_io { generate(:mailer, 'demo', "-r=#{@apptmp}") }
assert_match(/not at the root/, out)
assert_no_file_exists('/tmp/app/mailers/demo_mailer.rb')
end
+ it 'should fail with NameError if given invalid namespace names' do
+ capture_io { generate(:project, "sample", "--root=#{@apptmp}") }
+ assert_raises(::NameError) { capture_io { generate(:mailer, "wrong/name", "--root=#{@apptmp}/sample") } }
+ end
+
it 'should generate mailer in specified app' do
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon') }
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
capture_io { generate(:mailer, 'demo', '-a=/subby', "-r=#{@apptmp}/sample_project") }
assert_match_in_file(/SampleProject::Subby.mailer :demo/m, "#{@apptmp}/sample_project/subby/mailers/demo.rb")