scaffolding_extensions 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
data/doc/testing.txt
CHANGED
@@ -1,6 +1,17 @@
|
|
1
|
-
If you are using Rails and want some basic generic tests,
|
2
|
-
|
3
|
-
|
1
|
+
If you are using Rails and want some basic generic tests, you can run the
|
2
|
+
following code inside test_helper.rb:
|
3
|
+
|
4
|
+
require 'scaffolding_extensions/rails_test_help'
|
5
|
+
|
6
|
+
This gives you the following test class methods:
|
7
|
+
|
8
|
+
test_scaffold_all_models
|
9
|
+
test_scaffold
|
10
|
+
|
11
|
+
And the following test instance methods:
|
12
|
+
|
13
|
+
scaffold_test
|
14
|
+
scaffold_habtm_test
|
4
15
|
|
5
16
|
There is an automated test suite that tests the plugin against all supported web
|
6
17
|
frameworks and ORMs. It is now available in the same github repository as the
|
@@ -16,6 +16,11 @@ class Test::Unit::TestCase
|
|
16
16
|
define_method("test_scaffold_#{model.scaffold_name}"){scaffold_test(model, options)}
|
17
17
|
end
|
18
18
|
|
19
|
+
# Default scaffold session hash to use.
|
20
|
+
def scaffold_session
|
21
|
+
{}
|
22
|
+
end
|
23
|
+
|
19
24
|
# Test that getting all display actions for the scaffold returns success
|
20
25
|
def scaffold_test(model, options = {})
|
21
26
|
klass = @controller.class
|
@@ -23,15 +28,9 @@ class Test::Unit::TestCase
|
|
23
28
|
methods -= klass.scaffold_normalize_options(options[:except]) if options[:except]
|
24
29
|
methods.each do |action|
|
25
30
|
assert_nothing_raised("Error requesting scaffolded action #{action} for model #{model.name}") do
|
26
|
-
get "#{action}_#{model.scaffold_name}"
|
31
|
+
get "#{action}_#{model.scaffold_name}", nil, scaffold_session
|
27
32
|
end
|
28
33
|
assert_response :success, "Response for scaffolded action #{action} for model #{model.name} not :success"
|
29
|
-
# # The habtm scaffolds can't be tested without an id. If the fixture for the
|
30
|
-
# # main scaffolded class is loaded and it has id = 1, you may want to enable
|
31
|
-
# # the following code for testing those scaffolds.
|
32
|
-
# model.scaffold_habtm_associations.each do |association|
|
33
|
-
# scaffold_habtm_test(model, association, 1)
|
34
|
-
# end
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffolding_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-09 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/scaffolding_extensions/model/sequel.rb
|
45
45
|
- lib/scaffolding_extensions/overridable.rb
|
46
46
|
- lib/scaffolding_extensions/prototype_helper.rb
|
47
|
+
- lib/scaffolding_extensions/rails_test_help.rb
|
47
48
|
- doc/advanced.txt
|
48
49
|
- doc/camping.txt
|
49
50
|
- doc/controller_spec.txt
|
@@ -80,7 +81,6 @@ files:
|
|
80
81
|
- scaffolds/new.rhtml
|
81
82
|
- scaffolds/search.rhtml
|
82
83
|
- scaffolds/show.rhtml
|
83
|
-
- test/scaffolding_extensions_test.rb
|
84
84
|
has_rdoc: true
|
85
85
|
homepage: http://scaffolding-ext.rubyforge.org/
|
86
86
|
post_install_message:
|