simple_form 2.0.1 → 2.0.2

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.

Potentially problematic release.


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

@@ -57,6 +57,12 @@ class StringInputTest < ActionView::TestCase
57
57
  assert_select 'input.string[maxlength=12]'
58
58
  end
59
59
 
60
+ test 'input size and maxlength should be the column limit plus one to make room for decimal point' do
61
+ with_input_for @user, :credit_limit, :string
62
+
63
+ assert_select "input.string[maxlength=16][size=16]"
64
+ end
65
+
60
66
  test 'input should not generate placeholder by default' do
61
67
  with_input_for @user, :name, :string
62
68
  assert_no_select 'input[placeholder]'
@@ -19,3 +19,9 @@ class CustomizedInput < SimpleForm::Inputs::StringInput
19
19
  :text_field
20
20
  end
21
21
  end
22
+
23
+ class CollectionSelectInput < SimpleForm::Inputs::CollectionSelectInput
24
+ def input_html_classes
25
+ super.push('chosen')
26
+ end
27
+ end
@@ -54,6 +54,12 @@ module MiscHelpers
54
54
  end
55
55
  end
56
56
 
57
+ def custom_wrapper_with_label_html_option
58
+ SimpleForm.build :tag => :div, :class => "custom_wrapper", :label_html => { :class => 'extra-label-class' } do |b|
59
+ b.use :label_input
60
+ end
61
+ end
62
+
57
63
  def custom_form_for(object, *args, &block)
58
64
  simple_form_for(object, *(args << { :builder => CustomFormBuilder }), &block)
59
65
  end
@@ -63,7 +69,11 @@ module MiscHelpers
63
69
  end
64
70
 
65
71
  def with_concat_form_for(*args, &block)
66
- concat simple_form_for(*args, &block)
72
+ concat simple_form_for(*args, &(block || proc {}))
73
+ end
74
+
75
+ def with_concat_fields_for(*args, &block)
76
+ concat simple_fields_for(*args, &block)
67
77
  end
68
78
 
69
79
  def with_concat_custom_form_for(*args, &block)
@@ -1,8 +1,12 @@
1
- require 'ostruct'
2
-
3
- Column = Struct.new(:name, :type, :limit)
4
1
  Association = Struct.new(:klass, :name, :macro, :options)
5
2
 
3
+ class Column < Struct.new(:name, :type, :limit)
4
+ # Returns +true+ if the column is either of type integer, float or decimal.
5
+ def number?
6
+ type == :integer || type == :float || type == :decimal
7
+ end
8
+ end
9
+
6
10
  class Company < Struct.new(:id, :name)
7
11
  extend ActiveModel::Naming
8
12
  include ActiveModel::Conversion
data/test/test_helper.rb CHANGED
@@ -32,22 +32,19 @@ I18n.default_locale = :en
32
32
 
33
33
  require 'country_select'
34
34
 
35
+ ActionDispatch::Assertions::NO_STRIP << "label"
36
+
35
37
  class ActionView::TestCase
36
38
  include MiscHelpers
37
39
  include SimpleForm::ActionViewExtensions::FormHelper
38
40
 
39
41
  setup :set_controller
40
- setup :set_response
41
42
  setup :setup_new_user
42
43
 
43
44
  def set_controller
44
45
  @controller = MockController.new
45
46
  end
46
47
 
47
- def set_response
48
- @response = MockResponse.new(self)
49
- end
50
-
51
48
  def setup_new_user(options={})
52
49
  @user = User.new({
53
50
  :id => 1,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-02-27 00:00:00.000000000 Z
14
+ date: 2012-04-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activemodel
18
- requirement: &70290445717740 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,15 @@ dependencies:
23
23
  version: '3.0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70290445717740
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '3.0'
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: actionpack
29
- requirement: &70290445716540 !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
30
35
  none: false
31
36
  requirements:
32
37
  - - ~>
@@ -34,7 +39,12 @@ dependencies:
34
39
  version: '3.0'
35
40
  type: :runtime
36
41
  prerelease: false
37
- version_requirements: *70290445716540
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
38
48
  description: Forms made easy!
39
49
  email: contact@plataformatec.com.br
40
50
  executables: []
@@ -109,6 +119,7 @@ files:
109
119
  - test/form_builder/error_notification_test.rb
110
120
  - test/form_builder/error_test.rb
111
121
  - test/form_builder/general_test.rb
122
+ - test/form_builder/general_test.rb.orig
112
123
  - test/form_builder/hint_test.rb
113
124
  - test/form_builder/input_field_test.rb
114
125
  - test/form_builder/label_test.rb
@@ -135,10 +146,9 @@ files:
135
146
  - test/support/discovery_inputs.rb
136
147
  - test/support/misc_helpers.rb
137
148
  - test/support/mock_controller.rb
138
- - test/support/mock_response.rb
139
149
  - test/support/models.rb
140
150
  - test/test_helper.rb
141
- homepage: http://github.com/plataformatec/simple_form
151
+ homepage: https://github.com/plataformatec/simple_form
142
152
  licenses: []
143
153
  post_install_message:
144
154
  rdoc_options: []
@@ -158,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
168
  version: '0'
159
169
  requirements: []
160
170
  rubyforge_project: simple_form
161
- rubygems_version: 1.8.11
171
+ rubygems_version: 1.8.23
162
172
  signing_key:
163
173
  specification_version: 3
164
174
  summary: Forms made easy!
@@ -171,6 +181,7 @@ test_files:
171
181
  - test/form_builder/error_notification_test.rb
172
182
  - test/form_builder/error_test.rb
173
183
  - test/form_builder/general_test.rb
184
+ - test/form_builder/general_test.rb.orig
174
185
  - test/form_builder/hint_test.rb
175
186
  - test/form_builder/input_field_test.rb
176
187
  - test/form_builder/label_test.rb
@@ -197,6 +208,5 @@ test_files:
197
208
  - test/support/discovery_inputs.rb
198
209
  - test/support/misc_helpers.rb
199
210
  - test/support/mock_controller.rb
200
- - test/support/mock_response.rb
201
211
  - test/support/models.rb
202
212
  - test/test_helper.rb
@@ -1,14 +0,0 @@
1
- class MockResponse
2
-
3
- def initialize(test_case)
4
- @test_case = test_case
5
- end
6
-
7
- def content_type
8
- 'text/html'
9
- end
10
-
11
- def body
12
- @test_case.send :output_buffer
13
- end
14
- end