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.
@@ -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 :<%= table_name %>
5
-
6
- NEW_<%= class_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 = <%= table_name %>(:first)
13
- end
14
-
15
- def test_raw_validation
16
- <%= class_name.upcase.swapcase %> = <%= class_name %>.new
17
- assert <%= class_name.upcase.swapcase %>.valid?, "<%= class_name %> should be valid without initialisation parameters"
18
- # If <%= class_name %> has validation, then use the following:
19
- #assert !<%= class_name.upcase.swapcase %>.valid?, "<%= class_name %> should not be valid without initialisation parameters"
20
- #REQ_ATTR_NAMES.each {|attr_name| assert forum.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"}
21
- end
22
-
23
- def test_new
24
- <%= class_name.upcase.swapcase %> = <%= class_name %>.new(NEW_<%= class_name.upcase %>)
25
- assert <%= class_name.upcase.swapcase %>.valid?, "<%= class_name %> should be valid"
26
- NEW_<%= class_name.upcase %>.each do |attr_name|
27
- assert_equal NEW_FORUM[attr_name], forum.attributes[attr_name], "<%= class_name %>.@#{attr_name.to_s} incorrect"
28
- end
29
- end
30
-
31
- def test_validates_presence_of
32
- REQ_ATTR_NAMES.each do |attr_name|
33
- tmp_<%= class_name.upcase.swapcase %> = NEW_<%= class_name.upcase %>.clone
34
- tmp_<%= class_name.upcase.swapcase %>.delete attr_name.to_sym
35
- <%= class_name.upcase.swapcase %> = <%= class_name %>.new(tmp_<%= class_name.upcase.swapcase %>)
36
- assert !<%= class_name.upcase.swapcase %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is invalid"
37
- assert forum.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
38
- end
39
- end
40
-
41
- def test_duplicate
42
- current_<%= class_name.upcase.swapcase %> = <%= class_name %>.find_first
43
- DUPLICATE_ATTR_NAMES.each do |attr_name|
44
- <%= class_name.upcase.swapcase %> = <%= class_name %>.new(NEW_<%= class_name.upcase %>.merge(attr_name.to_sym => current_<%= class_name.upcase.swapcase %>[attr_name]))
45
- assert !<%= class_name.upcase.swapcase %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is a duplicate"
46
- assert forum.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
47
- end
48
- end
49
- end
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.4
7
- date: 2006-07-14 00:00:00 -06:00
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
- - lib
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
- - !ruby/object:Gem::Version
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
- - 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
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
- - none
78
- dependencies: []
82
+ - none
83
+ dependencies: []
84
+