vraptor-scaffold 0.0.1.rc → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -1
- data/.gitignore +1 -0
- data/Gemfile +3 -3
- data/History.txt +10 -0
- data/README.textile +32 -0
- data/Rakefile +6 -7
- data/VERSION.yml +1 -1
- data/bin/vraptor +1 -1
- data/lib/configuration.rb +31 -0
- data/lib/generators/app_generator/app_generator.rb +75 -126
- data/lib/generators/app_generator/freemarker_template_engine.rb +50 -0
- data/lib/generators/app_generator/jsp_template_engine.rb +21 -0
- data/lib/generators/app_generator/templates/build.properties.erb +16 -0
- data/lib/generators/app_generator/templates/build.xml +109 -0
- data/lib/generators/app_generator/templates/decorators.erb +7 -0
- data/lib/generators/app_generator/templates/eclipse/classpath +23 -0
- data/lib/generators/app_generator/templates/eclipse/project.erb +36 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.jdt.core.prefs +8 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.common.component.tt +10 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.common.project.facet.core.xml +10 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.container +1 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.name +1 -0
- data/lib/generators/app_generator/templates/freemarker/freemarker-ivy.xml +2 -0
- data/lib/generators/app_generator/templates/freemarker/freemarker-pom.xml +6 -0
- data/lib/generators/app_generator/templates/freemarker/freemarker-web.xml +23 -0
- data/lib/generators/app_generator/templates/freemarker/infrastructure/FreemarkerPathResolver.java.tt +21 -0
- data/lib/generators/app_generator/templates/{macros → freemarker/macros}/html.ftl +0 -0
- data/lib/generators/app_generator/templates/freemarker/main.ftl +14 -0
- data/lib/generators/app_generator/templates/ivy-2.2.0-rc1.jar +0 -0
- data/lib/generators/app_generator/templates/ivy.erb +35 -0
- data/lib/generators/app_generator/templates/jsp/main.jsp +16 -0
- data/lib/generators/app_generator/templates/pom.erb +24 -3
- data/lib/generators/app_generator/templates/{messages.properties → resources-test/.empty_directory} +0 -0
- data/lib/generators/app_generator/templates/{persistence.xml → resources/META-INF/persistence.xml} +0 -0
- data/lib/generators/app_generator/templates/{log4j.properties → resources/log4j.properties} +0 -0
- data/lib/generators/app_generator/templates/resources/messages.properties +0 -0
- data/lib/generators/app_generator/templates/src-test/controllers/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src-test/models/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src-test/repositories/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src/controllers/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src/models/Entity.java.tt +45 -0
- data/lib/generators/app_generator/templates/src/repositories/Repository.java.tt +43 -0
- data/lib/generators/app_generator/templates/vraptor-scaffold.erb +2 -0
- data/lib/generators/app_generator/templates/webapp/WEB-INF/web.xml +38 -0
- data/lib/generators/app_generator/templates/webapp/images/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/{index.jsp → webapp/index.jsp} +0 -0
- data/lib/generators/app_generator/templates/{javascripts → webapp/javascripts}/jquery-1.4.2.min.js +0 -0
- data/lib/generators/app_generator/templates/{stylesheets → webapp/stylesheets}/scaffold.css +0 -0
- data/lib/generators/scaffold_generator/attribute.rb +14 -6
- data/lib/generators/scaffold_generator/base_scaffold.rb +14 -10
- data/lib/generators/scaffold_generator/controller_generator/controller_generator.rb +6 -6
- data/lib/generators/scaffold_generator/controller_generator/templates/controller.erb +7 -7
- data/lib/generators/scaffold_generator/controller_generator/templates/controller_test.erb +1 -1
- data/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator.rb +5 -5
- data/lib/generators/scaffold_generator/freemarker_generator/templates/index.erb +2 -3
- data/lib/generators/scaffold_generator/jsp_generator/jsp_generator.rb +22 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/edit.erb +3 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/form.erb +27 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/index.erb +36 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/new.erb +3 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/show.erb +14 -0
- data/lib/generators/scaffold_generator/model_generator/model_generator.rb +5 -5
- data/lib/generators/scaffold_generator/model_generator/templates/model.erb +1 -1
- data/lib/generators/scaffold_generator/model_generator/templates/model_test.erb +1 -1
- data/lib/generators/scaffold_generator/repository_generator/repository_generator.rb +6 -5
- data/lib/generators/scaffold_generator/repository_generator/templates/repository.erb +17 -9
- data/lib/generators/scaffold_generator/repository_generator/templates/repository_impl.erb +16 -0
- data/lib/generators/scaffold_generator/repository_generator/templates/repository_test.erb +2 -2
- data/lib/generators/scaffold_generator/scaffold_generator.rb +31 -38
- data/lib/load_paths.rb +6 -2
- data/lib/vraptor-scaffold.rb +29 -5
- data/spec/lib/configuration_spec.rb +60 -0
- data/spec/lib/generators/app_generator/app_generator_spec.rb +237 -116
- data/spec/lib/generators/app_generator/freemarker_template_engine_spec.rb +92 -0
- data/spec/lib/generators/app_generator/jsp_template_engine_spec.rb +44 -0
- data/{lib → spec/lib}/generators/app_generator/templates/Entity.java +5 -2
- data/{lib → spec/lib}/generators/app_generator/templates/FreemarkerPathResolver.java +1 -1
- data/{lib → spec/lib}/generators/app_generator/templates/Repository.java +6 -6
- data/spec/lib/generators/app_generator/templates/build.properties +16 -0
- data/spec/lib/generators/app_generator/templates/decorators-jsp.xml +7 -0
- data/{lib → spec/lib}/generators/app_generator/templates/decorators.xml +2 -2
- data/spec/lib/generators/app_generator/templates/ivy.xml +35 -0
- data/spec/lib/generators/app_generator/templates/pom.xml +24 -3
- data/spec/lib/generators/scaffold_generator/attribute_spec.rb +47 -27
- data/spec/lib/generators/scaffold_generator/base_scaffold_spec.rb +31 -27
- data/spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb +11 -9
- data/spec/lib/generators/scaffold_generator/controller_generator/templates/ProductController.java +2 -2
- data/spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb +16 -14
- data/spec/lib/generators/scaffold_generator/jsp_generator/jsp_generator_spec.rb +34 -0
- data/spec/lib/generators/scaffold_generator/model_generator/model_generator_spec.rb +11 -9
- data/spec/lib/generators/scaffold_generator/repository_generator/repository_generator_spec.rb +17 -9
- data/spec/lib/generators/scaffold_generator/repository_generator/templates/ProductRepository.java +15 -7
- data/spec/lib/generators/scaffold_generator/repository_generator/templates/ProductRepositoryImpl.java +16 -0
- data/spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb +55 -57
- data/spec/lib/vraptor-scaffold_spec.rb +77 -24
- data/spec/resources/vraptor-scaffold.properties +2 -0
- data/spec/spec_helper.rb +13 -1
- data/vraptor-scaffold.gemspec +82 -34
- metadata +86 -42
- data/README.rdoc +0 -104
- data/TODO.txt +0 -17
- data/lib/generators/app_generator/templates/main.ftl +0 -14
- data/lib/generators/app_generator/templates/web.xml +0 -61
@@ -2,31 +2,35 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
|
|
2
2
|
|
3
3
|
describe BaseScaffold do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
5
|
+
before(:each) do
|
6
|
+
@base = BaseScaffold.new("client")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should know model class name" do
|
10
|
+
@base.class_name.should eql("Client")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should know model test class name" do
|
14
|
+
@base.test_class_name.should eql("ClientTest")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should know repository class name impl" do
|
18
|
+
@base.repository_impl_name.should eql("ClientRepositoryImpl")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should know repository interface name" do
|
22
|
+
@base.repository_interface_name.should eql("ClientRepository")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should know repository test class name" do
|
26
|
+
@base.repository_test_class_name.should eql("ClientRepositoryImplTest")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should know controller class name" do
|
30
|
+
@base.controller_class_name.should eql("ClientController")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should know controller test class name" do
|
34
|
+
@base.controller_test_class_name.should eql("ClientControllerTest")
|
35
|
+
end
|
32
36
|
end
|
data/spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../../../../spec_helper")
|
2
2
|
|
3
3
|
describe ControllerGenerator do
|
4
|
-
|
4
|
+
|
5
5
|
before(:each) do
|
6
|
+
mock_config_file
|
6
7
|
@generator = ControllerGenerator.new("product", build_attributes)
|
7
8
|
@generator.build
|
8
9
|
end
|
9
|
-
|
10
|
+
|
10
11
|
after(:each) do
|
11
12
|
FileUtils.remove_dir("src")
|
12
13
|
end
|
13
|
-
|
14
|
+
|
14
15
|
it "should create controller" do
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
source = File.join File.dirname(__FILE__), "templates", "ProductController.java"
|
17
|
+
destination = Configuration.main_class_path "controllers", "ProductController.java"
|
18
|
+
exists_and_identical?(source, destination)
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
it "should create controller test" do
|
21
|
-
|
22
|
+
test_class = Configuration.test_class_path "controllers", "ProductControllerTest.java"
|
23
|
+
File.exist?(test_class).should be_true
|
22
24
|
end
|
23
|
-
|
25
|
+
|
24
26
|
end
|
data/spec/lib/generators/scaffold_generator/controller_generator/templates/ProductController.java
CHANGED
@@ -63,13 +63,13 @@ public class ProductController {
|
|
63
63
|
}
|
64
64
|
|
65
65
|
@Get
|
66
|
-
@Path("/products/{product.id}
|
66
|
+
@Path("/products/{product.id}")
|
67
67
|
public Product show(Product product) {
|
68
68
|
return repository.find(product.getId());
|
69
69
|
}
|
70
70
|
|
71
71
|
@Delete
|
72
|
-
@Path("/products")
|
72
|
+
@Path("/products/{product.id}")
|
73
73
|
public void destroy(Product product) {
|
74
74
|
repository.destroy(repository.find(product.getId()));
|
75
75
|
result.redirectTo(this).index();
|
data/spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb
CHANGED
@@ -1,34 +1,36 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../../../../spec_helper")
|
2
2
|
|
3
3
|
describe FreemarkerGenerator do
|
4
|
-
|
4
|
+
|
5
5
|
before(:each) do
|
6
|
-
|
6
|
+
model = "product"
|
7
|
+
@views_path = File.join Configuration::WEB_INF, "views", model
|
8
|
+
@generator = FreemarkerGenerator.new(model, build_attributes)
|
7
9
|
@generator.build
|
8
10
|
end
|
9
|
-
|
11
|
+
|
10
12
|
after(:each) do
|
11
13
|
FileUtils.remove_dir("src")
|
12
14
|
end
|
13
|
-
|
15
|
+
|
14
16
|
it "should create index view" do
|
15
|
-
File.exist?("
|
17
|
+
File.exist?("#{@views_path}/index.ftl").should be_true
|
16
18
|
end
|
17
|
-
|
19
|
+
|
18
20
|
it "should create show view" do
|
19
|
-
File.exist?("
|
21
|
+
File.exist?("#{@views_path}/show.ftl").should be_true
|
20
22
|
end
|
21
|
-
|
23
|
+
|
22
24
|
it "should create form view" do
|
23
|
-
File.exist?("
|
25
|
+
File.exist?("#{@views_path}/form.ftl").should be_true
|
24
26
|
end
|
25
|
-
|
27
|
+
|
26
28
|
it "should create new view" do
|
27
|
-
File.exist?("
|
29
|
+
File.exist?("#{@views_path}/newProduct.ftl").should be_true
|
28
30
|
end
|
29
|
-
|
31
|
+
|
30
32
|
it "should create edit view" do
|
31
|
-
File.exist?("
|
33
|
+
File.exist?("#{@views_path}/edit.ftl").should be_true
|
32
34
|
end
|
33
|
-
|
35
|
+
|
34
36
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../../spec_helper")
|
2
|
+
|
3
|
+
describe JspGenerator do
|
4
|
+
before(:each) do
|
5
|
+
model = "product"
|
6
|
+
@views_path = File.join Configuration::WEB_INF, "jsp", model
|
7
|
+
@generator = JspGenerator.new(model, build_attributes)
|
8
|
+
@generator.build
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:each) do
|
12
|
+
FileUtils.remove_dir("src")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should create index view" do
|
16
|
+
File.exist?("#{@views_path}/index.jsp").should be_true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should create show view" do
|
20
|
+
File.exist?("#{@views_path}/show.jsp").should be_true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should create form view" do
|
24
|
+
File.exist?("#{@views_path}/form.jsp").should be_true
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should create new view" do
|
28
|
+
File.exist?("#{@views_path}/newProduct.jsp").should be_true
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should create edit view" do
|
32
|
+
File.exist?("#{@views_path}/edit.jsp").should be_true
|
33
|
+
end
|
34
|
+
end
|
@@ -1,23 +1,25 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../../../../spec_helper")
|
2
2
|
|
3
3
|
describe ModelGenerator do
|
4
|
-
|
4
|
+
|
5
5
|
before(:each) do
|
6
|
+
mock_config_file
|
6
7
|
@generator = ModelGenerator.new("product", build_attributes)
|
7
8
|
@generator.build
|
8
9
|
end
|
9
|
-
|
10
|
+
|
10
11
|
after(:each) do
|
11
12
|
FileUtils.remove_dir("src")
|
12
13
|
end
|
13
|
-
|
14
|
+
|
14
15
|
it "should create model" do
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
source = File.join File.dirname(__FILE__), "templates", "Product.java"
|
17
|
+
destination = Configuration.main_class_path "models", "Product.java"
|
18
|
+
exists_and_identical?(source, destination)
|
18
19
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
it "should create model test" do
|
22
|
+
test_class = Configuration.test_class_path "models", "ProductTest.java"
|
23
|
+
File.exist?(test_class).should be_true
|
22
24
|
end
|
23
25
|
end
|
data/spec/lib/generators/scaffold_generator/repository_generator/repository_generator_spec.rb
CHANGED
@@ -1,23 +1,31 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../../../../spec_helper")
|
2
2
|
|
3
3
|
describe RepositoryGenerator do
|
4
|
-
|
4
|
+
|
5
5
|
before(:each) do
|
6
|
+
mock_config_file
|
6
7
|
@generator = RepositoryGenerator.new("product", build_attributes)
|
7
8
|
@generator.build
|
8
9
|
end
|
9
|
-
|
10
|
+
|
10
11
|
after(:each) do
|
11
12
|
FileUtils.remove_dir("src")
|
12
13
|
end
|
13
14
|
|
14
|
-
it "should create repository" do
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
it "should create repository interface" do
|
16
|
+
source = File.join File.dirname(__FILE__), "templates", "ProductRepository.java"
|
17
|
+
destination = Configuration.main_class_path "repositories", "ProductRepository.java"
|
18
|
+
exists_and_identical?(source, destination)
|
18
19
|
end
|
19
|
-
|
20
|
-
|
21
|
-
File.
|
20
|
+
|
21
|
+
it "should create repository impl" do
|
22
|
+
source = File.join File.dirname(__FILE__), "templates", "ProductRepositoryImpl.java"
|
23
|
+
destination = Configuration.main_class_path "repositories", "ProductRepositoryImpl.java"
|
24
|
+
exists_and_identical?(source, destination)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should create repository test" do
|
28
|
+
test_class = Configuration.test_class_path "repositories", "ProductRepositoryImplTest.java"
|
29
|
+
File.exist?(test_class).should be_true
|
22
30
|
end
|
23
31
|
end
|
data/spec/lib/generators/scaffold_generator/repository_generator/templates/ProductRepository.java
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
package app.repositories;
|
2
2
|
|
3
|
-
import
|
3
|
+
import java.util.List;
|
4
4
|
|
5
|
-
import br.com.caelum.vraptor.ioc.Component;
|
6
5
|
import app.models.Product;
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
public interface ProductRepository {
|
8
|
+
/*
|
9
|
+
* Delete the methods you don't want to expose
|
10
|
+
*/
|
11
|
+
|
12
|
+
void create(Product entity);
|
13
|
+
|
14
|
+
void update(Product entity);
|
15
|
+
|
16
|
+
void destroy(Product entity);
|
17
|
+
|
18
|
+
Product find(Long id);
|
19
|
+
|
20
|
+
List<Product> findAll();
|
10
21
|
|
11
|
-
public ProductRepository(EntityManager entityManager) {
|
12
|
-
super(entityManager);
|
13
|
-
}
|
14
22
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
package app.repositories;
|
2
|
+
|
3
|
+
import javax.persistence.EntityManager;
|
4
|
+
|
5
|
+
import br.com.caelum.vraptor.ioc.Component;
|
6
|
+
import app.models.Product;
|
7
|
+
|
8
|
+
@Component
|
9
|
+
public class ProductRepositoryImpl
|
10
|
+
extends Repository<Product, Long>
|
11
|
+
implements ProductRepository {
|
12
|
+
|
13
|
+
public ProductRepositoryImpl(EntityManager entityManager) {
|
14
|
+
super(entityManager);
|
15
|
+
}
|
16
|
+
}
|
@@ -1,68 +1,66 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
|
2
2
|
|
3
3
|
describe ScaffoldGenerator do
|
4
|
-
|
4
|
+
|
5
5
|
before(:each) do
|
6
|
-
@
|
6
|
+
@model = "product"
|
7
|
+
args = [@model, {"name" => "string", "value" => "double"}]
|
8
|
+
@generator = ScaffoldGenerator.new(args)
|
9
|
+
@attributes = @generator.generated_attributes
|
7
10
|
end
|
8
|
-
|
9
|
-
context "
|
10
|
-
it "
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
context "generated attributes" do
|
13
|
+
it "should generate name attribute" do
|
14
|
+
att = @attributes.first
|
15
|
+
att.name.should == "name"
|
16
|
+
att.type.should == "string"
|
14
17
|
end
|
15
|
-
|
16
|
-
it "
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
ScaffoldGenerator.new(args)
|
18
|
+
|
19
|
+
it "should generate value attribute" do
|
20
|
+
att = @attributes.last
|
21
|
+
att.name.should == "value"
|
22
|
+
att.type.should == "double"
|
21
23
|
end
|
22
24
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
@model_generator = mock(ModelGenerator)
|
31
|
-
ModelGenerator.stub!(:new).with(@generator.model, @generator.attributes).and_return(@model_generator)
|
32
|
-
|
33
|
-
@repository_generator = mock(RepositoryGenerator)
|
34
|
-
RepositoryGenerator.stub!(:new).with(@generator.model, @generator.attributes).and_return(@repository_generator)
|
35
|
-
|
36
|
-
@controller_generator = mock(ControllerGenerator)
|
37
|
-
ControllerGenerator.stub!(:new).with(@generator.model, @generator.attributes).and_return(@controller_generator)
|
38
|
-
|
39
|
-
@freemarker_generator = mock(FreemarkerGenerator)
|
40
|
-
FreemarkerGenerator.stub!(:new).with(@generator.model, @generator.attributes).and_return(@freemarker_generator)
|
41
|
-
|
42
|
-
@model_generator.stub!(:build)
|
43
|
-
@repository_generator.stub!(:build)
|
44
|
-
@controller_generator.stub!(:build)
|
45
|
-
@freemarker_generator.stub!(:build)
|
25
|
+
|
26
|
+
it "should call model generator" do
|
27
|
+
@model_generator = mock(ModelGenerator)
|
28
|
+
ModelGenerator.stub!(:new).with(@model, @attributes).and_return(@model_generator)
|
29
|
+
@model_generator.should_receive(:build)
|
30
|
+
@generator.model_generator
|
46
31
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
32
|
+
|
33
|
+
it "should call controller generator" do
|
34
|
+
@controller_generator = mock(ControllerGenerator)
|
35
|
+
ControllerGenerator.stub!(:new).with(@model, @attributes).and_return(@controller_generator)
|
36
|
+
@controller_generator.should_receive(:build)
|
37
|
+
@generator.controller_generator
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should call freemarker generator" do
|
41
|
+
Configuration.stub!(:template_engine).and_return("ftl")
|
42
|
+
@freemarker_generator = mock(FreemarkerGenerator)
|
43
|
+
FreemarkerGenerator.stub!(:new).with(@model, @attributes).and_return(@freemarker_generator)
|
44
|
+
@freemarker_generator.should_receive(:build)
|
45
|
+
@generator.template_engine_generator
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should call jsp generator" do
|
49
|
+
Configuration.stub!(:template_engine).and_return("jsp")
|
50
|
+
@jsp_generator = mock(JspGenerator)
|
51
|
+
JspGenerator.stub!(:new).with(@model, @attributes).and_return(@jsp_generator)
|
52
|
+
@jsp_generator.should_receive(:build)
|
53
|
+
@generator.template_engine_generator
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should call repository generator" do
|
57
|
+
@repository_generator = mock(RepositoryGenerator)
|
58
|
+
RepositoryGenerator.stub!(:new).with(@model, @attributes).and_return(@repository_generator)
|
59
|
+
@repository_generator.should_receive(:build)
|
60
|
+
@generator.repository_generator
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should configure banner" do
|
64
|
+
ScaffoldGenerator.banner.should == "vraptor scaffold MODEL [field:type field:type]"
|
67
65
|
end
|
68
66
|
end
|