test/test_controller_generator.rb in padrino-gen-0.10.7 vs test/test_controller_generator.rb in padrino-gen-0.11.0

- old
+ new

@@ -20,38 +20,38 @@ end 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.controllers :demo_items do/m, @controller_path) - assert_match_in_file(/SampleProject.helpers do/m, "#{@apptmp}/sample_project/app/helpers/demo_items_helper.rb") + assert_match_in_file(/SampleProject::App.controllers :demo_items do/m, @controller_path) + assert_match_in_file(/SampleProject::App.helpers do/m, "#{@apptmp}/sample_project/app/helpers/demo_items_helper.rb") assert_file_exists("#{@apptmp}/sample_project/app/views/demo_items") assert_file_exists(@controller_test_path) end should "generate controller within existing project with weird name" do capture_io { generate(:project, 'warepedia', "--root=#{@apptmp}", '--script=none', '-t=bacon') } capture_io { generate(:controller, 'DemoItems', "-r=#{@apptmp}/warepedia") } - assert_match_in_file(/Warepedia.controllers :demo_items do/m, "#{@apptmp}/warepedia/app/controllers/demo_items.rb") - assert_match_in_file(/Warepedia.helpers do/m, "#{@apptmp}/warepedia/app/helpers/demo_items_helper.rb") + assert_match_in_file(/Warepedia::App.controllers :demo_items do/m, "#{@apptmp}/warepedia/app/controllers/demo_items.rb") + assert_match_in_file(/Warepedia::App.helpers do/m, "#{@apptmp}/warepedia/app/helpers/demo_items_helper.rb") assert_file_exists("#{@apptmp}/warepedia/app/views/demo_items") end should "generate controller 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(:controller, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") } - assert_match_in_file(/Subby.controllers :demo_items do/m, @controller_path.gsub('app','subby')) - assert_match_in_file(/Subby.helpers do/m, "#{@apptmp}/sample_project/subby/helpers/demo_items_helper.rb") + assert_match_in_file(/SampleProject::Subby.controllers :demo_items do/m, @controller_path.gsub('app','subby')) + assert_match_in_file(/SampleProject::Subby.helpers do/m, "#{@apptmp}/sample_project/subby/helpers/demo_items_helper.rb") assert_file_exists("#{@apptmp}/sample_project/subby/views/demo_items") assert_match_in_file(/describe "DemoItemsController" do/m, @controller_test_path.gsub('app','subby')) end should 'not fail if we don\'t have test component' do capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=none') } capture_io { generate(:controller, 'DemoItems', "-r=#{@apptmp}/sample_project") } - assert_match_in_file(/SampleProject.controllers :demo_items do/m, @controller_path) - assert_match_in_file(/SampleProject.helpers do/m, "#{@apptmp}/sample_project/app/helpers/demo_items_helper.rb") + assert_match_in_file(/SampleProject::App.controllers :demo_items do/m, @controller_path) + assert_match_in_file(/SampleProject::App.helpers do/m, "#{@apptmp}/sample_project/app/helpers/demo_items_helper.rb") assert_file_exists("#{@apptmp}/sample_project/app/views/demo_items") assert_no_file_exists("#{@apptmp}/sample_project/test") end should "generate controller test for bacon" do