sob-shoulda_generator 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/LICENSE +20 -0
  2. data/Manifest +32 -0
  3. data/README.markdown +81 -0
  4. data/Rakefile +26 -0
  5. data/TODO +8 -0
  6. data/VERSION.yml +4 -0
  7. data/rails_generators/shoulda_model/USAGE +27 -0
  8. data/rails_generators/shoulda_model/shoulda_model_generator.rb +49 -0
  9. data/rails_generators/shoulda_model/templates/factory.rb +5 -0
  10. data/rails_generators/shoulda_model/templates/fixtures.yml +19 -0
  11. data/rails_generators/shoulda_model/templates/migration.rb +16 -0
  12. data/rails_generators/shoulda_model/templates/model.rb +2 -0
  13. data/rails_generators/shoulda_model/templates/unit_test.rb +7 -0
  14. data/rails_generators/shoulda_scaffold/USAGE +34 -0
  15. data/rails_generators/shoulda_scaffold/shoulda_scaffold_generator.rb +163 -0
  16. data/rails_generators/shoulda_scaffold/templates/controller.rb +90 -0
  17. data/rails_generators/shoulda_scaffold/templates/erb/_form.html.erb +8 -0
  18. data/rails_generators/shoulda_scaffold/templates/erb/edit.html.erb +12 -0
  19. data/rails_generators/shoulda_scaffold/templates/erb/index.html.erb +22 -0
  20. data/rails_generators/shoulda_scaffold/templates/erb/layout.html.erb +22 -0
  21. data/rails_generators/shoulda_scaffold/templates/erb/new.html.erb +8 -0
  22. data/rails_generators/shoulda_scaffold/templates/erb/show.html.erb +12 -0
  23. data/rails_generators/shoulda_scaffold/templates/functional_test/basic.rb +292 -0
  24. data/rails_generators/shoulda_scaffold/templates/haml/_form.html.haml +11 -0
  25. data/rails_generators/shoulda_scaffold/templates/haml/edit.html.haml +2 -0
  26. data/rails_generators/shoulda_scaffold/templates/haml/index.html.haml +20 -0
  27. data/rails_generators/shoulda_scaffold/templates/haml/layout.html.haml +26 -0
  28. data/rails_generators/shoulda_scaffold/templates/haml/new.html.haml +2 -0
  29. data/rails_generators/shoulda_scaffold/templates/haml/show.html.haml +10 -0
  30. data/rails_generators/shoulda_scaffold/templates/helper.rb +2 -0
  31. data/rails_generators/shoulda_scaffold/templates/performance_test/browser_test.rb +32 -0
  32. data/rails_generators/shoulda_scaffold/templates/stylesheets/basic.css +4 -0
  33. data/rails_generators/shoulda_scaffold/templates/yui/reset-fonts-grids.css +9 -0
  34. data/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
  35. data/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +1 -0
  36. data/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +1 -0
  37. data/test/fixtures/eager/zoo.rb +3 -0
  38. data/test/fixtures/eager/zoo/reptile_house.rb +2 -0
  39. data/test/fixtures/environment_with_constant.rb +1 -0
  40. data/test/fixtures/lib/generators/missing_class/missing_class_generator.rb +0 -0
  41. data/test/fixtures/lib/generators/working/working_generator.rb +2 -0
  42. data/test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb +4 -0
  43. data/test/fixtures/plugins/default/gemlike/init.rb +1 -0
  44. data/test/fixtures/plugins/default/gemlike/lib/gemlike.rb +2 -0
  45. data/test/fixtures/plugins/default/gemlike/rails/init.rb +7 -0
  46. data/test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb +0 -0
  47. data/test/fixtures/plugins/default/stubby/about.yml +2 -0
  48. data/test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb +4 -0
  49. data/test/fixtures/plugins/default/stubby/init.rb +7 -0
  50. data/test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb +2 -0
  51. data/test/rails_generators/shoulda_model_generator_test.rb +39 -0
  52. data/test/shoulda_macros/generator_macros.rb +36 -0
  53. data/test/stolen_from_railties.rb +288 -0
  54. data/test/test_helper.rb +41 -0
  55. metadata +152 -0
@@ -0,0 +1,41 @@
1
+ require 'rubygems'
2
+ require 'ruby-debug'
3
+ require 'active_support'
4
+ require 'active_record'
5
+ require 'action_controller'
6
+ require 'action_view'
7
+
8
+ require 'shoulda'
9
+
10
+ require 'mocha'
11
+
12
+ require File.join(File.dirname(__FILE__), 'shoulda_macros', 'generator_macros')
13
+
14
+
15
+
16
+ require File.join(File.dirname(__FILE__), 'stolen_from_railties')
17
+
18
+ unless defined?(RAILS_DEFAULT_LOGGER)
19
+ @test_log = File.join(RAILS_ROOT, 'test.log')
20
+ RAILS_DEFAULT_LOGGER = Logger.new(@test_log)
21
+ end
22
+
23
+ Rails::Generator::Base.prepend_sources Rails::Generator::PathSource.new(:shoulda_generator, File.join(File.dirname(__FILE__), "..", "rails_generators"))
24
+
25
+ class GeneratorTestCase
26
+ # Asserts that the given factory was created.
27
+ def assert_generated_factory_for(name)
28
+ assert_generated_file "test/factories/#{name.to_s.underscore}_factory.rb"
29
+ end
30
+
31
+ # Asserts that the given factory was NOT created.
32
+ def deny_generated_factory_for(name)
33
+ deny_file_exists "test/factories/#{name.to_s.underscore}_factory.rb"
34
+ end
35
+
36
+ # asserts that the given file DOES NOT exists
37
+ def deny_file_exists(path)
38
+ assert ! File.exist?("#{RAILS_ROOT}/#{path}"),
39
+ "The file '#{RAILS_ROOT}/#{path}' should not exist"
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sob-shoulda_generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Josh Nichols
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-09 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Generators which create tests using shoulda
17
+ email: josh@technicalpickles.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - LICENSE
26
+ - Manifest
27
+ - Rakefile
28
+ - README.markdown
29
+ - TODO
30
+ - VERSION.yml
31
+ - rails_generators/shoulda_model
32
+ - rails_generators/shoulda_model/shoulda_model_generator.rb
33
+ - rails_generators/shoulda_model/templates
34
+ - rails_generators/shoulda_model/templates/factory.rb
35
+ - rails_generators/shoulda_model/templates/fixtures.yml
36
+ - rails_generators/shoulda_model/templates/migration.rb
37
+ - rails_generators/shoulda_model/templates/model.rb
38
+ - rails_generators/shoulda_model/templates/unit_test.rb
39
+ - rails_generators/shoulda_model/USAGE
40
+ - rails_generators/shoulda_scaffold
41
+ - rails_generators/shoulda_scaffold/shoulda_scaffold_generator.rb
42
+ - rails_generators/shoulda_scaffold/templates
43
+ - rails_generators/shoulda_scaffold/templates/controller.rb
44
+ - rails_generators/shoulda_scaffold/templates/erb
45
+ - rails_generators/shoulda_scaffold/templates/erb/_form.html.erb
46
+ - rails_generators/shoulda_scaffold/templates/erb/edit.html.erb
47
+ - rails_generators/shoulda_scaffold/templates/erb/index.html.erb
48
+ - rails_generators/shoulda_scaffold/templates/erb/layout.html.erb
49
+ - rails_generators/shoulda_scaffold/templates/erb/new.html.erb
50
+ - rails_generators/shoulda_scaffold/templates/erb/show.html.erb
51
+ - rails_generators/shoulda_scaffold/templates/functional_test
52
+ - rails_generators/shoulda_scaffold/templates/functional_test/basic.rb
53
+ - rails_generators/shoulda_scaffold/templates/haml
54
+ - rails_generators/shoulda_scaffold/templates/haml/_form.html.haml
55
+ - rails_generators/shoulda_scaffold/templates/haml/edit.html.haml
56
+ - rails_generators/shoulda_scaffold/templates/haml/index.html.haml
57
+ - rails_generators/shoulda_scaffold/templates/haml/layout.html.haml
58
+ - rails_generators/shoulda_scaffold/templates/haml/new.html.haml
59
+ - rails_generators/shoulda_scaffold/templates/haml/show.html.haml
60
+ - rails_generators/shoulda_scaffold/templates/helper.rb
61
+ - rails_generators/shoulda_scaffold/templates/performance_test
62
+ - rails_generators/shoulda_scaffold/templates/performance_test/browser_test.rb
63
+ - rails_generators/shoulda_scaffold/templates/stylesheets
64
+ - rails_generators/shoulda_scaffold/templates/stylesheets/basic.css
65
+ - rails_generators/shoulda_scaffold/templates/yui
66
+ - rails_generators/shoulda_scaffold/templates/yui/reset-fonts-grids.css
67
+ - rails_generators/shoulda_scaffold/USAGE
68
+ - test/fixtures
69
+ - test/fixtures/about_yml_plugins
70
+ - test/fixtures/about_yml_plugins/bad_about_yml
71
+ - test/fixtures/about_yml_plugins/bad_about_yml/about.yml
72
+ - test/fixtures/about_yml_plugins/bad_about_yml/init.rb
73
+ - test/fixtures/about_yml_plugins/plugin_without_about_yml
74
+ - test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb
75
+ - test/fixtures/eager
76
+ - test/fixtures/eager/zoo
77
+ - test/fixtures/eager/zoo/reptile_house.rb
78
+ - test/fixtures/eager/zoo.rb
79
+ - test/fixtures/environment_with_constant.rb
80
+ - test/fixtures/lib
81
+ - test/fixtures/lib/generators
82
+ - test/fixtures/lib/generators/missing_class
83
+ - test/fixtures/lib/generators/missing_class/missing_class_generator.rb
84
+ - test/fixtures/lib/generators/missing_class/templates
85
+ - test/fixtures/lib/generators/missing_generator
86
+ - test/fixtures/lib/generators/missing_generator/templates
87
+ - test/fixtures/lib/generators/missing_templates
88
+ - test/fixtures/lib/generators/working
89
+ - test/fixtures/lib/generators/working/working_generator.rb
90
+ - test/fixtures/plugins
91
+ - test/fixtures/plugins/alternate
92
+ - test/fixtures/plugins/alternate/a
93
+ - test/fixtures/plugins/alternate/a/generators
94
+ - test/fixtures/plugins/alternate/a/generators/a_generator
95
+ - test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb
96
+ - test/fixtures/plugins/alternate/a/lib
97
+ - test/fixtures/plugins/default
98
+ - test/fixtures/plugins/default/acts
99
+ - test/fixtures/plugins/default/acts/acts_as_chunky_bacon
100
+ - test/fixtures/plugins/default/acts/acts_as_chunky_bacon/lib
101
+ - test/fixtures/plugins/default/empty
102
+ - test/fixtures/plugins/default/gemlike
103
+ - test/fixtures/plugins/default/gemlike/init.rb
104
+ - test/fixtures/plugins/default/gemlike/lib
105
+ - test/fixtures/plugins/default/gemlike/lib/gemlike.rb
106
+ - test/fixtures/plugins/default/gemlike/rails
107
+ - test/fixtures/plugins/default/gemlike/rails/init.rb
108
+ - test/fixtures/plugins/default/plugin_with_no_lib_dir
109
+ - test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb
110
+ - test/fixtures/plugins/default/stubby
111
+ - test/fixtures/plugins/default/stubby/about.yml
112
+ - test/fixtures/plugins/default/stubby/generators
113
+ - test/fixtures/plugins/default/stubby/generators/stubby_generator
114
+ - test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb
115
+ - test/fixtures/plugins/default/stubby/init.rb
116
+ - test/fixtures/plugins/default/stubby/lib
117
+ - test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb
118
+ - test/rails_generators
119
+ - test/rails_generators/shoulda_model_generator_test.rb
120
+ - test/shoulda_macros
121
+ - test/shoulda_macros/generator_macros.rb
122
+ - test/stolen_from_railties.rb
123
+ - test/test_helper.rb
124
+ has_rdoc: true
125
+ homepage: http://github.com/technicalpickles/shoulda_generator
126
+ post_install_message:
127
+ rdoc_options:
128
+ - --inline-source
129
+ - --charset=UTF-8
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: "0"
137
+ version:
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: "0"
143
+ version:
144
+ requirements: []
145
+
146
+ rubyforge_project:
147
+ rubygems_version: 1.2.0
148
+ signing_key:
149
+ specification_version: 2
150
+ summary: Generators which create tests using shoulda
151
+ test_files: []
152
+