simple_form_localized_input 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8e487c8865a0da9889dd1e0f37dd5eed45979726
4
- data.tar.gz: 54be9b9e65b04e318ebe3ff5141b2d85018e36d8
2
+ SHA256:
3
+ metadata.gz: 7dcd4358779824eb3e061f195947f4ff0d8b7f73136e5f28cc62457b99eb747f
4
+ data.tar.gz: 5630f4c9fe0414da3b4784440235293bf359580b2768ddeff6dc06853d3b089a
5
5
  SHA512:
6
- metadata.gz: a76f09f7577850e16b33880de5f6337dddcc1ce472552404a51bd487ade7b1b9036136b4d518bd495ee6bb90c797cdf6368b98cc566dd9057ac9fda5a38943e3
7
- data.tar.gz: 7fc3780297e575bc5dbba7767f18d6ccfcbc3f380b8146daed70a0c8de804c2467692a97d9a8a4f5a313741df505f4d052f7e17d289c61b3945438886cb38d81
6
+ metadata.gz: 9df42662729dcb46423012022398ecb64f03691183c75bbc7de2645b5f5d52689cce9deda03d9321d59ab809b045d4c797047f3dad2c730bbeab2debc67fc8db
7
+ data.tar.gz: 667cbd30645a52c033ee40e9d068375696a9ff8b04b399144d1e44a5f113df221c0d309644c6d48b6e87af28a54b7eb296dfedc7d8a328c60badeb3c8521f70c
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ language: ruby
2
+ cache: bundler
3
+ script: 'bundle exec rake'
4
+ rvm:
5
+ - 2.5.0
6
+ services:
7
+ - mongodb
8
+
9
+ notifications:
10
+ email:
11
+ recipients:
12
+ - tomas.celizna@gmail.com
13
+ on_failure: change
14
+ on_success: never
15
+
16
+ matrix:
17
+ include:
18
+ - rvm: 2.3.3
19
+ env: MONGOID_VERSION=5
20
+ - rvm: 2.3.3
21
+ env: MONGOID_VERSION=6
22
+ - rvm: 2.5.0
23
+ env: MONGOID_VERSION=7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.5
4
+
5
+ * add basic test
6
+
3
7
  ## 1.0.4
4
8
 
5
9
  * display errors below all locales for a field
data/Gemfile CHANGED
@@ -2,3 +2,10 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in simple_form_localized_input.gemspec
4
4
  gemspec
5
+
6
+ case version = ENV['MONGOID_VERSION'] || '~> 7.0'
7
+ when /7/ then gem 'mongoid', '~> 7.0'
8
+ when /6/ then gem 'mongoid', '~> 6.0'
9
+ when /5/ then gem 'mongoid', '~> 5.1'
10
+ else gem 'mongoid', version
11
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Simple Form Localized Input
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/simple_form_localized_input.svg)](http://badge.fury.io/rb/simple_form_localized_input)
3
+ [![Build Status](https://travis-ci.org/tomasc/simple_form_localized_input.svg)](https://travis-ci.org/tomasc/simple_form_localized_input) [![Gem Version](https://badge.fury.io/rb/simple_form_localized_input.svg)](http://badge.fury.io/rb/simple_form_localized_input) [![Coverage Status](https://img.shields.io/coveralls/tomasc/simple_form_localized_input.svg)](https://coveralls.io/r/tomasc/simple_form_localized_input)
4
4
 
5
5
  [Simple Form](https://github.com/plataformatec/simple_form) custom input which renders a field for multiple locales in one form. Designed to be used with [Mongoid](https://github.com/mongoid/mongoid).
6
6
 
@@ -1,3 +1,3 @@
1
1
  module SimpleFormLocalizedInput
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
@@ -19,8 +19,10 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'simple_form', '>= 3.0.2'
22
- spec.add_dependency 'mongoid', '>= 4.0'
22
+ spec.add_dependency 'mongoid', '>= 5.1', '<= 7'
23
+ spec.add_dependency "rails", '>= 4.2'
23
24
 
24
- spec.add_development_dependency 'bundler'
25
- spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency "bundler", "~> 1.16"
26
+ spec.add_development_dependency "minitest", "~> 5.0"
27
+ spec.add_development_dependency "rake", "~> 10.0"
26
28
  end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ describe SimpleFormLocalizedInput::FormBuilder do
4
+ let(:form) {
5
+ simple_form_for(@user, url: '', html: { class: "foo" }) do |form|
6
+ form.localized_input :title
7
+ end
8
+ }
9
+
10
+ it { form.must_include "<div class=\"input string optional user_title_translations_en\"><label class=\"string optional\" for=\"user_title_translations_en\">Title (en)</label><input class=\"string optional\" type=\"text\" name=\"user[title_translations][en]\" id=\"user_title_translations_en\" /></div>" }
11
+
12
+ it { form.must_include "<div class=\"input string optional user_title_translations_cs\"><label class=\"string optional\" for=\"user_title_translations_cs\">Title (cs)</label><input class=\"string optional\" type=\"text\" name=\"user[title_translations][cs]\" id=\"user_title_translations_cs\" /></div>" }
13
+ end
File without changes
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+ class MockController
3
+ attr_writer :action_name
4
+
5
+ def _routes
6
+ self
7
+ end
8
+
9
+ def action_name
10
+ defined?(@action_name) ? @action_name : "edit"
11
+ end
12
+
13
+ def url_for(*)
14
+ "http://example.com"
15
+ end
16
+
17
+ def url_options
18
+ {}
19
+ end
20
+
21
+ def polymorphic_mappings(*); {}; end
22
+
23
+ def hash_for_user_path(*); end
24
+
25
+ def hash_for_validating_user_path(*); end
26
+
27
+ def hash_for_other_validating_user_path(*); end
28
+
29
+ def hash_for_users_path(*); end
30
+ end
@@ -0,0 +1,5 @@
1
+ class User
2
+ include Mongoid::Document
3
+
4
+ field :title, type: String, localize: true
5
+ end
@@ -0,0 +1,43 @@
1
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
2
+ require "mongoid"
3
+ require "simple_form_localized_input"
4
+
5
+ require "bundler/setup"
6
+ require "minitest"
7
+ require "minitest/autorun"
8
+ require "minitest/spec"
9
+
10
+ require "action_view"
11
+
12
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
13
+
14
+ ::I18n.available_locales = %i(en cs)
15
+
16
+ class MiniTest::Spec
17
+ include ActionView::Helpers::FormHelper
18
+ include SimpleForm::ActionViewExtensions::FormHelper
19
+
20
+ before { set_controller }
21
+ before { setup_users }
22
+
23
+ attr_accessor :output_buffer
24
+ attr_accessor :controller
25
+
26
+ def set_controller
27
+ @controller = MockController.new
28
+ end
29
+
30
+ def setup_users(extra_attributes = {})
31
+ @user = User.new(extra_attributes)
32
+ end
33
+
34
+ def protect_against_forgery?
35
+ false
36
+ end
37
+
38
+ def user_path(*args)
39
+ '/users'
40
+ end
41
+
42
+ alias :users_path :user_path
43
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_localized_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-25 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_form
@@ -30,28 +30,62 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
33
+ version: '5.1'
34
+ - - "<="
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
- version: '4.0'
43
+ version: '5.1'
44
+ - - "<="
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
41
47
  - !ruby/object:Gem::Dependency
42
- name: bundler
48
+ name: rails
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
53
+ version: '4.2'
54
+ type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: '4.2'
61
+ - !ruby/object:Gem::Dependency
62
+ name: bundler
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.16'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.16'
75
+ - !ruby/object:Gem::Dependency
76
+ name: minitest
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '5.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '5.0'
55
89
  - !ruby/object:Gem::Dependency
56
90
  name: rake
57
91
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +109,7 @@ extensions: []
75
109
  extra_rdoc_files: []
76
110
  files:
77
111
  - ".gitignore"
112
+ - ".travis.yml"
78
113
  - CHANGELOG.md
79
114
  - Gemfile
80
115
  - LICENSE
@@ -84,6 +119,11 @@ files:
84
119
  - lib/simple_form_localized_input/form_builder.rb
85
120
  - lib/simple_form_localized_input/version.rb
86
121
  - simple_form_localized_input.gemspec
122
+ - test/simple_form_localized_input/form_builder_test.rb
123
+ - test/support/.gitkeep
124
+ - test/support/mock_controller.rb
125
+ - test/support/user.rb
126
+ - test/test_helper.rb
87
127
  homepage: https://github.com/tomasc/simple_form_localized_input
88
128
  licenses:
89
129
  - MIT
@@ -104,8 +144,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
144
  version: '0'
105
145
  requirements: []
106
146
  rubyforge_project:
107
- rubygems_version: 2.5.2
147
+ rubygems_version: 2.7.3
108
148
  signing_key:
109
149
  specification_version: 4
110
150
  summary: Custom input for Simple Form that renders Mongoid fields for multiple locales.
111
- test_files: []
151
+ test_files:
152
+ - test/simple_form_localized_input/form_builder_test.rb
153
+ - test/support/.gitkeep
154
+ - test/support/mock_controller.rb
155
+ - test/support/user.rb
156
+ - test/test_helper.rb