rails_db_info 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 (76) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +34 -0
  4. data/app/assets/javascripts/rails_db_info/application.js +13 -0
  5. data/app/assets/javascripts/rails_db_info/tables.js +2 -0
  6. data/app/assets/stylesheets/rails_db_info/application.css +53 -0
  7. data/app/assets/stylesheets/rails_db_info/tables.css +4 -0
  8. data/app/controllers/rails_db_info/application_controller.rb +4 -0
  9. data/app/controllers/rails_db_info/tables_controller.rb +21 -0
  10. data/app/helpers/rails_db_info/application_helper.rb +19 -0
  11. data/app/helpers/rails_db_info/tables_helper.rb +4 -0
  12. data/app/views/layouts/rails_db_info/application.html.erb +16 -0
  13. data/app/views/rails_db_info/tables/_header.html.erb +14 -0
  14. data/app/views/rails_db_info/tables/entries.html.erb +20 -0
  15. data/app/views/rails_db_info/tables/index.html.erb +17 -0
  16. data/app/views/rails_db_info/tables/show.html.erb +18 -0
  17. data/config/routes.rb +10 -0
  18. data/lib/rails_db_info/engine.rb +5 -0
  19. data/lib/rails_db_info/table.rb +29 -0
  20. data/lib/rails_db_info/table_entries.rb +52 -0
  21. data/lib/rails_db_info/version.rb +3 -0
  22. data/lib/rails_db_info.rb +4 -0
  23. data/lib/tasks/rails_db_info_tasks.rake +4 -0
  24. data/test/controllers/rails_db_info/tables_controller_test.rb +9 -0
  25. data/test/dummy/README.rdoc +28 -0
  26. data/test/dummy/Rakefile +6 -0
  27. data/test/dummy/app/assets/javascripts/application.js +13 -0
  28. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  29. data/test/dummy/app/controllers/application_controller.rb +5 -0
  30. data/test/dummy/app/helpers/application_helper.rb +2 -0
  31. data/test/dummy/app/models/user.rb +2 -0
  32. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  33. data/test/dummy/bin/bundle +3 -0
  34. data/test/dummy/bin/rails +4 -0
  35. data/test/dummy/bin/rake +4 -0
  36. data/test/dummy/config/application.rb +23 -0
  37. data/test/dummy/config/boot.rb +5 -0
  38. data/test/dummy/config/database.yml +40 -0
  39. data/test/dummy/config/environment.rb +5 -0
  40. data/test/dummy/config/environments/development.rb +29 -0
  41. data/test/dummy/config/environments/production.rb +80 -0
  42. data/test/dummy/config/environments/test.rb +36 -0
  43. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  44. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  45. data/test/dummy/config/initializers/inflections.rb +16 -0
  46. data/test/dummy/config/initializers/mime_types.rb +5 -0
  47. data/test/dummy/config/initializers/secret_token.rb +12 -0
  48. data/test/dummy/config/initializers/session_store.rb +3 -0
  49. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  50. data/test/dummy/config/locales/en.yml +23 -0
  51. data/test/dummy/config/routes.rb +3 -0
  52. data/test/dummy/config.ru +4 -0
  53. data/test/dummy/db/migrate/20130819203338_create_users.rb +12 -0
  54. data/test/dummy/db/schema.rb +25 -0
  55. data/test/dummy/db/test.sqlite3 +0 -0
  56. data/test/dummy/log/development.log +5 -0
  57. data/test/dummy/log/test.log +341 -0
  58. data/test/dummy/public/404.html +58 -0
  59. data/test/dummy/public/422.html +58 -0
  60. data/test/dummy/public/500.html +57 -0
  61. data/test/dummy/public/favicon.ico +0 -0
  62. data/test/dummy/test/fixtures/users.yml +13 -0
  63. data/test/dummy/test/models/user_test.rb +7 -0
  64. data/test/dummy/tmp/cache/assets/test/sprockets/0ff3a9241bbf1c751ced680adfa90b59 +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sprockets/1feb7eec1529672092299032ef2d6325 +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sprockets/2dc95e0e7e3281df7eb8e26fbb8a3a59 +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sprockets/72881d4d0eb1a7d61ba5420798add236 +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sprockets/ab1417852e512b0f0f50fbdc19d1f890 +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sprockets/b1a87f7961214599041bb9b30c8e398e +0 -0
  70. data/test/dummy/tmp/cache/assets/test/sprockets/bf0ff79f1edd27152fd4681650468a43 +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sprockets/c903f846849a6d4c555eaf82468a7e6e +0 -0
  72. data/test/helpers/rails_db_info/tables_helper_test.rb +6 -0
  73. data/test/integration/navigation_test.rb +71 -0
  74. data/test/rails_db_info_test.rb +7 -0
  75. data/test/test_helper.rb +15 -0
  76. metadata +225 -0
@@ -0,0 +1,71 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ # fixtures :all
5
+
6
+ test "I see list of tables when I visit rails_db_info dashboard" do
7
+ get '/rails/info/db'
8
+
9
+ assert assigns(:tables)
10
+ assert_select 'h1', 'Tables'
11
+ %w(schema_migrations users).each do |table|
12
+ assert_select 'table.tables tr td', table
13
+ end
14
+ end
15
+
16
+ test 'I see table column details when I visit table page' do
17
+ get '/rails/info/db/tables/users'
18
+
19
+ assert assigns(:table)
20
+ assert_select 'h1', /users/
21
+ User.columns.each do |col|
22
+ assert_select "table tr td.name", col.name
23
+ assert_select "table tr td.sql_type", col.sql_type
24
+ end
25
+ end
26
+
27
+ test 'I see table title, column names and values when I visit show table entries page' do
28
+ User.create([
29
+ { :username => 'vlado', :email => 'vlado@cingel.hr', :age => 33, :admin => true },
30
+ { :username => 'ana', :email => 'ana@cingel.hr', :age => 34, :admin => false }
31
+ ])
32
+
33
+ get '/rails/info/db/tables/users/entries'
34
+
35
+ assert assigns(:table)
36
+ assert_select 'h1', /users/
37
+ User.column_names.each do |col|
38
+ assert_select 'table thead tr:first-child th', col
39
+ end
40
+ assert_equal 2, css_select('table tbody tr').size
41
+ assert_select 'table tbody tr:first-child td.username', 'vlado'
42
+ assert_select 'table tbody tr:last-child td.username', 'ana'
43
+ end
44
+
45
+ test 'I can paginate through entires' do
46
+ 25.times do |i|
47
+ User.create(:username => "vlado#{i+1}", :email => "vlado#{i+1}@cingel.hr", :age => 33, :admin => true)
48
+ end
49
+
50
+ get '/rails/info/db/tables/users/entries'
51
+ assert_equal 10, css_select('table tbody tr').size
52
+ assert_select 'table tbody tr:first-child td.username', 'vlado1'
53
+ assert_select 'table tbody tr:last-child td.username', 'vlado10'
54
+
55
+ get '/rails/info/db/tables/users/entries?page=1'
56
+ assert_equal 10, css_select('table tbody tr').size
57
+ assert_select 'table tbody tr:first-child td.username', 'vlado1'
58
+ assert_select 'table tbody tr:last-child td.username', 'vlado10'
59
+
60
+ get '/rails/info/db/tables/users/entries?page=2'
61
+ assert_equal 10, css_select('table tbody tr').size
62
+ assert_select 'table tbody tr:first-child td.username', 'vlado11'
63
+ assert_select 'table tbody tr:last-child td.username', 'vlado20'
64
+
65
+ get '/rails/info/db/tables/users/entries?page=3'
66
+ assert_equal 5, css_select('table tbody tr').size
67
+ assert_select 'table tbody tr:first-child td.username', 'vlado21'
68
+ assert_select 'table tbody tr:last-child td.username', 'vlado25'
69
+ end
70
+ end
71
+
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class RailsDbInfoTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, RailsDbInfo
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
metadata ADDED
@@ -0,0 +1,225 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_db_info
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vlado Cingel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: mysql2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pg
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: RailsDbInfo is a Rails engine that quickly shows the database info
70
+ email:
71
+ - vladocingel@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - app/assets/javascripts/rails_db_info/application.js
77
+ - app/assets/javascripts/rails_db_info/tables.js
78
+ - app/assets/stylesheets/rails_db_info/application.css
79
+ - app/assets/stylesheets/rails_db_info/tables.css
80
+ - app/controllers/rails_db_info/application_controller.rb
81
+ - app/controllers/rails_db_info/tables_controller.rb
82
+ - app/helpers/rails_db_info/application_helper.rb
83
+ - app/helpers/rails_db_info/tables_helper.rb
84
+ - app/views/layouts/rails_db_info/application.html.erb
85
+ - app/views/rails_db_info/tables/_header.html.erb
86
+ - app/views/rails_db_info/tables/entries.html.erb
87
+ - app/views/rails_db_info/tables/index.html.erb
88
+ - app/views/rails_db_info/tables/show.html.erb
89
+ - config/routes.rb
90
+ - lib/rails_db_info/engine.rb
91
+ - lib/rails_db_info/table.rb
92
+ - lib/rails_db_info/table_entries.rb
93
+ - lib/rails_db_info/version.rb
94
+ - lib/rails_db_info.rb
95
+ - lib/tasks/rails_db_info_tasks.rake
96
+ - MIT-LICENSE
97
+ - Rakefile
98
+ - test/controllers/rails_db_info/tables_controller_test.rb
99
+ - test/dummy/app/assets/javascripts/application.js
100
+ - test/dummy/app/assets/stylesheets/application.css
101
+ - test/dummy/app/controllers/application_controller.rb
102
+ - test/dummy/app/helpers/application_helper.rb
103
+ - test/dummy/app/models/user.rb
104
+ - test/dummy/app/views/layouts/application.html.erb
105
+ - test/dummy/bin/bundle
106
+ - test/dummy/bin/rails
107
+ - test/dummy/bin/rake
108
+ - test/dummy/config/application.rb
109
+ - test/dummy/config/boot.rb
110
+ - test/dummy/config/database.yml
111
+ - test/dummy/config/environment.rb
112
+ - test/dummy/config/environments/development.rb
113
+ - test/dummy/config/environments/production.rb
114
+ - test/dummy/config/environments/test.rb
115
+ - test/dummy/config/initializers/backtrace_silencers.rb
116
+ - test/dummy/config/initializers/filter_parameter_logging.rb
117
+ - test/dummy/config/initializers/inflections.rb
118
+ - test/dummy/config/initializers/mime_types.rb
119
+ - test/dummy/config/initializers/secret_token.rb
120
+ - test/dummy/config/initializers/session_store.rb
121
+ - test/dummy/config/initializers/wrap_parameters.rb
122
+ - test/dummy/config/locales/en.yml
123
+ - test/dummy/config/routes.rb
124
+ - test/dummy/config.ru
125
+ - test/dummy/db/migrate/20130819203338_create_users.rb
126
+ - test/dummy/db/schema.rb
127
+ - test/dummy/db/test.sqlite3
128
+ - test/dummy/log/development.log
129
+ - test/dummy/log/test.log
130
+ - test/dummy/public/404.html
131
+ - test/dummy/public/422.html
132
+ - test/dummy/public/500.html
133
+ - test/dummy/public/favicon.ico
134
+ - test/dummy/Rakefile
135
+ - test/dummy/README.rdoc
136
+ - test/dummy/test/fixtures/users.yml
137
+ - test/dummy/test/models/user_test.rb
138
+ - test/dummy/tmp/cache/assets/test/sprockets/0ff3a9241bbf1c751ced680adfa90b59
139
+ - test/dummy/tmp/cache/assets/test/sprockets/1feb7eec1529672092299032ef2d6325
140
+ - test/dummy/tmp/cache/assets/test/sprockets/2dc95e0e7e3281df7eb8e26fbb8a3a59
141
+ - test/dummy/tmp/cache/assets/test/sprockets/72881d4d0eb1a7d61ba5420798add236
142
+ - test/dummy/tmp/cache/assets/test/sprockets/ab1417852e512b0f0f50fbdc19d1f890
143
+ - test/dummy/tmp/cache/assets/test/sprockets/b1a87f7961214599041bb9b30c8e398e
144
+ - test/dummy/tmp/cache/assets/test/sprockets/bf0ff79f1edd27152fd4681650468a43
145
+ - test/dummy/tmp/cache/assets/test/sprockets/c903f846849a6d4c555eaf82468a7e6e
146
+ - test/helpers/rails_db_info/tables_helper_test.rb
147
+ - test/integration/navigation_test.rb
148
+ - test/rails_db_info_test.rb
149
+ - test/test_helper.rb
150
+ homepage: https://github.com/vlado/rails_db_info
151
+ licenses: []
152
+ metadata: {}
153
+ post_install_message:
154
+ rdoc_options: []
155
+ require_paths:
156
+ - lib
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ requirements: []
168
+ rubyforge_project:
169
+ rubygems_version: 2.0.3
170
+ signing_key:
171
+ specification_version: 4
172
+ summary: RailsDbInfo is a Rails engine that quickly shows the database info
173
+ test_files:
174
+ - test/controllers/rails_db_info/tables_controller_test.rb
175
+ - test/dummy/app/assets/javascripts/application.js
176
+ - test/dummy/app/assets/stylesheets/application.css
177
+ - test/dummy/app/controllers/application_controller.rb
178
+ - test/dummy/app/helpers/application_helper.rb
179
+ - test/dummy/app/models/user.rb
180
+ - test/dummy/app/views/layouts/application.html.erb
181
+ - test/dummy/bin/bundle
182
+ - test/dummy/bin/rails
183
+ - test/dummy/bin/rake
184
+ - test/dummy/config/application.rb
185
+ - test/dummy/config/boot.rb
186
+ - test/dummy/config/database.yml
187
+ - test/dummy/config/environment.rb
188
+ - test/dummy/config/environments/development.rb
189
+ - test/dummy/config/environments/production.rb
190
+ - test/dummy/config/environments/test.rb
191
+ - test/dummy/config/initializers/backtrace_silencers.rb
192
+ - test/dummy/config/initializers/filter_parameter_logging.rb
193
+ - test/dummy/config/initializers/inflections.rb
194
+ - test/dummy/config/initializers/mime_types.rb
195
+ - test/dummy/config/initializers/secret_token.rb
196
+ - test/dummy/config/initializers/session_store.rb
197
+ - test/dummy/config/initializers/wrap_parameters.rb
198
+ - test/dummy/config/locales/en.yml
199
+ - test/dummy/config/routes.rb
200
+ - test/dummy/config.ru
201
+ - test/dummy/db/migrate/20130819203338_create_users.rb
202
+ - test/dummy/db/schema.rb
203
+ - test/dummy/db/test.sqlite3
204
+ - test/dummy/log/development.log
205
+ - test/dummy/log/test.log
206
+ - test/dummy/public/404.html
207
+ - test/dummy/public/422.html
208
+ - test/dummy/public/500.html
209
+ - test/dummy/public/favicon.ico
210
+ - test/dummy/Rakefile
211
+ - test/dummy/README.rdoc
212
+ - test/dummy/test/fixtures/users.yml
213
+ - test/dummy/test/models/user_test.rb
214
+ - test/dummy/tmp/cache/assets/test/sprockets/0ff3a9241bbf1c751ced680adfa90b59
215
+ - test/dummy/tmp/cache/assets/test/sprockets/1feb7eec1529672092299032ef2d6325
216
+ - test/dummy/tmp/cache/assets/test/sprockets/2dc95e0e7e3281df7eb8e26fbb8a3a59
217
+ - test/dummy/tmp/cache/assets/test/sprockets/72881d4d0eb1a7d61ba5420798add236
218
+ - test/dummy/tmp/cache/assets/test/sprockets/ab1417852e512b0f0f50fbdc19d1f890
219
+ - test/dummy/tmp/cache/assets/test/sprockets/b1a87f7961214599041bb9b30c8e398e
220
+ - test/dummy/tmp/cache/assets/test/sprockets/bf0ff79f1edd27152fd4681650468a43
221
+ - test/dummy/tmp/cache/assets/test/sprockets/c903f846849a6d4c555eaf82468a7e6e
222
+ - test/helpers/rails_db_info/tables_helper_test.rb
223
+ - test/integration/navigation_test.rb
224
+ - test/rails_db_info_test.rb
225
+ - test/test_helper.rb