zoo-generators 0.1.2 → 0.1.3
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.
@@ -21,8 +21,16 @@ Feature: Zoo Scaffold Generator
|
|
21
21
|
And I run "rake db:migrate"
|
22
22
|
And I should successfully run "rails g zoo:scaffold Project -f"
|
23
23
|
And I run "bundle install"
|
24
|
-
Then I should successfully run "rake test"
|
25
|
-
|
24
|
+
Then I should successfully run "rake test"
|
25
|
+
|
26
|
+
Scenario: Generate scaffold for existing resource
|
27
|
+
Given a new Rails app
|
28
|
+
When I run "rails g model Project some:string"
|
29
|
+
And I run "rake db:migrate"
|
30
|
+
And I run "rails g zoo:scaffold Project"
|
31
|
+
Then I should see "input :some" in file "app/views/projects/_form.html.haml"
|
32
|
+
|
33
|
+
|
26
34
|
Scenario: Generate scaffold with rspec tests
|
27
35
|
Given a new Rails app
|
28
36
|
When I run "rails g zoo:scaffold Project name:string --rspec"
|
@@ -43,7 +43,7 @@ module Zoo
|
|
43
43
|
@controller_actions << 'update' if arg == 'edit'
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
@controller_actions.uniq!
|
48
48
|
@model_attributes.uniq!
|
49
49
|
|
@@ -58,10 +58,12 @@ module Zoo
|
|
58
58
|
@model_attributes << Rails::Generators::GeneratedAttribute.new(column.name.to_s, column.type.to_s)
|
59
59
|
end
|
60
60
|
else
|
61
|
-
|
62
|
-
|
61
|
+
unless class_name.nil?
|
62
|
+
class_name.constantize.columns.each do |column|
|
63
63
|
@model_attributes << Rails::Generators::GeneratedAttribute.new(column.name.to_s, column.type.to_s)
|
64
|
+
end
|
64
65
|
end
|
66
|
+
@model_attributes << Rails::Generators::GeneratedAttribute.new("name", "string") if @model_attributes.empty?
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|