padrino-gen 0.12.9 → 0.13.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +5 -13
  2. data/bin/padrino-gen +2 -2
  3. data/lib/padrino-gen/generators/actions.rb +5 -17
  4. data/lib/padrino-gen/generators/app/app.rb.tt +2 -3
  5. data/lib/padrino-gen/generators/components/mocks/mocha.rb +1 -1
  6. data/lib/padrino-gen/generators/components/orms/activerecord.rb +1 -1
  7. data/lib/padrino-gen/generators/components/orms/datamapper.rb +0 -16
  8. data/lib/padrino-gen/generators/components/orms/mongoid.rb +38 -19
  9. data/lib/padrino-gen/generators/components/orms/mongomapper.rb +0 -1
  10. data/lib/padrino-gen/generators/components/stylesheets/compass.rb +16 -5
  11. data/lib/padrino-gen/generators/components/tests/bacon.rb +0 -2
  12. data/lib/padrino-gen/generators/components/tests/minitest.rb +0 -2
  13. data/lib/padrino-gen/generators/components/tests/riot.rb +0 -2
  14. data/lib/padrino-gen/generators/components/tests/rspec.rb +1 -5
  15. data/lib/padrino-gen/generators/components/tests/shoulda.rb +0 -3
  16. data/lib/padrino-gen/generators/components/tests/steak.rb +0 -2
  17. data/lib/padrino-gen/generators/controller.rb +0 -1
  18. data/lib/padrino-gen/generators/helper.rb +0 -1
  19. data/lib/padrino-gen/generators/mailer.rb +0 -1
  20. data/lib/padrino-gen/generators/migration.rb +0 -1
  21. data/lib/padrino-gen/generators/plugin.rb +1 -1
  22. data/lib/padrino-gen/generators/project/config/boot.rb +0 -11
  23. data/lib/padrino-gen/generators/project.rb +2 -3
  24. data/lib/padrino-gen/generators/runner.rb +0 -1
  25. data/lib/padrino-gen/generators/task.rb +0 -1
  26. data/lib/padrino-gen/generators/templates/Gemfile.tt +0 -10
  27. data/lib/padrino-gen/generators/templates/Rakefile.tt +0 -2
  28. data/lib/padrino-gen/generators/templates/controller.rb.tt +1 -1
  29. data/lib/padrino-gen/padrino-tasks/activerecord.rb +10 -16
  30. data/lib/padrino-gen/padrino-tasks/datamapper.rb +2 -4
  31. data/lib/padrino-gen/padrino-tasks/sequel.rb +3 -4
  32. data/test/helper.rb +17 -14
  33. data/test/test_component_generator.rb +3 -5
  34. data/test/test_controller_generator.rb +0 -13
  35. data/test/test_helper_generator.rb +0 -13
  36. data/test/test_mailer_generator.rb +0 -5
  37. data/test/test_migration_generator.rb +0 -5
  38. data/test/test_model_generator.rb +24 -30
  39. data/test/test_plugin_generator.rb +0 -4
  40. data/test/test_project_generator.rb +8 -23
  41. data/test/test_task_generator.rb +0 -5
  42. metadata +46 -28
  43. data/lib/padrino-gen/generators/components/tests/testunit.rb +0 -112
@@ -1,112 +0,0 @@
1
- TESTUNIT_SETUP = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTUNIT_SETUP)
2
- RACK_ENV = 'test' unless defined?(RACK_ENV)
3
- require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
4
- Dir[File.expand_path(File.dirname(__FILE__) + "/../app/helpers/**/*.rb")].each(&method(:require))
5
-
6
- class Test::Unit::TestCase
7
- include Rack::Test::Methods
8
-
9
- # You can use this method to custom specify a Rack app
10
- # you want rack-test to invoke:
11
- #
12
- # app CLASS_NAME
13
- # app CLASS_NAME.tap { |a| }
14
- # app(CLASS_NAME) do
15
- # set :foo, :bar
16
- # end
17
- #
18
- def app(app = nil, &blk)
19
- @app ||= block_given? ? app.instance_eval(&blk) : app
20
- @app ||= Padrino.application
21
- end
22
- end
23
- TEST
24
-
25
- TESTUNIT_RAKE = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTUNIT_RAKE)
26
- require 'rake/testtask'
27
-
28
- test_tasks = Dir['test/*/'].map { |d| File.basename(d) }
29
-
30
- test_tasks.each do |folder|
31
- Rake::TestTask.new("test:\#{folder}") do |test|
32
- test.pattern = "test/\#{folder}/**/*_test.rb"
33
- test.verbose = true
34
- end
35
- end
36
-
37
- desc "Run application test suite"
38
- task 'test' => test_tasks.map { |f| "test:\#{f}" }
39
-
40
- task :default => :test
41
- TEST
42
-
43
- TESTUNIT_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTUNIT_CONTROLLER_TEST)
44
- require File.expand_path(File.dirname(__FILE__) + '/../../test_config.rb')
45
-
46
- class !NAME!ControllerTest < Test::Unit::TestCase
47
- def setup
48
- get "/"
49
- end
50
-
51
- def test_returns_hello_world_text
52
- assert_equal "Hello World", last_response.body
53
- end
54
- end
55
- TEST
56
-
57
- TESTUNIT_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTUNIT_MODEL_TEST)
58
- require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
59
-
60
- class !NAME!Test < Test::Unit::TestCase
61
- def test_constructs_a_new_instance
62
- @!DNAME! = !NAME!.new
63
- refute_nil @!DNAME!
64
- end
65
- end
66
- TEST
67
-
68
- TESTUNIT_HELPER_TEST = (<<-TEST) unless defined?(TESTUNIT_HELPER_TEST)
69
- require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
70
-
71
- class !NAME!Test < Test::Unit::TestCase
72
- def self.setup
73
- @helpers = Class.new
74
- @helpers.extend !CONSTANT_NAME!
75
- end
76
-
77
- def helpers
78
- @helpers
79
- end
80
-
81
- def test_foo_helper
82
- assert_equal nil, helpers.foo
83
- end
84
- end
85
- TEST
86
-
87
- def setup_test
88
- require_dependencies 'rack-test', :require => 'rack/test', :group => 'test'
89
- require_dependencies 'test-unit', :require => 'test/unit', :group => 'test'
90
- insert_test_suite_setup TESTUNIT_SETUP
91
- create_file destination_root("test/test.rake"), TESTUNIT_RAKE
92
- end
93
-
94
- def generate_controller_test(name, path)
95
- test_unit_contents = TESTUNIT_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize)
96
- controller_test_path = File.join('test',options[:app],'controllers',"#{name.to_s.underscore}_controller_test.rb")
97
- create_file destination_root(controller_test_path), test_unit_contents, :skip => true
98
- end
99
-
100
- def generate_model_test(name)
101
- test_unit_contents = TESTUNIT_MODEL_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize).gsub(/!DNAME!/, name.to_s.underscore)
102
- test_unit_contents.gsub!(/!PATH!/, recognize_path)
103
- model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
104
- create_file destination_root(model_test_path), test_unit_contents, :skip => true
105
- end
106
-
107
- def generate_helper_test(name, project_name, app_name)
108
- test_unit_contents = TESTUNIT_HELPER_TEST.gsub(/!NAME!/, name).gsub(/!CONSTANT_NAME!/, "#{project_name}::#{app_name}::#{name}")
109
- test_unit_contents.gsub!(/!PATH!/, recognize_path)
110
- helper_spec_path = File.join('test', options[:app], 'helpers', "#{name.underscore}_test.rb")
111
- create_file destination_root(helper_spec_path), test_unit_contents, :skip => true
112
- end