admin_data 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/README.md +25 -0
  2. data/app/controllers/admin_data/base_controller.rb +2 -7
  3. data/app/views/admin_data/main/edit.html.erb +1 -2
  4. data/app/views/admin_data/main/misc/_form.html.erb +9 -2
  5. data/app/views/admin_data/shared/_drop_down_klasses.html.erb +1 -1
  6. data/app/views/admin_data/shared/_powered_by.html.erb +3 -20
  7. data/lib/admin_data/helpers.rb +1 -1
  8. data/lib/admin_data/version.rb +1 -1
  9. data/lib/js/vendor/{code.jquery.com jquery-1.4.2.js → jquery-1.4.2.js} +0 -0
  10. metadata +9 -110
  11. data/README.textile +0 -21
  12. data/lib/js/vendor/jquery.lint.js +0 -604
  13. data/test/factories/article.rb +0 -9
  14. data/test/factories/car.rb +0 -4
  15. data/test/factories/city.rb +0 -4
  16. data/test/factories/comment.rb +0 -6
  17. data/test/factories/door.rb +0 -4
  18. data/test/factories/engine.rb +0 -4
  19. data/test/functional/base_controller_test.rb +0 -5
  20. data/test/functional/feed_controller_test.rb +0 -45
  21. data/test/functional/main_controller_authorization_test.rb +0 -91
  22. data/test/functional/main_controller_test.rb +0 -418
  23. data/test/functional/migration_controller_test.rb +0 -39
  24. data/test/functional/routes_test.rb +0 -59
  25. data/test/functional/search_controller_authorization_test.rb +0 -77
  26. data/test/functional/search_controller_test.rb +0 -811
  27. data/test/helper/view_helper_test.rb +0 -177
  28. data/test/misc_tests/date_validation_test.rb +0 -32
  29. data/test/misc_tests/settings_test.rb +0 -29
  30. data/test/misc_tests/util_test.rb +0 -83
  31. data/test/rails_root/Gemfile +0 -22
  32. data/test/rails_root/Gemfile.lock +0 -101
  33. data/test/rails_root/Rakefile +0 -7
  34. data/test/rails_root/app/controllers/application_controller.rb +0 -3
  35. data/test/rails_root/app/helpers/application_helper.rb +0 -2
  36. data/test/rails_root/app/models/article.rb +0 -25
  37. data/test/rails_root/app/models/city.rb +0 -15
  38. data/test/rails_root/app/models/comment.rb +0 -13
  39. data/test/rails_root/app/models/tech_magazine.rb +0 -2
  40. data/test/rails_root/app/models/vehicle/car.rb +0 -4
  41. data/test/rails_root/app/models/vehicle/door.rb +0 -3
  42. data/test/rails_root/app/models/vehicle/engine.rb +0 -3
  43. data/test/rails_root/app/views/layouts/application.html.erb +0 -14
  44. data/test/rails_root/config/application.rb +0 -42
  45. data/test/rails_root/config/boot.rb +0 -13
  46. data/test/rails_root/config/database.yml +0 -22
  47. data/test/rails_root/config/environment.rb +0 -5
  48. data/test/rails_root/config/environments/development.rb +0 -22
  49. data/test/rails_root/config/environments/production.rb +0 -49
  50. data/test/rails_root/config/environments/test.rb +0 -35
  51. data/test/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  52. data/test/rails_root/config/initializers/inflections.rb +0 -10
  53. data/test/rails_root/config/initializers/mime_types.rb +0 -5
  54. data/test/rails_root/config/initializers/secret_token.rb +0 -7
  55. data/test/rails_root/config/initializers/session_store.rb +0 -8
  56. data/test/rails_root/config/locales/en.yml +0 -5
  57. data/test/rails_root/config/routes.rb +0 -58
  58. data/test/rails_root/config.ru +0 -4
  59. data/test/rails_root/db/migrate/20090809061114_create_tables.rb +0 -70
  60. data/test/rails_root/db/schema.rb +0 -74
  61. data/test/rails_root/db/seeds.rb +0 -7
  62. data/test/rails_root/db/test.sqlite3 +0 -0
  63. data/test/rails_root/script/rails +0 -6
  64. data/test/rails_root/test/performance/browsing_test.rb +0 -0
  65. data/test/rails_root/test/test_helper.rb +0 -13
  66. data/test/support/assertions.rb +0 -20
  67. data/test/test_helper.rb +0 -76
@@ -1,77 +0,0 @@
1
- require 'test_helper'
2
-
3
- pwd = File.dirname(__FILE__)
4
- f = File.join(pwd, '..', '..', 'app', 'views')
5
- AdminData::MainController.prepend_view_path(f)
6
- AdminData::SearchController.prepend_view_path(f)
7
-
8
- class AdminData::SearchControllerTest < ActionController::TestCase
9
-
10
- def setup
11
- @controller = AdminData::SearchController.new
12
- @request = ActionController::TestRequest.new
13
- @response = ActionController::TestResponse.new
14
- @article = Factory(:article)
15
- grant_read_only_access
16
- end
17
-
18
- context 'is not allowed to view' do
19
- setup do
20
- revoke_read_only_access
21
- get :quick_search, {:klass => Article.name.underscore}
22
- end
23
- should_respond_with(401)
24
- should 'have text index' do
25
- assert_tag(:content => 'not authorized')
26
- end
27
- end
28
-
29
- context 'is allowed to view klass' do
30
- context 'negative case' do
31
- setup do
32
- _proc = lambda {|controller| controller.instance_variable_get('@klass').name != 'Article' }
33
- AdminData::Config.set = { :is_allowed_to_view_klass => _proc }
34
- get :quick_search, {:klass => Article.name.underscore}
35
- end
36
- should_respond_with(401)
37
- should 'have text index' do
38
- assert_tag(:content => 'not authorized')
39
- end
40
- end
41
- context 'positive case' do
42
- setup do
43
- _proc = lambda {|controller| controller.instance_variable_get('@klass').name == 'Article' }
44
- AdminData::Config.set = { :is_allowed_to_view_klass => _proc }
45
- get :quick_search, {:klass => Article.name.underscore}
46
- end
47
- should_respond_with :success
48
- end
49
- end
50
-
51
- context 'is allowed to update' do
52
- context 'delete operation' do
53
- setup do
54
- AdminData::Config.set = { :is_allowed_to_update => lambda {|controller| false } }
55
- xml_http_request :post, :advance_search,
56
- {:klass => Article.name.underscore,
57
- :sortby => 'article_id desc',
58
- :admin_data_advance_search_action_type => 'delete',
59
- :adv_search => {'1_row' => {:col1 => 'short_desc', :col2 => 'contains', :col3 => 'ruby'} } }
60
- end
61
- should_respond_with(401)
62
- end
63
- context 'destroy operation' do
64
- setup do
65
- AdminData::Config.set = { :is_allowed_to_update => lambda {|controller| false } }
66
- xml_http_request :post,
67
- :advance_search,
68
- {:klass => Article.name.underscore,
69
- :sortby => 'article_id desc',
70
- :admin_data_advance_search_action_type => 'destroy',
71
- :adv_search => {'1_row' => {:col1 => 'short_desc', :col2 => 'contains', :col3 => 'ruby'} } }
72
- end
73
- should_respond_with(401)
74
- end
75
- end
76
-
77
- end