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.
- data/README.md +25 -0
- data/app/controllers/admin_data/base_controller.rb +2 -7
- data/app/views/admin_data/main/edit.html.erb +1 -2
- data/app/views/admin_data/main/misc/_form.html.erb +9 -2
- data/app/views/admin_data/shared/_drop_down_klasses.html.erb +1 -1
- data/app/views/admin_data/shared/_powered_by.html.erb +3 -20
- data/lib/admin_data/helpers.rb +1 -1
- data/lib/admin_data/version.rb +1 -1
- data/lib/js/vendor/{code.jquery.com jquery-1.4.2.js → jquery-1.4.2.js} +0 -0
- metadata +9 -110
- data/README.textile +0 -21
- data/lib/js/vendor/jquery.lint.js +0 -604
- data/test/factories/article.rb +0 -9
- data/test/factories/car.rb +0 -4
- data/test/factories/city.rb +0 -4
- data/test/factories/comment.rb +0 -6
- data/test/factories/door.rb +0 -4
- data/test/factories/engine.rb +0 -4
- data/test/functional/base_controller_test.rb +0 -5
- data/test/functional/feed_controller_test.rb +0 -45
- data/test/functional/main_controller_authorization_test.rb +0 -91
- data/test/functional/main_controller_test.rb +0 -418
- data/test/functional/migration_controller_test.rb +0 -39
- data/test/functional/routes_test.rb +0 -59
- data/test/functional/search_controller_authorization_test.rb +0 -77
- data/test/functional/search_controller_test.rb +0 -811
- data/test/helper/view_helper_test.rb +0 -177
- data/test/misc_tests/date_validation_test.rb +0 -32
- data/test/misc_tests/settings_test.rb +0 -29
- data/test/misc_tests/util_test.rb +0 -83
- data/test/rails_root/Gemfile +0 -22
- data/test/rails_root/Gemfile.lock +0 -101
- data/test/rails_root/Rakefile +0 -7
- data/test/rails_root/app/controllers/application_controller.rb +0 -3
- data/test/rails_root/app/helpers/application_helper.rb +0 -2
- data/test/rails_root/app/models/article.rb +0 -25
- data/test/rails_root/app/models/city.rb +0 -15
- data/test/rails_root/app/models/comment.rb +0 -13
- data/test/rails_root/app/models/tech_magazine.rb +0 -2
- data/test/rails_root/app/models/vehicle/car.rb +0 -4
- data/test/rails_root/app/models/vehicle/door.rb +0 -3
- data/test/rails_root/app/models/vehicle/engine.rb +0 -3
- data/test/rails_root/app/views/layouts/application.html.erb +0 -14
- data/test/rails_root/config/application.rb +0 -42
- data/test/rails_root/config/boot.rb +0 -13
- data/test/rails_root/config/database.yml +0 -22
- data/test/rails_root/config/environment.rb +0 -5
- data/test/rails_root/config/environments/development.rb +0 -22
- data/test/rails_root/config/environments/production.rb +0 -49
- data/test/rails_root/config/environments/test.rb +0 -35
- data/test/rails_root/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails_root/config/initializers/inflections.rb +0 -10
- data/test/rails_root/config/initializers/mime_types.rb +0 -5
- data/test/rails_root/config/initializers/secret_token.rb +0 -7
- data/test/rails_root/config/initializers/session_store.rb +0 -8
- data/test/rails_root/config/locales/en.yml +0 -5
- data/test/rails_root/config/routes.rb +0 -58
- data/test/rails_root/config.ru +0 -4
- data/test/rails_root/db/migrate/20090809061114_create_tables.rb +0 -70
- data/test/rails_root/db/schema.rb +0 -74
- data/test/rails_root/db/seeds.rb +0 -7
- data/test/rails_root/db/test.sqlite3 +0 -0
- data/test/rails_root/script/rails +0 -6
- data/test/rails_root/test/performance/browsing_test.rb +0 -0
- data/test/rails_root/test/test_helper.rb +0 -13
- data/test/support/assertions.rb +0 -20
- 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
|