test/test_controller_generator.rb in padrino-gen-0.13.1 vs test/test_controller_generator.rb in padrino-gen-0.13.2
- old
+ new
@@ -20,9 +20,14 @@
out, err = capture_io { generate(:controller, 'demo', "-r=#{@apptmp}") }
assert_match(/not at the root/, out)
assert_no_file_exists("#{@apptmp}/app/controllers/demo.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(:controller, "wrong/name", "--root=#{@apptmp}/sample") } }
+ end
+
it 'should generate controller within existing project' do
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon') }
capture_io { generate(:controller, 'DemoItems', "-r=#{@apptmp}/sample_project") }
assert_match_in_file(/SampleProject::App.controllers :demo_items do/m, @controller_path)
assert_match_in_file(/helpers DemoItemsHelper/, @helper_path)