dry_crud 0.6.0
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.
- data/MIT-LICENSE +19 -0
- data/README.rdoc +208 -0
- data/Rakefile +101 -0
- data/VERSION +1 -0
- data/rails_generators/dry_crud/USAGE +1 -0
- data/rails_generators/dry_crud/dry_crud_generator.rb +22 -0
- data/rails_generators/dry_crud/templates/INSTALL +13 -0
- data/rails_generators/dry_crud/templates/app/controllers/crud_controller.rb +182 -0
- data/rails_generators/dry_crud/templates/app/helpers/crud_helper.rb +45 -0
- data/rails_generators/dry_crud/templates/app/helpers/standard_helper.rb +209 -0
- data/rails_generators/dry_crud/templates/app/views/crud/_attrs.html.erb +1 -0
- data/rails_generators/dry_crud/templates/app/views/crud/_form.html.erb +1 -0
- data/rails_generators/dry_crud/templates/app/views/crud/_list.html.erb +1 -0
- data/rails_generators/dry_crud/templates/app/views/crud/edit.html.erb +8 -0
- data/rails_generators/dry_crud/templates/app/views/crud/index.html.erb +14 -0
- data/rails_generators/dry_crud/templates/app/views/crud/new.html.erb +7 -0
- data/rails_generators/dry_crud/templates/app/views/crud/show.html.erb +9 -0
- data/rails_generators/dry_crud/templates/app/views/layouts/crud.html.erb +20 -0
- data/rails_generators/dry_crud/templates/app/views/shared/_labeled.html.erb +5 -0
- data/rails_generators/dry_crud/templates/lib/crud_callbacks.rb +55 -0
- data/rails_generators/dry_crud/templates/lib/render_inheritable.rb +118 -0
- data/rails_generators/dry_crud/templates/lib/standard_form_builder.rb +161 -0
- data/rails_generators/dry_crud/templates/lib/standard_table_builder.rb +104 -0
- data/rails_generators/dry_crud/templates/public/stylesheets/crud.css +91 -0
- data/rails_generators/dry_crud/templates/test/crud_test_model.rb +124 -0
- data/rails_generators/dry_crud/templates/test/functional/crud_controller_test_helper.rb +172 -0
- data/rails_generators/dry_crud/templates/test/functional/crud_test_models_controller_test.rb +96 -0
- data/rails_generators/dry_crud/templates/test/unit/crud_helper_test.rb +57 -0
- data/rails_generators/dry_crud/templates/test/unit/render_inheritable_test.rb +161 -0
- data/rails_generators/dry_crud/templates/test/unit/standard_form_builder_test.rb +83 -0
- data/rails_generators/dry_crud/templates/test/unit/standard_helper_test.rb +183 -0
- data/rails_generators/dry_crud/templates/test/unit/standard_table_builder_test.rb +99 -0
- data/test/templates/app/controllers/ajax_controller.rb +7 -0
- data/test/templates/app/controllers/application_controller.rb +11 -0
- data/test/templates/app/controllers/cities_controller.rb +13 -0
- data/test/templates/app/controllers/people_controller.rb +7 -0
- data/test/templates/app/helpers/people_helper.rb +7 -0
- data/test/templates/app/models/city.rb +13 -0
- data/test/templates/app/models/person.rb +9 -0
- data/test/templates/app/views/ajax/_hello.html.erb +1 -0
- data/test/templates/app/views/ajax/ajax.js.rjs +1 -0
- data/test/templates/app/views/ajax/index.html.erb +9 -0
- data/test/templates/app/views/cities/_attrs.html.erb +1 -0
- data/test/templates/app/views/cities/_form.html.erb +4 -0
- data/test/templates/app/views/cities/_hello.html.erb +1 -0
- data/test/templates/app/views/cities/_list.html.erb +5 -0
- data/test/templates/config/routes.rb +11 -0
- data/test/templates/db/migrate/20100511174904_create_people_and_cities.rb +23 -0
- data/test/templates/test/fixtures/cities.yml +11 -0
- data/test/templates/test/fixtures/people.yml +14 -0
- data/test/templates/test/functional/cities_controller_test.rb +35 -0
- data/test/templates/test/functional/people_controller_test.rb +30 -0
- metadata +127 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require File.join(File.dirname(__FILE__), 'crud_controller_test_helper')
|
3
|
+
|
4
|
+
class CitiesControllerTest < ActionController::TestCase
|
5
|
+
|
6
|
+
include CrudControllerTestHelper
|
7
|
+
|
8
|
+
def test_setup
|
9
|
+
assert_equal 3, City.count
|
10
|
+
assert_recognizes({:controller => 'cities', :action => 'index'}, '/cities')
|
11
|
+
assert_recognizes({:controller => 'cities', :action => 'show', :id => '1'}, '/cities/1')
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_index
|
15
|
+
super
|
16
|
+
assert_equal 3, assigns(:entries).size
|
17
|
+
assert_equal City.all(:order => 'country_code, name'), assigns(:entries)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_show
|
21
|
+
get :show, :id => test_entry.id
|
22
|
+
assert_redirected_to_index
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def test_entry
|
28
|
+
cities(:rj)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_entry_attrs
|
32
|
+
{:name => 'Rejkiavik', :country_code => 'IS'}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require File.join(File.dirname(__FILE__), 'crud_controller_test_helper')
|
3
|
+
|
4
|
+
class PeopleControllerTest < ActionController::TestCase
|
5
|
+
|
6
|
+
include CrudControllerTestHelper
|
7
|
+
|
8
|
+
def test_setup
|
9
|
+
assert_equal 2, Person.count
|
10
|
+
assert_recognizes({:controller => 'people', :action => 'index'}, '/people')
|
11
|
+
assert_recognizes({:controller => 'people', :action => 'show', :id => '1'}, '/people/1')
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_index
|
15
|
+
super
|
16
|
+
assert_equal 2, assigns(:entries).size
|
17
|
+
assert_equal Person.all(:include => :city, :order => 'people.name, cities.country_code, cities.name'), assigns(:entries)
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def test_entry
|
23
|
+
people(:john)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_entry_attrs
|
27
|
+
{:name => 'Fischers Fritz', :children => 2, :income => 120, :city_id => cities(:rj).id}
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dry_crud
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Pascal Zumkehr
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-06-10 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: |
|
23
|
+
Generates DRY but extendable CRUD controller, views and helpers for Rails applications
|
24
|
+
|
25
|
+
email: spam@codez.ch
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- MIT-LICENSE
|
32
|
+
- README.rdoc
|
33
|
+
- VERSION
|
34
|
+
files:
|
35
|
+
- rails_generators/dry_crud/dry_crud_generator.rb
|
36
|
+
- rails_generators/dry_crud/templates/app/controllers/crud_controller.rb
|
37
|
+
- rails_generators/dry_crud/templates/app/helpers/crud_helper.rb
|
38
|
+
- rails_generators/dry_crud/templates/app/helpers/standard_helper.rb
|
39
|
+
- rails_generators/dry_crud/templates/app/views/crud/_attrs.html.erb
|
40
|
+
- rails_generators/dry_crud/templates/app/views/crud/_form.html.erb
|
41
|
+
- rails_generators/dry_crud/templates/app/views/crud/_list.html.erb
|
42
|
+
- rails_generators/dry_crud/templates/app/views/crud/edit.html.erb
|
43
|
+
- rails_generators/dry_crud/templates/app/views/crud/index.html.erb
|
44
|
+
- rails_generators/dry_crud/templates/app/views/crud/new.html.erb
|
45
|
+
- rails_generators/dry_crud/templates/app/views/crud/show.html.erb
|
46
|
+
- rails_generators/dry_crud/templates/app/views/layouts/crud.html.erb
|
47
|
+
- rails_generators/dry_crud/templates/app/views/shared/_labeled.html.erb
|
48
|
+
- rails_generators/dry_crud/templates/INSTALL
|
49
|
+
- rails_generators/dry_crud/templates/lib/crud_callbacks.rb
|
50
|
+
- rails_generators/dry_crud/templates/lib/render_inheritable.rb
|
51
|
+
- rails_generators/dry_crud/templates/lib/standard_form_builder.rb
|
52
|
+
- rails_generators/dry_crud/templates/lib/standard_table_builder.rb
|
53
|
+
- rails_generators/dry_crud/templates/public/stylesheets/crud.css
|
54
|
+
- rails_generators/dry_crud/templates/test/crud_test_model.rb
|
55
|
+
- rails_generators/dry_crud/templates/test/functional/crud_controller_test_helper.rb
|
56
|
+
- rails_generators/dry_crud/templates/test/functional/crud_test_models_controller_test.rb
|
57
|
+
- rails_generators/dry_crud/templates/test/unit/crud_helper_test.rb
|
58
|
+
- rails_generators/dry_crud/templates/test/unit/render_inheritable_test.rb
|
59
|
+
- rails_generators/dry_crud/templates/test/unit/standard_form_builder_test.rb
|
60
|
+
- rails_generators/dry_crud/templates/test/unit/standard_helper_test.rb
|
61
|
+
- rails_generators/dry_crud/templates/test/unit/standard_table_builder_test.rb
|
62
|
+
- rails_generators/dry_crud/USAGE
|
63
|
+
- test/templates/app/controllers/ajax_controller.rb
|
64
|
+
- test/templates/app/controllers/application_controller.rb
|
65
|
+
- test/templates/app/controllers/cities_controller.rb
|
66
|
+
- test/templates/app/controllers/people_controller.rb
|
67
|
+
- test/templates/app/helpers/people_helper.rb
|
68
|
+
- test/templates/app/models/city.rb
|
69
|
+
- test/templates/app/models/person.rb
|
70
|
+
- test/templates/app/views/ajax/_hello.html.erb
|
71
|
+
- test/templates/app/views/ajax/ajax.js.rjs
|
72
|
+
- test/templates/app/views/ajax/index.html.erb
|
73
|
+
- test/templates/app/views/cities/_attrs.html.erb
|
74
|
+
- test/templates/app/views/cities/_form.html.erb
|
75
|
+
- test/templates/app/views/cities/_hello.html.erb
|
76
|
+
- test/templates/app/views/cities/_list.html.erb
|
77
|
+
- test/templates/config/routes.rb
|
78
|
+
- test/templates/db/migrate/20100511174904_create_people_and_cities.rb
|
79
|
+
- test/templates/test/fixtures/cities.yml
|
80
|
+
- test/templates/test/fixtures/people.yml
|
81
|
+
- test/templates/test/functional/cities_controller_test.rb
|
82
|
+
- test/templates/test/functional/people_controller_test.rb
|
83
|
+
- Rakefile
|
84
|
+
- MIT-LICENSE
|
85
|
+
- README.rdoc
|
86
|
+
- VERSION
|
87
|
+
has_rdoc: true
|
88
|
+
homepage: http://codez.ch/dry_crud
|
89
|
+
licenses: []
|
90
|
+
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options:
|
93
|
+
- --title
|
94
|
+
- Dry Crud
|
95
|
+
- --main
|
96
|
+
- README.rdoc
|
97
|
+
- --line-numbers
|
98
|
+
- --inline-source
|
99
|
+
require_paths:
|
100
|
+
- rails_generators
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
requirements: []
|
120
|
+
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 1.3.7
|
123
|
+
signing_key:
|
124
|
+
specification_version: 3
|
125
|
+
summary: Generates DRY but extendable CRUD controller, views and helpers for Rails applications
|
126
|
+
test_files: []
|
127
|
+
|