administrate-field-jsontable 0.0.1 → 0.1.0

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.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +7 -0
  3. data/.rubocop.yml +96 -0
  4. data/Gemfile +9 -1
  5. data/Gemfile.lock +153 -118
  6. data/LICENSE.md +1 -1
  7. data/README.md +11 -23
  8. data/Rakefile +11 -0
  9. data/administrate-field-jsontable.gemspec +8 -6
  10. data/app/views/fields/jsontable/_index.html.erb +18 -0
  11. data/app/views/fields/jsontable/_json_table_field.html.erb +30 -0
  12. data/app/views/fields/jsontable/_show.html.erb +6 -33
  13. data/lib/administrate/field/jsontable.rb +2 -0
  14. data/spec/example_app/app/assets/config/manifest.js +2 -0
  15. data/spec/example_app/app/assets/javascripts/application.js +15 -0
  16. data/spec/example_app/app/assets/stylesheets/application.css +15 -0
  17. data/spec/example_app/app/controllers/application_controller.rb +7 -0
  18. data/spec/example_app/app/models/application_record.rb +5 -0
  19. data/spec/example_app/app/views/layouts/application.html.erb +31 -0
  20. data/spec/example_app/app/views/pages/.keep +0 -0
  21. data/spec/example_app/config.ru +6 -0
  22. data/spec/example_app/config/application.rb +39 -0
  23. data/spec/example_app/config/boot.rb +4 -0
  24. data/spec/example_app/config/database.yml +11 -0
  25. data/spec/example_app/config/environment.rb +7 -0
  26. data/spec/example_app/config/environments/development.rb +39 -0
  27. data/spec/example_app/config/environments/production.rb +78 -0
  28. data/spec/example_app/config/environments/staging.rb +3 -0
  29. data/spec/example_app/config/environments/test.rb +43 -0
  30. data/spec/example_app/config/initializers/assets.rb +13 -0
  31. data/spec/example_app/config/initializers/backtrace_silencers.rb +8 -0
  32. data/spec/example_app/config/initializers/cookies_serializer.rb +5 -0
  33. data/spec/example_app/config/initializers/disable_xml_params.rb +5 -0
  34. data/spec/example_app/config/initializers/errors.rb +20 -0
  35. data/spec/example_app/config/initializers/filter_parameter_logging.rb +6 -0
  36. data/spec/example_app/config/initializers/inflections.rb +18 -0
  37. data/spec/example_app/config/initializers/json_encoding.rb +3 -0
  38. data/spec/example_app/config/initializers/mime_types.rb +5 -0
  39. data/spec/example_app/config/initializers/session_store.rb +5 -0
  40. data/spec/example_app/config/initializers/wrap_parameters.rb +16 -0
  41. data/spec/example_app/config/routes.rb +4 -0
  42. data/spec/example_app/config/secrets.yml +15 -0
  43. data/spec/example_app/db/schema.rb +18 -0
  44. data/spec/example_app/db/seeds.rb +8 -0
  45. data/spec/example_app/public/robots.txt +5 -0
  46. data/spec/fixtures/jsontable/array_contains_hash.html +1 -0
  47. data/spec/fixtures/jsontable/hash_contains_array.html +31 -0
  48. data/spec/fixtures/jsontable/pure_hash.html +58 -0
  49. data/spec/lib/administrate/field/jsontable_index_spec.rb +95 -0
  50. data/spec/lib/administrate/field/jsontable_show_spec.rb +95 -0
  51. data/spec/lib/administrate/field/jsontable_spec.rb +16 -5
  52. data/spec/rails_helper.rb +6 -0
  53. data/spec/support/read_fixture.rb +7 -0
  54. metadata +93 -17
@@ -1,14 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'administrate/field/jsontable'
2
4
 
3
5
  describe Administrate::Field::Jsontable do
4
6
  describe '#to_partial_path' do
5
7
  it 'returns a partial based on the page being rendered' do
6
- page = :show
7
- field = Administrate::Field::Jsontable.new(:status, 'status', page)
8
-
9
- path = field.to_partial_path
8
+ assert_partial_path(page: :show)
9
+ end
10
10
 
11
- expect(path).to eq("/fields/jsontable/#{page}")
11
+ it 'returns a partial for index page' do
12
+ assert_partial_path(page: :index)
12
13
  end
13
14
  end
15
+
16
+ private
17
+
18
+ def assert_partial_path(page:)
19
+ field = Administrate::Field::Jsontable.new(:status, 'status', page)
20
+
21
+ path = field.to_partial_path
22
+
23
+ expect(path).to eq("/fields/jsontable/#{page}")
24
+ end
14
25
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV['RAILS_ENV'] = 'test'
4
+
5
+ require File.expand_path('../spec/example_app/config/environment', __dir__)
6
+ require 'rspec/rails'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReadFixture
4
+ def read_fixture(filename)
5
+ IO.read(File.expand_path("../../fixtures/jsontable/#{filename}", __FILE__))
6
+ end
7
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate-field-jsontable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Adrian Rangel
7
8
  - Enrique Barragan
8
- - Esteban Arocha
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-25 00:00:00.000000000 Z
12
+ date: 2020-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: administrate
@@ -32,9 +32,6 @@ dependencies:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '4.2'
35
- - - "<"
36
- - !ruby/object:Gem::Version
37
- version: '5.1'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,30 +39,71 @@ dependencies:
42
39
  - - ">="
43
40
  - !ruby/object:Gem::Version
44
41
  version: '4.2'
45
- - - "<"
46
- - !ruby/object:Gem::Version
47
- version: '5.1'
48
42
  description: JSON to table field plugin for Administrate
49
43
  email:
50
- - enrique@disruptiveangels.com
51
- - esteban@disruptiveangels.com
44
+ - adrian@valiot.io
45
+ - enrique@valiot.io
52
46
  executables: []
53
47
  extensions: []
54
48
  extra_rdoc_files: []
55
49
  files:
50
+ - ".gitignore"
51
+ - ".rubocop.yml"
56
52
  - Gemfile
57
53
  - Gemfile.lock
58
54
  - LICENSE.md
59
55
  - README.md
56
+ - Rakefile
60
57
  - administrate-field-jsontable.gemspec
58
+ - app/views/fields/jsontable/_index.html.erb
59
+ - app/views/fields/jsontable/_json_table_field.html.erb
61
60
  - app/views/fields/jsontable/_show.html.erb
62
61
  - lib/administrate/field/jsontable.rb
62
+ - spec/example_app/app/assets/config/manifest.js
63
+ - spec/example_app/app/assets/javascripts/application.js
64
+ - spec/example_app/app/assets/stylesheets/application.css
65
+ - spec/example_app/app/controllers/application_controller.rb
66
+ - spec/example_app/app/models/application_record.rb
67
+ - spec/example_app/app/views/layouts/application.html.erb
68
+ - spec/example_app/app/views/pages/.keep
69
+ - spec/example_app/config.ru
70
+ - spec/example_app/config/application.rb
71
+ - spec/example_app/config/boot.rb
72
+ - spec/example_app/config/database.yml
73
+ - spec/example_app/config/environment.rb
74
+ - spec/example_app/config/environments/development.rb
75
+ - spec/example_app/config/environments/production.rb
76
+ - spec/example_app/config/environments/staging.rb
77
+ - spec/example_app/config/environments/test.rb
78
+ - spec/example_app/config/initializers/assets.rb
79
+ - spec/example_app/config/initializers/backtrace_silencers.rb
80
+ - spec/example_app/config/initializers/cookies_serializer.rb
81
+ - spec/example_app/config/initializers/disable_xml_params.rb
82
+ - spec/example_app/config/initializers/errors.rb
83
+ - spec/example_app/config/initializers/filter_parameter_logging.rb
84
+ - spec/example_app/config/initializers/inflections.rb
85
+ - spec/example_app/config/initializers/json_encoding.rb
86
+ - spec/example_app/config/initializers/mime_types.rb
87
+ - spec/example_app/config/initializers/session_store.rb
88
+ - spec/example_app/config/initializers/wrap_parameters.rb
89
+ - spec/example_app/config/routes.rb
90
+ - spec/example_app/config/secrets.yml
91
+ - spec/example_app/db/schema.rb
92
+ - spec/example_app/db/seeds.rb
93
+ - spec/example_app/public/robots.txt
94
+ - spec/fixtures/jsontable/array_contains_hash.html
95
+ - spec/fixtures/jsontable/hash_contains_array.html
96
+ - spec/fixtures/jsontable/pure_hash.html
97
+ - spec/lib/administrate/field/jsontable_index_spec.rb
98
+ - spec/lib/administrate/field/jsontable_show_spec.rb
63
99
  - spec/lib/administrate/field/jsontable_spec.rb
64
- homepage: https://github.com/DisruptiveAngels/administrate-field-jsontable
100
+ - spec/rails_helper.rb
101
+ - spec/support/read_fixture.rb
102
+ homepage: https://github.com/Valiot/administrate-field-jsontable
65
103
  licenses:
66
104
  - MIT
67
105
  metadata: {}
68
- post_install_message:
106
+ post_install_message:
69
107
  rdoc_options: []
70
108
  require_paths:
71
109
  - lib
@@ -80,10 +118,48 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
118
  - !ruby/object:Gem::Version
81
119
  version: '0'
82
120
  requirements: []
83
- rubyforge_project:
84
- rubygems_version: 2.6.12
85
- signing_key:
121
+ rubygems_version: 3.1.2
122
+ signing_key:
86
123
  specification_version: 4
87
124
  summary: JSON to table field plugin for Administrate
88
125
  test_files:
126
+ - spec/example_app/app/assets/config/manifest.js
127
+ - spec/example_app/app/assets/javascripts/application.js
128
+ - spec/example_app/app/assets/stylesheets/application.css
129
+ - spec/example_app/app/controllers/application_controller.rb
130
+ - spec/example_app/app/models/application_record.rb
131
+ - spec/example_app/app/views/layouts/application.html.erb
132
+ - spec/example_app/app/views/pages/.keep
133
+ - spec/example_app/config.ru
134
+ - spec/example_app/config/application.rb
135
+ - spec/example_app/config/boot.rb
136
+ - spec/example_app/config/database.yml
137
+ - spec/example_app/config/environment.rb
138
+ - spec/example_app/config/environments/development.rb
139
+ - spec/example_app/config/environments/production.rb
140
+ - spec/example_app/config/environments/staging.rb
141
+ - spec/example_app/config/environments/test.rb
142
+ - spec/example_app/config/initializers/assets.rb
143
+ - spec/example_app/config/initializers/backtrace_silencers.rb
144
+ - spec/example_app/config/initializers/cookies_serializer.rb
145
+ - spec/example_app/config/initializers/disable_xml_params.rb
146
+ - spec/example_app/config/initializers/errors.rb
147
+ - spec/example_app/config/initializers/filter_parameter_logging.rb
148
+ - spec/example_app/config/initializers/inflections.rb
149
+ - spec/example_app/config/initializers/json_encoding.rb
150
+ - spec/example_app/config/initializers/mime_types.rb
151
+ - spec/example_app/config/initializers/session_store.rb
152
+ - spec/example_app/config/initializers/wrap_parameters.rb
153
+ - spec/example_app/config/routes.rb
154
+ - spec/example_app/config/secrets.yml
155
+ - spec/example_app/db/schema.rb
156
+ - spec/example_app/db/seeds.rb
157
+ - spec/example_app/public/robots.txt
158
+ - spec/fixtures/jsontable/array_contains_hash.html
159
+ - spec/fixtures/jsontable/hash_contains_array.html
160
+ - spec/fixtures/jsontable/pure_hash.html
161
+ - spec/lib/administrate/field/jsontable_index_spec.rb
162
+ - spec/lib/administrate/field/jsontable_show_spec.rb
89
163
  - spec/lib/administrate/field/jsontable_spec.rb
164
+ - spec/rails_helper.rb
165
+ - spec/support/read_fixture.rb