rails_admin_globalize_field 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/app/views/rails_admin/main/_form_globalize_tabs.html.haml +1 -1
  4. data/lib/rails_admin_globalize_field.rb +3 -12
  5. data/lib/rails_admin_globalize_field/version.rb +1 -1
  6. data/rails_admin_globalize_field.gemspec +10 -4
  7. data/spec/dummy/Gemfile +9 -0
  8. data/spec/dummy/README.rdoc +28 -0
  9. data/spec/dummy/Rakefile +6 -0
  10. data/spec/dummy/app/assets/images/.keep +0 -0
  11. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  12. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  13. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  14. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  15. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  16. data/spec/dummy/app/mailers/.keep +0 -0
  17. data/spec/dummy/app/models/.keep +0 -0
  18. data/spec/dummy/app/models/admin/note.rb +6 -0
  19. data/spec/dummy/app/models/concerns/.keep +0 -0
  20. data/spec/dummy/app/models/page.rb +4 -0
  21. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/spec/dummy/bin/bundle +3 -0
  23. data/spec/dummy/bin/rails +4 -0
  24. data/spec/dummy/bin/rake +4 -0
  25. data/spec/dummy/bin/setup +29 -0
  26. data/spec/dummy/config.ru +4 -0
  27. data/spec/dummy/config/application.rb +33 -0
  28. data/spec/dummy/config/boot.rb +5 -0
  29. data/spec/dummy/config/database.yml +25 -0
  30. data/spec/dummy/config/environment.rb +5 -0
  31. data/spec/dummy/config/environments/development.rb +41 -0
  32. data/spec/dummy/config/environments/production.rb +79 -0
  33. data/spec/dummy/config/environments/test.rb +42 -0
  34. data/spec/dummy/config/initializers/assets.rb +11 -0
  35. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  37. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  38. data/spec/dummy/config/initializers/inflections.rb +16 -0
  39. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  40. data/spec/dummy/config/initializers/rails_admin.rb +65 -0
  41. data/spec/dummy/config/initializers/session_store.rb +3 -0
  42. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  43. data/spec/dummy/config/locales/en.yml +23 -0
  44. data/spec/dummy/config/routes.rb +3 -0
  45. data/spec/dummy/config/secrets.yml +22 -0
  46. data/spec/dummy/db/schema.rb +29 -0
  47. data/spec/dummy/lib/assets/.keep +0 -0
  48. data/spec/dummy/log/.keep +0 -0
  49. data/spec/dummy/public/404.html +67 -0
  50. data/spec/dummy/public/422.html +67 -0
  51. data/spec/dummy/public/500.html +66 -0
  52. data/spec/dummy/public/favicon.ico +0 -0
  53. data/spec/field_spec.rb +55 -0
  54. data/spec/spec_helper.rb +29 -0
  55. metadata +196 -4
File without changes
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+ require 'pry'
3
+
4
+ RSpec.describe RailsAdmin::Config::Fields::Types::GlobalizeTabs do
5
+ it 'renders all available locales as tabs' do
6
+ visit '/page/new'
7
+ expect(find('.globalize_tabs_type').find('.nav-tabs')).to have_content 'en cz ru'
8
+ end
9
+
10
+ context 'when translated page exists' do
11
+ let!(:translated_page) {
12
+ Page.create!(
13
+ slug: '2001',
14
+ image: 'poster.png',
15
+ title: '2001: Space odyssey',
16
+ content: '<p>Visionary</p>'
17
+ )
18
+ }
19
+
20
+ def perform
21
+ visit "/page/#{translated_page.id}/edit"
22
+ end
23
+
24
+ describe 'localized data in correct tab' do
25
+ it 'renders the default locale' do
26
+ perform
27
+ within(".localized-pane-en-page-#{translated_page.id}") do
28
+ expect(find_field('Title').value).to eq('2001: Space odyssey')
29
+ expect(find_field('Content')).to have_content('<p>Visionary</p>')
30
+ end
31
+ end
32
+
33
+ it 'renders cz locale' do
34
+ Globalize.with_locale(:cz) do
35
+ translated_page.title = '2001: Vesmírná odysea'
36
+ translated_page.content = '<p>Vizionář</p>'
37
+ translated_page.save!
38
+ end
39
+
40
+ perform
41
+
42
+ within(".localized-pane-cz-page-#{translated_page.id}") do
43
+ expect(find_field('Title').value).to eq('2001: Vesmírná odysea')
44
+ expect(find_field('Content')).to have_content('<p>Vizionář</p>')
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ it 'works correctly with namespaced models' do
51
+ note = Admin::Note.create(title: 'Fix bug with namespaces', image: 'urgent.png')
52
+ visit "/admin~note/#{note.id}/edit"
53
+ expect(page).to have_css(".localized-pane-en-admin-note-#{note.id}")
54
+ end
55
+ end
@@ -0,0 +1,29 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require File.expand_path('../dummy/config/environment', __FILE__)
4
+ require 'globalize'
5
+ require 'rails_admin_globalize_field'
6
+
7
+ require 'rspec/rails'
8
+ require 'capybara/poltergeist'
9
+
10
+ Capybara.javascript_driver = :poltergeist
11
+
12
+ RSpec.configure do |config|
13
+ config.disable_monkey_patching!
14
+ config.use_transactional_fixtures = true
15
+ config.order = 'random'
16
+ config.include Capybara::DSL
17
+
18
+ config.expect_with :rspec do |expectations|
19
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
20
+ end
21
+
22
+ # rspec-mock config
23
+ config.mock_with :rspec do |mocks|
24
+ # Prevents you from mocking or stubbing a method that does not exist on
25
+ # a real object. This is generally recommended, and will default to
26
+ # `true` in RSpec 4.
27
+ mocks.verify_partial_doubles = true
28
+ end
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_globalize_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Volozhanin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2015-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '4.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rails_admin
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +51,9 @@ dependencies:
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
47
53
  version: '4.0'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '5.0'
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +61,9 @@ dependencies:
52
61
  - - ">="
53
62
  - !ruby/object:Gem::Version
54
63
  version: '4.0'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '5.0'
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: bundler
57
69
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +92,90 @@ dependencies:
80
92
  - - ">="
81
93
  - !ruby/object:Gem::Version
82
94
  version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: pry
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: pry-byebug
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ - !ruby/object:Gem::Dependency
124
+ name: sqlite3
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: rspec-rails
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '3.0'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '3.0'
151
+ - !ruby/object:Gem::Dependency
152
+ name: capybara
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '2.4'
158
+ type: :development
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - "~>"
163
+ - !ruby/object:Gem::Version
164
+ version: '2.4'
165
+ - !ruby/object:Gem::Dependency
166
+ name: poltergeist
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: '1.5'
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - "~>"
177
+ - !ruby/object:Gem::Version
178
+ version: '1.5'
83
179
  description: Adds tabbed interface and custom field type for globalize translations
84
180
  to Rails_admin
85
181
  email:
@@ -100,6 +196,54 @@ files:
100
196
  - lib/rails_admin_globalize_field/engine.rb
101
197
  - lib/rails_admin_globalize_field/version.rb
102
198
  - rails_admin_globalize_field.gemspec
199
+ - spec/dummy/Gemfile
200
+ - spec/dummy/README.rdoc
201
+ - spec/dummy/Rakefile
202
+ - spec/dummy/app/assets/images/.keep
203
+ - spec/dummy/app/assets/javascripts/application.js
204
+ - spec/dummy/app/assets/stylesheets/application.css
205
+ - spec/dummy/app/controllers/application_controller.rb
206
+ - spec/dummy/app/controllers/concerns/.keep
207
+ - spec/dummy/app/helpers/application_helper.rb
208
+ - spec/dummy/app/mailers/.keep
209
+ - spec/dummy/app/models/.keep
210
+ - spec/dummy/app/models/admin/note.rb
211
+ - spec/dummy/app/models/concerns/.keep
212
+ - spec/dummy/app/models/page.rb
213
+ - spec/dummy/app/views/layouts/application.html.erb
214
+ - spec/dummy/bin/bundle
215
+ - spec/dummy/bin/rails
216
+ - spec/dummy/bin/rake
217
+ - spec/dummy/bin/setup
218
+ - spec/dummy/config.ru
219
+ - spec/dummy/config/application.rb
220
+ - spec/dummy/config/boot.rb
221
+ - spec/dummy/config/database.yml
222
+ - spec/dummy/config/environment.rb
223
+ - spec/dummy/config/environments/development.rb
224
+ - spec/dummy/config/environments/production.rb
225
+ - spec/dummy/config/environments/test.rb
226
+ - spec/dummy/config/initializers/assets.rb
227
+ - spec/dummy/config/initializers/backtrace_silencers.rb
228
+ - spec/dummy/config/initializers/cookies_serializer.rb
229
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
230
+ - spec/dummy/config/initializers/inflections.rb
231
+ - spec/dummy/config/initializers/mime_types.rb
232
+ - spec/dummy/config/initializers/rails_admin.rb
233
+ - spec/dummy/config/initializers/session_store.rb
234
+ - spec/dummy/config/initializers/wrap_parameters.rb
235
+ - spec/dummy/config/locales/en.yml
236
+ - spec/dummy/config/routes.rb
237
+ - spec/dummy/config/secrets.yml
238
+ - spec/dummy/db/schema.rb
239
+ - spec/dummy/lib/assets/.keep
240
+ - spec/dummy/log/.keep
241
+ - spec/dummy/public/404.html
242
+ - spec/dummy/public/422.html
243
+ - spec/dummy/public/500.html
244
+ - spec/dummy/public/favicon.ico
245
+ - spec/field_spec.rb
246
+ - spec/spec_helper.rb
103
247
  homepage: ''
104
248
  licenses:
105
249
  - MIT
@@ -120,9 +264,57 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
264
  version: '0'
121
265
  requirements: []
122
266
  rubyforge_project:
123
- rubygems_version: 2.2.2
267
+ rubygems_version: 2.4.5
124
268
  signing_key:
125
269
  specification_version: 4
126
270
  summary: Tabbed interface and custom field type for globalize translations for Rails_admin
127
- test_files: []
271
+ test_files:
272
+ - spec/dummy/Gemfile
273
+ - spec/dummy/README.rdoc
274
+ - spec/dummy/Rakefile
275
+ - spec/dummy/app/assets/images/.keep
276
+ - spec/dummy/app/assets/javascripts/application.js
277
+ - spec/dummy/app/assets/stylesheets/application.css
278
+ - spec/dummy/app/controllers/application_controller.rb
279
+ - spec/dummy/app/controllers/concerns/.keep
280
+ - spec/dummy/app/helpers/application_helper.rb
281
+ - spec/dummy/app/mailers/.keep
282
+ - spec/dummy/app/models/.keep
283
+ - spec/dummy/app/models/admin/note.rb
284
+ - spec/dummy/app/models/concerns/.keep
285
+ - spec/dummy/app/models/page.rb
286
+ - spec/dummy/app/views/layouts/application.html.erb
287
+ - spec/dummy/bin/bundle
288
+ - spec/dummy/bin/rails
289
+ - spec/dummy/bin/rake
290
+ - spec/dummy/bin/setup
291
+ - spec/dummy/config.ru
292
+ - spec/dummy/config/application.rb
293
+ - spec/dummy/config/boot.rb
294
+ - spec/dummy/config/database.yml
295
+ - spec/dummy/config/environment.rb
296
+ - spec/dummy/config/environments/development.rb
297
+ - spec/dummy/config/environments/production.rb
298
+ - spec/dummy/config/environments/test.rb
299
+ - spec/dummy/config/initializers/assets.rb
300
+ - spec/dummy/config/initializers/backtrace_silencers.rb
301
+ - spec/dummy/config/initializers/cookies_serializer.rb
302
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
303
+ - spec/dummy/config/initializers/inflections.rb
304
+ - spec/dummy/config/initializers/mime_types.rb
305
+ - spec/dummy/config/initializers/rails_admin.rb
306
+ - spec/dummy/config/initializers/session_store.rb
307
+ - spec/dummy/config/initializers/wrap_parameters.rb
308
+ - spec/dummy/config/locales/en.yml
309
+ - spec/dummy/config/routes.rb
310
+ - spec/dummy/config/secrets.yml
311
+ - spec/dummy/db/schema.rb
312
+ - spec/dummy/lib/assets/.keep
313
+ - spec/dummy/log/.keep
314
+ - spec/dummy/public/404.html
315
+ - spec/dummy/public/422.html
316
+ - spec/dummy/public/500.html
317
+ - spec/dummy/public/favicon.ico
318
+ - spec/field_spec.rb
319
+ - spec/spec_helper.rb
128
320
  has_rdoc: