ajax_scaffold_generator 3.1.4 → 3.1.5
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/CHANGELOG +6 -1
- data/MIT-LICENSE +20 -20
- data/README +32 -32
- data/ajax_scaffold_generator.rb +201 -201
- data/templates/controller.rb +135 -135
- data/templates/functional_test.rb +120 -116
- data/templates/partial_item.rhtml +36 -36
- data/templates/unit_test.rb +53 -50
- metadata +55 -49
data/templates/unit_test.rb
CHANGED
@@ -1,50 +1,53 @@
|
|
1
|
-
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
|
2
|
-
|
3
|
-
class <%= class_name %>Test < Test::Unit::TestCase
|
4
|
-
fixtures :<%=
|
5
|
-
|
6
|
-
NEW_<%=
|
7
|
-
REQ_ATTR_NAMES = %w( ) # name of fields that must be present, e.g. %(name description)
|
8
|
-
DUPLICATE_ATTR_NAMES = %w( ) # name of fields that cannot be a duplicate, e.g. %(name description)
|
9
|
-
|
10
|
-
def setup
|
11
|
-
# Retrieve fixtures via their name
|
12
|
-
# @first = <%=
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_raw_validation
|
16
|
-
<%=
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
|
2
|
+
|
3
|
+
class <%= class_name %>Test < Test::Unit::TestCase
|
4
|
+
fixtures :<%= plural_name %>
|
5
|
+
|
6
|
+
NEW_<%= singular_name.upcase %> = {} # e.g. {:name => 'Test <%= class_name %>', :description => 'Dummy'}
|
7
|
+
REQ_ATTR_NAMES = %w( ) # name of fields that must be present, e.g. %(name description)
|
8
|
+
DUPLICATE_ATTR_NAMES = %w( ) # name of fields that cannot be a duplicate, e.g. %(name description)
|
9
|
+
|
10
|
+
def setup
|
11
|
+
# Retrieve fixtures via their name
|
12
|
+
# @first = <%= plural_name %>(:first)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_raw_validation
|
16
|
+
<%= singular_name %> = <%= class_name %>.new
|
17
|
+
if REQ_ATTR_NAMES.blank?
|
18
|
+
assert <%= singular_name %>.valid?, "<%= class_name %> should be valid without initialisation parameters"
|
19
|
+
else
|
20
|
+
# If <%= class_name %> has validation, then use the following:
|
21
|
+
assert !<%= singular_name %>.valid?, "<%= class_name %> should not be valid without initialisation parameters"
|
22
|
+
REQ_ATTR_NAMES.each {|attr_name| assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_new
|
27
|
+
<%= singular_name %> = <%= class_name %>.new(NEW_<%= singular_name.upcase %>)
|
28
|
+
assert <%= singular_name %>.valid?, "<%= class_name %> should be valid"
|
29
|
+
NEW_<%= singular_name.upcase %>.each do |attr_name|
|
30
|
+
assert_equal NEW_<%= singular_name.upcase %>[attr_name], <%= singular_name %>.attributes[attr_name], "<%= class_name %>.@#{attr_name.to_s} incorrect"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_validates_presence_of
|
35
|
+
REQ_ATTR_NAMES.each do |attr_name|
|
36
|
+
tmp_<%= singular_name %> = NEW_<%= singular_name.upcase %>.clone
|
37
|
+
tmp_<%= singular_name %>.delete attr_name.to_sym
|
38
|
+
<%= singular_name %> = <%= class_name %>.new(tmp_<%= singular_name %>)
|
39
|
+
assert !<%= singular_name %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is invalid"
|
40
|
+
assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_duplicate
|
45
|
+
current_<%= singular_name %> = <%= class_name %>.find_first
|
46
|
+
DUPLICATE_ATTR_NAMES.each do |attr_name|
|
47
|
+
<%= singular_name %> = <%= class_name %>.new(NEW_<%= singular_name.upcase %>.merge(attr_name.to_sym => current_<%= singular_name %>[attr_name]))
|
48
|
+
assert !<%= singular_name %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is a duplicate"
|
49
|
+
assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
metadata
CHANGED
@@ -3,11 +3,11 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ajax_scaffold_generator
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 3.1.
|
7
|
-
date: 2006-07-
|
6
|
+
version: 3.1.5
|
7
|
+
date: 2006-07-18 00:00:00 -06:00
|
8
8
|
summary: Ajax scaffold generator is a rails generator for ajaxified scaffolds
|
9
9
|
require_paths:
|
10
|
-
|
10
|
+
- lib
|
11
11
|
email:
|
12
12
|
homepage:
|
13
13
|
rubyforge_project:
|
@@ -18,61 +18,67 @@ bindir: bin
|
|
18
18
|
has_rdoc: false
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
version: 0.0.0
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
25
24
|
version:
|
26
25
|
platform: ruby
|
27
26
|
signing_key:
|
28
27
|
cert_chain:
|
29
28
|
authors: []
|
29
|
+
|
30
30
|
files:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
31
|
+
- README
|
32
|
+
- CHANGELOG
|
33
|
+
- MIT-LICENSE
|
34
|
+
- ajax_scaffold_generator.rb
|
35
|
+
- templates/
|
36
|
+
- templates/warning.gif
|
37
|
+
- templates/view_list.rhtml
|
38
|
+
- templates/view_component.rhtml
|
39
|
+
- templates/unit_test.rb
|
40
|
+
- templates/rjs_update.rjs
|
41
|
+
- templates/rjs_new.rjs
|
42
|
+
- templates/rjs_edit.rjs
|
43
|
+
- templates/rjs_destroy.rjs
|
44
|
+
- templates/rjs_create.rjs
|
45
|
+
- templates/rjs_cancel.rjs
|
46
|
+
- templates/rico_corner.js
|
47
|
+
- templates/partial_pagination_links.rhtml
|
48
|
+
- templates/partial_new_edit.rhtml
|
49
|
+
- templates/partial_messages.rhtml
|
50
|
+
- templates/partial_item.rhtml
|
51
|
+
- templates/partial_form_messages.rhtml
|
52
|
+
- templates/partial_column_headings.rhtml
|
53
|
+
- templates/model.rb
|
54
|
+
- templates/lib_ajax_scaffold.rb
|
55
|
+
- templates/layout.rhtml
|
56
|
+
- templates/information.gif
|
57
|
+
- templates/indicator.gif
|
58
|
+
- templates/indicator-small.gif
|
59
|
+
- templates/helper.rb
|
60
|
+
- templates/functional_test.rb
|
61
|
+
- templates/form_scaffolding.rhtml
|
62
|
+
- templates/form.rhtml
|
63
|
+
- templates/fixtures.yml
|
64
|
+
- templates/error.gif
|
65
|
+
- templates/controller.rb
|
66
|
+
- templates/arrow_up.gif
|
67
|
+
- templates/arrow_down.gif
|
68
|
+
- templates/ajax_scaffold.js
|
69
|
+
- templates/ajax_scaffold.css
|
70
|
+
- templates/add.gif
|
71
71
|
test_files: []
|
72
|
+
|
72
73
|
rdoc_options: []
|
74
|
+
|
73
75
|
extra_rdoc_files: []
|
76
|
+
|
74
77
|
executables: []
|
78
|
+
|
75
79
|
extensions: []
|
80
|
+
|
76
81
|
requirements:
|
77
|
-
|
78
|
-
dependencies: []
|
82
|
+
- none
|
83
|
+
dependencies: []
|
84
|
+
|