simple_form 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of simple_form might be problematic. Click here for more details.

Files changed (38) hide show
  1. data/README.rdoc +30 -30
  2. data/lib/generators/simple_form/USAGE +1 -1
  3. data/lib/generators/simple_form/install_generator.rb +5 -6
  4. data/lib/generators/simple_form/templates/_form.html.haml +18 -0
  5. data/lib/generators/simple_form/templates/en.yml +14 -0
  6. data/lib/generators/simple_form/templates/simple_form.rb +21 -8
  7. data/lib/simple_form.rb +29 -8
  8. data/lib/simple_form/action_view_extensions/form_helper.rb +24 -1
  9. data/lib/simple_form/components.rb +5 -4
  10. data/lib/simple_form/components/errors.rb +13 -5
  11. data/lib/simple_form/components/hints.rb +1 -1
  12. data/lib/simple_form/components/label_input.rb +13 -0
  13. data/lib/simple_form/components/labels.rb +1 -1
  14. data/lib/simple_form/components/wrapper.rb +12 -2
  15. data/lib/simple_form/error_notification.rb +44 -0
  16. data/lib/simple_form/form_builder.rb +17 -1
  17. data/lib/simple_form/inputs.rb +1 -0
  18. data/lib/simple_form/inputs/base.rb +17 -9
  19. data/lib/simple_form/inputs/boolean_input.rb +22 -0
  20. data/lib/simple_form/inputs/collection_input.rb +6 -6
  21. data/lib/simple_form/inputs/date_time_input.rb +4 -4
  22. data/lib/simple_form/inputs/mapping_input.rb +0 -1
  23. data/lib/simple_form/inputs/numeric_input.rb +5 -1
  24. data/lib/simple_form/inputs/string_input.rb +5 -6
  25. data/lib/simple_form/version.rb +1 -1
  26. data/test/action_view_extensions/builder_test.rb +18 -18
  27. data/test/action_view_extensions/form_helper_test.rb +5 -5
  28. data/test/components/error_test.rb +14 -5
  29. data/test/components/hint_test.rb +1 -1
  30. data/test/components/label_test.rb +4 -3
  31. data/test/components/wrapper_test.rb +54 -0
  32. data/test/error_notification_test.rb +61 -0
  33. data/test/form_builder_test.rb +31 -11
  34. data/test/inputs_test.rb +55 -51
  35. data/test/support/mock_controller.rb +4 -4
  36. data/test/support/models.rb +11 -8
  37. data/test/test_helper.rb +8 -9
  38. metadata +30 -4
@@ -1,12 +1,12 @@
1
1
  class MockController
2
2
  attr_accessor :action_name
3
3
 
4
- def action_name
5
- @action_name || "edit"
4
+ def _routes
5
+ self
6
6
  end
7
7
 
8
- def _router
9
- self
8
+ def action_name
9
+ @action_name || "edit"
10
10
  end
11
11
 
12
12
  def url_for(*args)
@@ -36,7 +36,7 @@ class User < OpenStruct
36
36
  extend ActiveModel::Naming
37
37
 
38
38
  # Get rid of deprecation warnings
39
- undef_method :id
39
+ undef_method :id if respond_to?(:id)
40
40
 
41
41
  def new_record!
42
42
  @new_record = true
@@ -91,13 +91,16 @@ class User < OpenStruct
91
91
  end
92
92
 
93
93
  def errors
94
- @errors ||= {
95
- :name => "can't be blank",
96
- :description => "must be longer than 15 characters",
97
- :age => ["is not a number", "must be greater than 18"],
98
- :company => "company must be present",
99
- :company_id => "must be valid"
100
- }
94
+ @errors ||= begin
95
+ hash = Hash.new { |h,k| h[k] = [] }
96
+ hash.merge!(
97
+ :name => ["can't be blank"],
98
+ :description => ["must be longer than 15 characters"],
99
+ :age => ["is not a number", "must be greater than 18"],
100
+ :company => ["company must be present"],
101
+ :company_id => ["must be valid"]
102
+ )
103
+ end
101
104
  end
102
105
  end
103
106
 
data/test/test_helper.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  require 'rubygems'
2
+ require 'bundler'
3
+
4
+ Bundler.setup
5
+
2
6
  require 'test/unit'
7
+ require 'mocha'
3
8
 
4
9
  require 'active_model'
5
10
  require 'action_controller'
@@ -7,12 +12,7 @@ require 'action_view'
7
12
  require 'action_view/template'
8
13
  require 'action_view/test_case'
9
14
 
10
- begin
11
- require 'ruby-debug'
12
- rescue LoadError
13
- end
14
-
15
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib', 'simple_form')
15
+ $:.unshift File.expand_path("../../lib", __FILE__)
16
16
  require 'simple_form'
17
17
 
18
18
  Dir["#{File.dirname(__FILE__)}/support/*.rb"].each { |f| require f }
@@ -33,8 +33,7 @@ end
33
33
 
34
34
  class ActionView::TestCase
35
35
  include MiscHelpers
36
-
37
- tests SimpleForm::ActionViewExtensions::FormHelper
36
+ include SimpleForm::ActionViewExtensions::FormHelper
38
37
 
39
38
  setup :set_controller
40
39
  setup :set_response
@@ -55,7 +54,7 @@ class ActionView::TestCase
55
54
  :description => 'Hello!',
56
55
  :created_at => Time.now
57
56
  }.merge(options))
58
-
57
+
59
58
  @validating_user = ValidatingUser.new({
60
59
  :id => 1,
61
60
  :name => 'New in Simple Form!',
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 29
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 2
8
- - 0
9
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - "Jos\xC3\xA9 Valim"
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-05-24 00:00:00 +02:00
19
+ date: 2010-07-24 00:00:00 +02:00
19
20
  default_executable:
20
21
  dependencies: []
21
22
 
@@ -32,6 +33,7 @@ files:
32
33
  - lib/generators/simple_form/USAGE
33
34
  - lib/generators/simple_form/install_generator.rb
34
35
  - lib/generators/simple_form/templates/_form.html.erb
36
+ - lib/generators/simple_form/templates/_form.html.haml
35
37
  - lib/generators/simple_form/templates/en.yml
36
38
  - lib/generators/simple_form/templates/simple_form.rb
37
39
  - lib/simple_form.rb
@@ -40,13 +42,16 @@ files:
40
42
  - lib/simple_form/components.rb
41
43
  - lib/simple_form/components/errors.rb
42
44
  - lib/simple_form/components/hints.rb
45
+ - lib/simple_form/components/label_input.rb
43
46
  - lib/simple_form/components/labels.rb
44
47
  - lib/simple_form/components/wrapper.rb
48
+ - lib/simple_form/error_notification.rb
45
49
  - lib/simple_form/form_builder.rb
46
50
  - lib/simple_form/i18n_cache.rb
47
51
  - lib/simple_form/inputs.rb
48
52
  - lib/simple_form/inputs/base.rb
49
53
  - lib/simple_form/inputs/block_input.rb
54
+ - lib/simple_form/inputs/boolean_input.rb
50
55
  - lib/simple_form/inputs/collection_input.rb
51
56
  - lib/simple_form/inputs/date_time_input.rb
52
57
  - lib/simple_form/inputs/hidden_input.rb
@@ -57,6 +62,21 @@ files:
57
62
  - lib/simple_form/map_type.rb
58
63
  - lib/simple_form/version.rb
59
64
  - README.rdoc
65
+ - test/action_view_extensions/builder_test.rb
66
+ - test/action_view_extensions/form_helper_test.rb
67
+ - test/components/error_test.rb
68
+ - test/components/hint_test.rb
69
+ - test/components/label_test.rb
70
+ - test/components/wrapper_test.rb
71
+ - test/error_notification_test.rb
72
+ - test/form_builder_test.rb
73
+ - test/inputs_test.rb
74
+ - test/simple_form_test.rb
75
+ - test/support/misc_helpers.rb
76
+ - test/support/mock_controller.rb
77
+ - test/support/mock_response.rb
78
+ - test/support/models.rb
79
+ - test/test_helper.rb
60
80
  has_rdoc: true
61
81
  homepage: http://github.com/plataformatec/simple_form
62
82
  licenses: []
@@ -67,23 +87,27 @@ rdoc_options:
67
87
  require_paths:
68
88
  - lib
69
89
  required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
70
91
  requirements:
71
92
  - - ">="
72
93
  - !ruby/object:Gem::Version
94
+ hash: 3
73
95
  segments:
74
96
  - 0
75
97
  version: "0"
76
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
77
100
  requirements:
78
101
  - - ">="
79
102
  - !ruby/object:Gem::Version
103
+ hash: 3
80
104
  segments:
81
105
  - 0
82
106
  version: "0"
83
107
  requirements: []
84
108
 
85
109
  rubyforge_project:
86
- rubygems_version: 1.3.6
110
+ rubygems_version: 1.3.7
87
111
  signing_key:
88
112
  specification_version: 3
89
113
  summary: Forms made easy!
@@ -93,6 +117,8 @@ test_files:
93
117
  - test/components/error_test.rb
94
118
  - test/components/hint_test.rb
95
119
  - test/components/label_test.rb
120
+ - test/components/wrapper_test.rb
121
+ - test/error_notification_test.rb
96
122
  - test/form_builder_test.rb
97
123
  - test/inputs_test.rb
98
124
  - test/simple_form_test.rb