bootstrap_form 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ require 'test_helper'
2
+
3
+ class SpecialFormClassModelsTest < ActionView::TestCase
4
+ include BootstrapForm::Helper
5
+
6
+ test "Anonymous models are supported for form builder" do
7
+ user_klass = Class.new(User)
8
+ def user_klass.model_name
9
+ ActiveModel::Name.new(User)
10
+ end
11
+
12
+ @user = user_klass.new(email: 'steve@example.com', password: 'secret', comments: 'my comment')
13
+ @builder = BootstrapForm::FormBuilder.new(:user, @user, self, {})
14
+ @horizontal_builder = BootstrapForm::FormBuilder.new(:user, @user, self, {layout: :horizontal, label_col: "col-sm-2", control_col: "col-sm-10"})
15
+ I18n.backend.store_translations(:en, {activerecord: {help: {user: {password: "A good password should be at least six characters long"}}}})
16
+
17
+ expected = %{<div class="form-group"><label class="control-label" for="user_misc">Misc</label><input class="form-control" id="user_misc" name="user[misc]" type="date" /></div>}
18
+ assert_equal expected, @builder.date_field(:misc)
19
+ end
20
+
21
+
22
+ test "Nil models are supported for form builder" do
23
+ @user = nil
24
+ @builder = BootstrapForm::FormBuilder.new(:user, @user, self, {})
25
+ @horizontal_builder = BootstrapForm::FormBuilder.new(:user, @user, self, {layout: :horizontal, label_col: "col-sm-2", control_col: "col-sm-10"})
26
+ I18n.backend.store_translations(:en, {activerecord: {help: {user: {password: "A good password should be at least six characters long"}}}})
27
+
28
+ expected = %{<div class="form-group"><label class="control-label" for="user_misc">Misc</label><input class="form-control" id="user_misc" name="user[misc]" type="date" /></div>}
29
+ assert_equal expected, @builder.date_field(:misc)
30
+ end
31
+
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Potenza
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-12 00:00:00.000000000 Z
12
+ date: 2016-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mime-types
@@ -159,6 +159,7 @@ files:
159
159
  - test/dummy/test/models/address_test.rb
160
160
  - test/dummy/test/models/user_test.rb
161
161
  - test/dummy/test/test_helper.rb
162
+ - test/special_form_class_models_test.rb
162
163
  - test/test_helper.rb
163
164
  homepage: http://github.com/bootstrap-ruby/rails-bootstrap-forms
164
165
  licenses: []
@@ -243,4 +244,5 @@ test_files:
243
244
  - test/dummy/test/models/address_test.rb
244
245
  - test/dummy/test/models/user_test.rb
245
246
  - test/dummy/test/test_helper.rb
247
+ - test/special_form_class_models_test.rb
246
248
  - test/test_helper.rb