test/test_helper_generator.rb in padrino-gen-0.13.0.beta2 vs test/test_helper_generator.rb in padrino-gen-0.13.0.beta3
- old
+ new
@@ -93,9 +93,17 @@
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
capture_io { generate(:helper, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
assert_match_in_file(/describe "SampleProject::Subby::DemoItemsHelper" do/m, "#{@apptmp}/sample_project/spec/subby/helpers/demo_items_helper_spec.rb")
end
+ it "should generate helper test for testunit" do
+ capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=testunit', '--script=none') }
+ capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
+ capture_io { generate(:helper, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
+ assert_match_in_file(/class DemoItemsHelperTest < Test::Unit::TestCase/m, "#{@apptmp}/sample_project/test/subby/helpers/demo_items_helper_test.rb")
+ assert_match_in_file(/@helpers\.extend SampleProject::Subby::DemoItemsHelper/m, "#{@apptmp}/sample_project/test/subby/helpers/demo_items_helper_test.rb")
+ end
+
it 'should correctly generate file names' do
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=rspec') }
capture_io { generate(:helper, 'DemoItems', "-r=#{@apptmp}/sample_project") }
assert_file_exists("#{@apptmp}/sample_project/app/helpers/demo_items_helper.rb")
assert_file_exists("#{@apptmp}/sample_project/spec/app/helpers/demo_items_helper_spec.rb")