jeffleeismyhero-shoulda_generator 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/Manifest +28 -0
- data/README.markdown +78 -0
- data/Rakefile +26 -0
- data/TODO +8 -0
- data/VERSION.yml +4 -0
- data/rails_generators/shoulda_model/USAGE +27 -0
- data/rails_generators/shoulda_model/shoulda_model_generator.rb +49 -0
- data/rails_generators/shoulda_model/templates/factory.rb +5 -0
- data/rails_generators/shoulda_model/templates/fixtures.yml +19 -0
- data/rails_generators/shoulda_model/templates/migration.rb +18 -0
- data/rails_generators/shoulda_model/templates/model.rb +2 -0
- data/rails_generators/shoulda_model/templates/unit_test.rb +7 -0
- data/rails_generators/shoulda_scaffold/USAGE +34 -0
- data/rails_generators/shoulda_scaffold/shoulda_scaffold_generator.rb +164 -0
- data/rails_generators/shoulda_scaffold/templates/controller.rb +72 -0
- data/rails_generators/shoulda_scaffold/templates/erb/edit.html.erb +21 -0
- data/rails_generators/shoulda_scaffold/templates/erb/index.html.erb +27 -0
- data/rails_generators/shoulda_scaffold/templates/erb/layout.html.erb +22 -0
- data/rails_generators/shoulda_scaffold/templates/erb/new.html.erb +19 -0
- data/rails_generators/shoulda_scaffold/templates/erb/show.html.erb +14 -0
- data/rails_generators/shoulda_scaffold/templates/functional_test/basic.rb +66 -0
- data/rails_generators/shoulda_scaffold/templates/functional_test/should_be_restful.rb +13 -0
- data/rails_generators/shoulda_scaffold/templates/haml/_form.html.haml +7 -0
- data/rails_generators/shoulda_scaffold/templates/haml/edit.html.haml +9 -0
- data/rails_generators/shoulda_scaffold/templates/haml/index.html.haml +18 -0
- data/rails_generators/shoulda_scaffold/templates/haml/layout.html.haml +15 -0
- data/rails_generators/shoulda_scaffold/templates/haml/new.html.haml +7 -0
- data/rails_generators/shoulda_scaffold/templates/haml/show.html.haml +10 -0
- data/rails_generators/shoulda_scaffold/templates/helper.rb +2 -0
- data/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
- data/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +1 -0
- data/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +1 -0
- data/test/fixtures/eager/zoo/reptile_house.rb +2 -0
- data/test/fixtures/eager/zoo.rb +3 -0
- data/test/fixtures/environment_with_constant.rb +1 -0
- data/test/fixtures/lib/generators/missing_class/missing_class_generator.rb +0 -0
- data/test/fixtures/lib/generators/working/working_generator.rb +2 -0
- data/test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb +4 -0
- data/test/fixtures/plugins/default/gemlike/init.rb +1 -0
- data/test/fixtures/plugins/default/gemlike/lib/gemlike.rb +2 -0
- data/test/fixtures/plugins/default/gemlike/rails/init.rb +7 -0
- data/test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb +0 -0
- data/test/fixtures/plugins/default/stubby/about.yml +2 -0
- data/test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb +4 -0
- data/test/fixtures/plugins/default/stubby/init.rb +7 -0
- data/test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb +2 -0
- data/test/rails_generators/shoulda_model_generator_test.rb +38 -0
- data/test/shoulda_macros/generator_macros.rb +36 -0
- data/test/stolen_from_railties.rb +288 -0
- data/test/test_helper.rb +41 -0
- metadata +123 -0
data/test/test_helper.rb
ADDED
@@ -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,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jeffleeismyhero-shoulda_generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Nichols
|
8
|
+
- Jeffrey Lee
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-07-06 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: Generators which create tests using shoulda
|
18
|
+
email: jlee42@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- LICENSE
|
25
|
+
- README.markdown
|
26
|
+
files:
|
27
|
+
- LICENSE
|
28
|
+
- Manifest
|
29
|
+
- README.markdown
|
30
|
+
- Rakefile
|
31
|
+
- TODO
|
32
|
+
- VERSION.yml
|
33
|
+
- rails_generators/shoulda_model/USAGE
|
34
|
+
- rails_generators/shoulda_model/shoulda_model_generator.rb
|
35
|
+
- rails_generators/shoulda_model/templates/factory.rb
|
36
|
+
- rails_generators/shoulda_model/templates/fixtures.yml
|
37
|
+
- rails_generators/shoulda_model/templates/migration.rb
|
38
|
+
- rails_generators/shoulda_model/templates/model.rb
|
39
|
+
- rails_generators/shoulda_model/templates/unit_test.rb
|
40
|
+
- rails_generators/shoulda_scaffold/USAGE
|
41
|
+
- rails_generators/shoulda_scaffold/shoulda_scaffold_generator.rb
|
42
|
+
- rails_generators/shoulda_scaffold/templates/controller.rb
|
43
|
+
- rails_generators/shoulda_scaffold/templates/erb/edit.html.erb
|
44
|
+
- rails_generators/shoulda_scaffold/templates/erb/index.html.erb
|
45
|
+
- rails_generators/shoulda_scaffold/templates/erb/layout.html.erb
|
46
|
+
- rails_generators/shoulda_scaffold/templates/erb/new.html.erb
|
47
|
+
- rails_generators/shoulda_scaffold/templates/erb/show.html.erb
|
48
|
+
- rails_generators/shoulda_scaffold/templates/functional_test/basic.rb
|
49
|
+
- rails_generators/shoulda_scaffold/templates/functional_test/should_be_restful.rb
|
50
|
+
- rails_generators/shoulda_scaffold/templates/haml/_form.html.haml
|
51
|
+
- rails_generators/shoulda_scaffold/templates/haml/edit.html.haml
|
52
|
+
- rails_generators/shoulda_scaffold/templates/haml/index.html.haml
|
53
|
+
- rails_generators/shoulda_scaffold/templates/haml/layout.html.haml
|
54
|
+
- rails_generators/shoulda_scaffold/templates/haml/new.html.haml
|
55
|
+
- rails_generators/shoulda_scaffold/templates/haml/show.html.haml
|
56
|
+
- rails_generators/shoulda_scaffold/templates/helper.rb
|
57
|
+
- test/fixtures/about_yml_plugins/bad_about_yml/about.yml
|
58
|
+
- test/fixtures/about_yml_plugins/bad_about_yml/init.rb
|
59
|
+
- test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb
|
60
|
+
- test/fixtures/eager/zoo.rb
|
61
|
+
- test/fixtures/eager/zoo/reptile_house.rb
|
62
|
+
- test/fixtures/environment_with_constant.rb
|
63
|
+
- test/fixtures/lib/generators/missing_class/missing_class_generator.rb
|
64
|
+
- test/fixtures/lib/generators/working/working_generator.rb
|
65
|
+
- test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb
|
66
|
+
- test/fixtures/plugins/default/gemlike/init.rb
|
67
|
+
- test/fixtures/plugins/default/gemlike/lib/gemlike.rb
|
68
|
+
- test/fixtures/plugins/default/gemlike/rails/init.rb
|
69
|
+
- test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb
|
70
|
+
- test/fixtures/plugins/default/stubby/about.yml
|
71
|
+
- test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb
|
72
|
+
- test/fixtures/plugins/default/stubby/init.rb
|
73
|
+
- test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb
|
74
|
+
- test/rails_generators/shoulda_model_generator_test.rb
|
75
|
+
- test/shoulda_macros/generator_macros.rb
|
76
|
+
- test/stolen_from_railties.rb
|
77
|
+
- test/test_helper.rb
|
78
|
+
has_rdoc: false
|
79
|
+
homepage: http://github.com/jeffleeismyhero/shoulda_generator
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
version:
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
96
|
+
version:
|
97
|
+
requirements: []
|
98
|
+
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 1.2.0
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Generators which create tests using shoulda
|
104
|
+
test_files:
|
105
|
+
- test/fixtures/about_yml_plugins/bad_about_yml/init.rb
|
106
|
+
- test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb
|
107
|
+
- test/fixtures/eager/zoo/reptile_house.rb
|
108
|
+
- test/fixtures/eager/zoo.rb
|
109
|
+
- test/fixtures/environment_with_constant.rb
|
110
|
+
- test/fixtures/lib/generators/missing_class/missing_class_generator.rb
|
111
|
+
- test/fixtures/lib/generators/working/working_generator.rb
|
112
|
+
- test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb
|
113
|
+
- test/fixtures/plugins/default/gemlike/init.rb
|
114
|
+
- test/fixtures/plugins/default/gemlike/lib/gemlike.rb
|
115
|
+
- test/fixtures/plugins/default/gemlike/rails/init.rb
|
116
|
+
- test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb
|
117
|
+
- test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb
|
118
|
+
- test/fixtures/plugins/default/stubby/init.rb
|
119
|
+
- test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb
|
120
|
+
- test/rails_generators/shoulda_model_generator_test.rb
|
121
|
+
- test/shoulda_macros/generator_macros.rb
|
122
|
+
- test/stolen_from_railties.rb
|
123
|
+
- test/test_helper.rb
|