elucid-rails_admin 0.0.1
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.
- data/Gemfile +54 -0
- data/LICENSE.md +20 -0
- data/README.md +1334 -0
- data/Rakefile +14 -0
- data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/rails_admin/bullet_black.png +0 -0
- data/app/assets/images/rails_admin/bullet_white.png +0 -0
- data/app/assets/images/rails_admin/calendar.png +0 -0
- data/app/assets/images/rails_admin/clock.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/select.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/select2.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/app/assets/images/rails_admin/logo.png +0 -0
- data/app/assets/images/rails_admin/magnifier.png +0 -0
- data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
- data/app/assets/javascripts/rails_admin/custom/ui.js +1 -0
- data/app/assets/javascripts/rails_admin/jquery-ui-1.8.16.custom.js +5019 -0
- data/app/assets/javascripts/rails_admin/jquery.colorpicker.js +484 -0
- data/app/assets/javascripts/rails_admin/jquery.ui.timepicker.js +1219 -0
- data/app/assets/javascripts/rails_admin/ra.datetimepicker.js +67 -0
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +119 -0
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +280 -0
- data/app/assets/javascripts/rails_admin/ra.filtering-select.js +181 -0
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +147 -0
- data/app/assets/javascripts/rails_admin/rails_admin.js.erb +17 -0
- data/app/assets/javascripts/rails_admin/themes/default/ui.js +1 -0
- data/app/assets/javascripts/rails_admin/ui.js.coffee +30 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.css.scss +733 -0
- data/app/assets/stylesheets/rails_admin/base/README +2 -0
- data/app/assets/stylesheets/rails_admin/base/mixins.css.scss +1 -0
- data/app/assets/stylesheets/rails_admin/base/theming.css.scss +102 -0
- data/app/assets/stylesheets/rails_admin/base/variables.css.scss +1 -0
- data/app/assets/stylesheets/rails_admin/custom/README +3 -0
- data/app/assets/stylesheets/rails_admin/custom/mixins.css.scss +9 -0
- data/app/assets/stylesheets/rails_admin/custom/theming.css.scss +11 -0
- data/app/assets/stylesheets/rails_admin/custom/variables.css.scss +11 -0
- data/app/assets/stylesheets/rails_admin/imports.css.scss.erb +51 -0
- data/app/assets/stylesheets/rails_admin/jquery.colorpicker.css.scss +180 -0
- data/app/assets/stylesheets/rails_admin/jquery.ui.timepicker.css.scss +53 -0
- data/app/assets/stylesheets/rails_admin/ra.calendar-additions.css.scss +25 -0
- data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.css.scss +85 -0
- data/app/assets/stylesheets/rails_admin/rails_admin.css +4 -0
- data/app/assets/stylesheets/rails_admin/themes/README +11 -0
- data/app/assets/stylesheets/rails_admin/themes/default/mixins.css.scss +1 -0
- data/app/assets/stylesheets/rails_admin/themes/default/theming.css.scss +1 -0
- data/app/assets/stylesheets/rails_admin/themes/default/variables.css.scss +1 -0
- data/app/controllers/rails_admin/application_controller.rb +62 -0
- data/app/controllers/rails_admin/history_controller.rb +26 -0
- data/app/controllers/rails_admin/main_controller.rb +371 -0
- data/app/helpers/rails_admin/application_helper.rb +65 -0
- data/app/helpers/rails_admin/form_builder.rb +52 -0
- data/app/helpers/rails_admin/main_helper.rb +100 -0
- data/app/models/rails_admin/history.rb +64 -0
- data/app/views/kaminari/twitter-bootstrap/_gap.html.haml +2 -0
- data/app/views/kaminari/twitter-bootstrap/_next_page.html.haml +4 -0
- data/app/views/kaminari/twitter-bootstrap/_page.html.haml +4 -0
- data/app/views/kaminari/twitter-bootstrap/_paginator.html.haml +10 -0
- data/app/views/kaminari/twitter-bootstrap/_prev_page.html.haml +4 -0
- data/app/views/layouts/rails_admin/_navigation.html.haml +19 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +9 -0
- data/app/views/layouts/rails_admin/application.html.haml +41 -0
- data/app/views/rails_admin/history/_dashboard.html.haml +10 -0
- data/app/views/rails_admin/history/show.html.haml +42 -0
- data/app/views/rails_admin/main/_delete_notice.html.haml +19 -0
- data/app/views/rails_admin/main/_form_colorpicker.html.haml +26 -0
- data/app/views/rails_admin/main/_form_datetime.html.haml +7 -0
- data/app/views/rails_admin/main/_form_enumeration.html.haml +5 -0
- data/app/views/rails_admin/main/_form_field.html.haml +1 -0
- data/app/views/rails_admin/main/_form_file_upload.html.haml +19 -0
- data/app/views/rails_admin/main/_form_filtering_multiselect.html.haml +57 -0
- data/app/views/rails_admin/main/_form_filtering_select.html.haml +47 -0
- data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +36 -0
- data/app/views/rails_admin/main/_form_text.html.haml +13 -0
- data/app/views/rails_admin/main/_models_links.html.haml +31 -0
- data/app/views/rails_admin/main/_object_links.html.haml +23 -0
- data/app/views/rails_admin/main/_submit_buttons.html.haml +12 -0
- data/app/views/rails_admin/main/bulk_delete.html.haml +6 -0
- data/app/views/rails_admin/main/dashboard.html.haml +31 -0
- data/app/views/rails_admin/main/delete.html.haml +13 -0
- data/app/views/rails_admin/main/edit.html.haml +2 -0
- data/app/views/rails_admin/main/export.html.haml +70 -0
- data/app/views/rails_admin/main/index.html.haml +98 -0
- data/app/views/rails_admin/main/new.html.haml +2 -0
- data/app/views/rails_admin/main/show.html.haml +14 -0
- data/config/initializers/active_record_extensions.rb +19 -0
- data/config/initializers/devise_patch.rb +9 -0
- data/config/initializers/haml.rb +3 -0
- data/config/locales/devise.bg.yml +42 -0
- data/config/locales/devise.de.yml +39 -0
- data/config/locales/devise.en.yml +39 -0
- data/config/locales/devise.es.yml +39 -0
- data/config/locales/devise.fi.yml +39 -0
- data/config/locales/devise.fr.yml +78 -0
- data/config/locales/devise.hr.yml +49 -0
- data/config/locales/devise.it.yml +39 -0
- data/config/locales/devise.lt.yml +39 -0
- data/config/locales/devise.mn.yml +39 -0
- data/config/locales/devise.nb.yml +43 -0
- data/config/locales/devise.pt-BR.yml +39 -0
- data/config/locales/devise.pt-PT.yml +39 -0
- data/config/locales/devise.ro.yml +46 -0
- data/config/locales/devise.ru.yml +39 -0
- data/config/locales/devise.sv.yml +39 -0
- data/config/locales/devise.tr.yml +39 -0
- data/config/locales/devise.uk.yml +39 -0
- data/config/locales/devise.zh-CN.yml +39 -0
- data/config/locales/devise.zh_cn.yml +39 -0
- data/config/locales/rails_admin.bg.yml +104 -0
- data/config/locales/rails_admin.da.yml +99 -0
- data/config/locales/rails_admin.de.yml +110 -0
- data/config/locales/rails_admin.en.yml +114 -0
- data/config/locales/rails_admin.es.yml +112 -0
- data/config/locales/rails_admin.fi.yml +107 -0
- data/config/locales/rails_admin.fr.yml +110 -0
- data/config/locales/rails_admin.hr.yml +81 -0
- data/config/locales/rails_admin.it.yml +109 -0
- data/config/locales/rails_admin.ja.yml +110 -0
- data/config/locales/rails_admin.lt.yml +102 -0
- data/config/locales/rails_admin.lv.yml +100 -0
- data/config/locales/rails_admin.mn.yml +103 -0
- data/config/locales/rails_admin.nb.yml +110 -0
- data/config/locales/rails_admin.nl.yml +135 -0
- data/config/locales/rails_admin.pl.yml +111 -0
- data/config/locales/rails_admin.pt-BR.yml +109 -0
- data/config/locales/rails_admin.pt-PT.yml +109 -0
- data/config/locales/rails_admin.ro.yml +113 -0
- data/config/locales/rails_admin.ru.yml +109 -0
- data/config/locales/rails_admin.sv.yml +103 -0
- data/config/locales/rails_admin.tr.yml +103 -0
- data/config/locales/rails_admin.uk.yml +100 -0
- data/config/locales/rails_admin.zh-CN.yml +114 -0
- data/config/locales/rails_admin.zh_cn.yml +107 -0
- data/config/routes.rb +28 -0
- data/lib/generators/rails_admin/install_generator.rb +83 -0
- data/lib/generators/rails_admin/templates/drop.rb +18 -0
- data/lib/generators/rails_admin/templates/initializer.erb +150 -0
- data/lib/generators/rails_admin/templates/migration.rb +18 -0
- data/lib/generators/rails_admin/uninstall_generator.rb +22 -0
- data/lib/generators/rails_admin/utils.rb +30 -0
- data/lib/rails_admin.rb +57 -0
- data/lib/rails_admin/abstract_model.rb +73 -0
- data/lib/rails_admin/abstract_object.rb +28 -0
- data/lib/rails_admin/adapters/active_record.rb +359 -0
- data/lib/rails_admin/config.rb +287 -0
- data/lib/rails_admin/config/base.rb +111 -0
- data/lib/rails_admin/config/fields.rb +99 -0
- data/lib/rails_admin/config/fields/association.rb +101 -0
- data/lib/rails_admin/config/fields/base.rb +273 -0
- data/lib/rails_admin/config/fields/factories/carrierwave.rb +16 -0
- data/lib/rails_admin/config/fields/factories/devise.rb +31 -0
- data/lib/rails_admin/config/fields/factories/dragonfly.rb +20 -0
- data/lib/rails_admin/config/fields/factories/enum.rb +11 -0
- data/lib/rails_admin/config/fields/factories/paperclip.rb +26 -0
- data/lib/rails_admin/config/fields/factories/password.rb +17 -0
- data/lib/rails_admin/config/fields/group.rb +63 -0
- data/lib/rails_admin/config/fields/groupable.rb +25 -0
- data/lib/rails_admin/config/fields/types.rb +26 -0
- data/lib/rails_admin/config/fields/types/all.rb +22 -0
- data/lib/rails_admin/config/fields/types/belongs_to_association.rb +51 -0
- data/lib/rails_admin/config/fields/types/boolean.rb +29 -0
- data/lib/rails_admin/config/fields/types/carrierwave.rb +32 -0
- data/lib/rails_admin/config/fields/types/color.rb +37 -0
- data/lib/rails_admin/config/fields/types/date.rb +24 -0
- data/lib/rails_admin/config/fields/types/datetime.rb +160 -0
- data/lib/rails_admin/config/fields/types/decimal.rb +14 -0
- data/lib/rails_admin/config/fields/types/dragonfly.rb +51 -0
- data/lib/rails_admin/config/fields/types/enum.rb +35 -0
- data/lib/rails_admin/config/fields/types/file_upload.rb +54 -0
- data/lib/rails_admin/config/fields/types/float.rb +14 -0
- data/lib/rails_admin/config/fields/types/has_and_belongs_to_many_association.rb +14 -0
- data/lib/rails_admin/config/fields/types/has_many_association.rb +42 -0
- data/lib/rails_admin/config/fields/types/has_one_association.rb +31 -0
- data/lib/rails_admin/config/fields/types/integer.rb +24 -0
- data/lib/rails_admin/config/fields/types/paperclip.rb +38 -0
- data/lib/rails_admin/config/fields/types/password.rb +41 -0
- data/lib/rails_admin/config/fields/types/polymorphic_association.rb +78 -0
- data/lib/rails_admin/config/fields/types/string.rb +34 -0
- data/lib/rails_admin/config/fields/types/text.rb +39 -0
- data/lib/rails_admin/config/fields/types/time.rb +31 -0
- data/lib/rails_admin/config/fields/types/timestamp.rb +18 -0
- data/lib/rails_admin/config/has_fields.rb +112 -0
- data/lib/rails_admin/config/has_groups.rb +39 -0
- data/lib/rails_admin/config/hideable.rb +28 -0
- data/lib/rails_admin/config/model.rb +89 -0
- data/lib/rails_admin/config/proxy.rb +40 -0
- data/lib/rails_admin/config/sections.rb +51 -0
- data/lib/rails_admin/config/sections/create.rb +11 -0
- data/lib/rails_admin/config/sections/export.rb +18 -0
- data/lib/rails_admin/config/sections/list.rb +55 -0
- data/lib/rails_admin/config/sections/navigation.rb +21 -0
- data/lib/rails_admin/config/sections/show.rb +50 -0
- data/lib/rails_admin/config/sections/update.rb +11 -0
- data/lib/rails_admin/engine.rb +15 -0
- data/lib/rails_admin/extension.rb +23 -0
- data/lib/rails_admin/extensions/cancan.rb +5 -0
- data/lib/rails_admin/extensions/cancan/authorization_adapter.rb +71 -0
- data/lib/rails_admin/generic_support.rb +15 -0
- data/lib/rails_admin/i18n_support.rb +43 -0
- data/lib/rails_admin/support/core_extensions.rb +44 -0
- data/lib/rails_admin/support/csv_converter.rb +109 -0
- data/lib/rails_admin/version.rb +6 -0
- data/lib/tasks/prepare_ci_env.rake +27 -0
- data/lib/tasks/rails_admin.rake +18 -0
- data/spec/ci.sh +2 -0
- data/spec/controllers/application_controller_spec.rb +30 -0
- data/spec/controllers/main_controller_spec.rb +86 -0
- data/spec/database_helpers.rb +15 -0
- data/spec/dummy_app/Gemfile +52 -0
- data/spec/dummy_app/README +256 -0
- data/spec/dummy_app/Rakefile +7 -0
- data/spec/dummy_app/app/controllers/application_controller.rb +3 -0
- data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_app/app/locales/models.en.yml +8 -0
- data/spec/dummy_app/app/models/abstract.rb +5 -0
- data/spec/dummy_app/app/models/ball.rb +8 -0
- data/spec/dummy_app/app/models/cms.rb +5 -0
- data/spec/dummy_app/app/models/cms/basic_page.rb +7 -0
- data/spec/dummy_app/app/models/cms/unscoped_page.rb +3 -0
- data/spec/dummy_app/app/models/comment.rb +3 -0
- data/spec/dummy_app/app/models/division.rb +8 -0
- data/spec/dummy_app/app/models/draft.rb +11 -0
- data/spec/dummy_app/app/models/fan.rb +5 -0
- data/spec/dummy_app/app/models/field_test.rb +13 -0
- data/spec/dummy_app/app/models/league.rb +10 -0
- data/spec/dummy_app/app/models/player.rb +15 -0
- data/spec/dummy_app/app/models/rel_test.rb +6 -0
- data/spec/dummy_app/app/models/team.rb +25 -0
- data/spec/dummy_app/app/models/user.rb +21 -0
- data/spec/dummy_app/app/uploaders/carrierwave_uploader.rb +53 -0
- data/spec/dummy_app/app/views/layouts/application.html.erb +13 -0
- data/spec/dummy_app/config.ru +4 -0
- data/spec/dummy_app/config/application.rb +47 -0
- data/spec/dummy_app/config/boot.rb +6 -0
- data/spec/dummy_app/config/database.yml +22 -0
- data/spec/dummy_app/config/environment.rb +5 -0
- data/spec/dummy_app/config/environments/development.rb +27 -0
- data/spec/dummy_app/config/environments/production.rb +51 -0
- data/spec/dummy_app/config/environments/test.rb +39 -0
- data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_app/config/initializers/devise.rb +142 -0
- data/spec/dummy_app/config/initializers/inflections.rb +10 -0
- data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_app/config/initializers/quiet_assets.rb +10 -0
- data/spec/dummy_app/config/initializers/rails_admin.rb +10 -0
- data/spec/dummy_app/config/initializers/secret_token.rb +7 -0
- data/spec/dummy_app/config/initializers/session_store.rb +8 -0
- data/spec/dummy_app/config/routes.rb +8 -0
- data/spec/dummy_app/db/migrate/00000000000001_create_divisions_migration.rb +13 -0
- data/spec/dummy_app/db/migrate/00000000000002_create_drafts_migration.rb +19 -0
- data/spec/dummy_app/db/migrate/00000000000003_create_leagues_migration.rb +12 -0
- data/spec/dummy_app/db/migrate/00000000000004_create_players_migration.rb +20 -0
- data/spec/dummy_app/db/migrate/00000000000005_create_teams_migration.rb +22 -0
- data/spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb +19 -0
- data/spec/dummy_app/db/migrate/00000000000007_create_histories_table.rb +16 -0
- data/spec/dummy_app/db/migrate/00000000000008_create_fans_migration.rb +12 -0
- data/spec/dummy_app/db/migrate/00000000000009_create_fans_teams_migration.rb +11 -0
- data/spec/dummy_app/db/migrate/00000000000010_add_revenue_to_team_migration.rb +9 -0
- data/spec/dummy_app/db/migrate/00000000000011_add_suspended_to_player_migration.rb +9 -0
- data/spec/dummy_app/db/migrate/00000000000012_add_avatar_columns_to_user.rb +16 -0
- data/spec/dummy_app/db/migrate/00000000000013_add_roles_to_user.rb +9 -0
- data/spec/dummy_app/db/migrate/00000000000014_add_color_to_team_migration.rb +9 -0
- data/spec/dummy_app/db/migrate/20101223222233_create_rel_tests.rb +15 -0
- data/spec/dummy_app/db/migrate/20110103205808_create_comments.rb +15 -0
- data/spec/dummy_app/db/migrate/20110123042530_rename_histories_to_rails_admin_histories.rb +9 -0
- data/spec/dummy_app/db/migrate/20110224184303_create_field_tests.rb +22 -0
- data/spec/dummy_app/db/migrate/20110328193014_create_cms_basic_pages.rb +14 -0
- data/spec/dummy_app/db/migrate/20110329183136_remove_league_id_from_teams.rb +9 -0
- data/spec/dummy_app/db/migrate/20110607152842_add_format_to_field_test.rb +9 -0
- data/spec/dummy_app/db/migrate/20110714095433_create_balls.rb +12 -0
- data/spec/dummy_app/db/migrate/20110831090841_add_protected_field_and_restricted_field_to_field_tests.rb +6 -0
- data/spec/dummy_app/db/migrate/20110901131551_change_division_primary_key.rb +19 -0
- data/spec/dummy_app/db/migrate/20110901142530_rename_league_id_foreign_key_on_divisions.rb +5 -0
- data/spec/dummy_app/db/migrate/20110901150912_set_primary_key_not_null_for_divisions.rb +21 -0
- data/spec/dummy_app/db/migrate/20110901154834_change_length_for_rails_admin_histories.rb +9 -0
- data/spec/dummy_app/db/migrate/20111103174459_create_unscoped_pages.rb +9 -0
- data/spec/dummy_app/db/migrate/20111108143642_add_dragonfly_and_carrierwave_to_field_tests.rb +7 -0
- data/spec/dummy_app/db/seeds.rb +18 -0
- data/spec/dummy_app/doc/README_FOR_APP +2 -0
- data/spec/dummy_app/public/404.html +0 -0
- data/spec/dummy_app/public/favicon.ico +0 -0
- data/spec/dummy_app/script/rails +6 -0
- data/spec/factories.rb +62 -0
- data/spec/generator_helpers.rb +30 -0
- data/spec/generators/install_generator_spec.rb +85 -0
- data/spec/generators/uninstall_generator_spec.rb +35 -0
- data/spec/lib/abstract_object_spec.rb +119 -0
- data/spec/lib/rails_admin_spec.rb +153 -0
- data/spec/requests/authorization/cancan_spec.rb +260 -0
- data/spec/requests/basic/bulk_action/rails_admin_basic_bulk_action_spec.rb +25 -0
- data/spec/requests/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb +55 -0
- data/spec/requests/basic/create/rails_admin_basic_create_spec.rb +143 -0
- data/spec/requests/basic/create/rails_admin_namespaced_model_create_spec.rb +24 -0
- data/spec/requests/basic/delete/rails_admin_basic_delete_spec.rb +35 -0
- data/spec/requests/basic/destroy/rails_admin_basic_destroy_spec.rb +56 -0
- data/spec/requests/basic/edit/rails_admin_basic_edit_spec.rb +98 -0
- data/spec/requests/basic/export/rails_admin_basic_export_spec.rb +84 -0
- data/spec/requests/basic/list/rails_admin_basic_list_spec.rb +401 -0
- data/spec/requests/basic/new/rails_admin_basic_new_spec.rb +74 -0
- data/spec/requests/basic/new/rails_admin_namespaced_model_new_spec.rb +31 -0
- data/spec/requests/basic/show/rails_admin_basic_show_spec.rb +83 -0
- data/spec/requests/basic/update/rails_admin_basic_update_spec.rb +169 -0
- data/spec/requests/config/edit/rails_admin_config_edit_spec.rb +744 -0
- data/spec/requests/config/list/rails_admin_config_list_spec.rb +549 -0
- data/spec/requests/config/navigation/rails_admin_config_navigation_spec.rb +107 -0
- data/spec/requests/config/rails_admin_config_spec.rb +180 -0
- data/spec/requests/config/show/rails_admin_config_show_spec.rb +275 -0
- data/spec/requests/history/rails_admin_history_spec.rb +57 -0
- data/spec/requests/rails_admin_spec.rb +103 -0
- data/spec/requests/relation_spec.rb +26 -0
- data/spec/spec_helper.rb +88 -0
- metadata +717 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "RailsAdmin Basic Create" do
|
|
4
|
+
subject { page }
|
|
5
|
+
|
|
6
|
+
describe "create" do
|
|
7
|
+
before(:each) do
|
|
8
|
+
visit new_path(:model_name => "player")
|
|
9
|
+
|
|
10
|
+
fill_in "player[name]", :with => "Jackie Robinson"
|
|
11
|
+
fill_in "player[number]", :with => "42"
|
|
12
|
+
fill_in "player[position]", :with => "Second baseman"
|
|
13
|
+
click_button "Save"
|
|
14
|
+
|
|
15
|
+
@player = RailsAdmin::AbstractModel.new("Player").first
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should create an object with correct attributes" do
|
|
19
|
+
@player.name.should eql("Jackie Robinson")
|
|
20
|
+
@player.number.should eql(42)
|
|
21
|
+
@player.position.should eql("Second baseman")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe "create and edit" do
|
|
26
|
+
before(:each) do
|
|
27
|
+
visit new_path(:model_name => "player")
|
|
28
|
+
|
|
29
|
+
fill_in "player[name]", :with => "Jackie Robinson"
|
|
30
|
+
fill_in "player[number]", :with => "42"
|
|
31
|
+
fill_in "player[position]", :with => "Second baseman"
|
|
32
|
+
click_button "Save and edit"
|
|
33
|
+
|
|
34
|
+
@player = RailsAdmin::AbstractModel.new("Player").first
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should create an object with correct attributes" do
|
|
38
|
+
@player.name.should eql("Jackie Robinson")
|
|
39
|
+
@player.number.should eql(42)
|
|
40
|
+
@player.position.should eql("Second baseman")
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe "create and add another" do
|
|
45
|
+
before(:each) do
|
|
46
|
+
visit new_path(:model_name => "player")
|
|
47
|
+
|
|
48
|
+
fill_in "player[name]", :with => "Jackie Robinson"
|
|
49
|
+
fill_in "player[number]", :with => "42"
|
|
50
|
+
fill_in "player[position]", :with => "Second baseman"
|
|
51
|
+
click_button "Save and add another"
|
|
52
|
+
|
|
53
|
+
@player = RailsAdmin::AbstractModel.new("Player").first
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "should create an object with correct attributes" do
|
|
57
|
+
@player.name.should eql("Jackie Robinson")
|
|
58
|
+
@player.number.should eql(42)
|
|
59
|
+
@player.position.should eql("Second baseman")
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
describe "create with has-one association" do
|
|
64
|
+
before(:each) do
|
|
65
|
+
@draft = FactoryGirl.create :draft
|
|
66
|
+
|
|
67
|
+
page.driver.post create_path(:model_name => "player", :player => {:name => "Jackie Robinson", :number => 42, :position => 'Second baseman', :draft_id => @draft.id})
|
|
68
|
+
|
|
69
|
+
@player = RailsAdmin::AbstractModel.new("Player").all.last # first is created by FactoryGirl
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "should create an object with correct associations" do
|
|
73
|
+
@draft.reload
|
|
74
|
+
@player.draft.should eql(@draft)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
describe "create with has-many association" do
|
|
79
|
+
before(:each) do
|
|
80
|
+
@divisions = 3.times.map { Division.create!(:name => "div #{Time.now.to_f}", :league => League.create!(:name => "league #{Time.now.to_f}")) }
|
|
81
|
+
page.driver.post create_path(:model_name => "league", :league => {:name => "National League", :division_ids =>[@divisions[0].id]})
|
|
82
|
+
@league = RailsAdmin::AbstractModel.new("League").all.last
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "should create an object with correct associations" do
|
|
86
|
+
@divisions[0].reload
|
|
87
|
+
@league.divisions.should include(@divisions[0])
|
|
88
|
+
@league.divisions.should_not include(@divisions[1])
|
|
89
|
+
@league.divisions.should_not include(@divisions[2])
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
describe "create with has-and-belongs-to-many association" do
|
|
94
|
+
before(:each) do
|
|
95
|
+
@teams = 3.times.map { FactoryGirl.create :team }
|
|
96
|
+
page.driver.post create_path(:model_name => "fan", :fan => {:name => "John Doe", :team_ids => [@teams[0].id] })
|
|
97
|
+
@fan = RailsAdmin::AbstractModel.new("Fan").first
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it "should create an object with correct associations" do
|
|
101
|
+
@teams[0].reload
|
|
102
|
+
@fan.teams.should include(@teams[0])
|
|
103
|
+
@fan.teams.should_not include(@teams[1])
|
|
104
|
+
@fan.teams.should_not include(@teams[2])
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
describe "create with uniqueness constraint violated", :given => "a player exists" do
|
|
109
|
+
before(:each) do
|
|
110
|
+
@team = FactoryGirl.create :team
|
|
111
|
+
@player = FactoryGirl.create :player, :team => @team
|
|
112
|
+
|
|
113
|
+
page.driver.post create_path(:model_name => "player", :player => {:name => @player.name, :number => @player.number.to_s, :position => @player.position, :team_id => @team.id})
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it "should show an error message" do
|
|
117
|
+
should have_content("There is already a player with that number on this team")
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
describe "create with invalid object" do
|
|
122
|
+
before(:each) do
|
|
123
|
+
page.driver.post(create_path(:model_name => "player", :id => 1), :params => {:player => {}})
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it "should show an error message" do
|
|
127
|
+
should have_content("Player failed to be created")
|
|
128
|
+
should have_selector "form", :action => "/admin/players"
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
describe "create with object with errors on base" do
|
|
133
|
+
before(:each) do
|
|
134
|
+
visit new_path(:model_name => "player")
|
|
135
|
+
fill_in "player[name]", :with => "Jackie Robinson on steroids"
|
|
136
|
+
click_button "Save and add another"
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it "should show error base error message in flash" do
|
|
140
|
+
should have_content("Player failed to be created. Player is cheating")
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "RailsAdmin Namespaced Model Create" do
|
|
4
|
+
|
|
5
|
+
subject { page }
|
|
6
|
+
|
|
7
|
+
before(:each) do
|
|
8
|
+
visit new_path(:model_name => "cms~basic_page")
|
|
9
|
+
|
|
10
|
+
fill_in "cms_basic_page[title]", :with => "Hello"
|
|
11
|
+
fill_in "cms_basic_page[content]", :with => "World"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should be successful' do
|
|
15
|
+
click_button "Save"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'should create object with correct attributes' do
|
|
19
|
+
expect {
|
|
20
|
+
click_button "Save"
|
|
21
|
+
}.to change(Cms::BasicPage, :count).by(1)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "RailsAdmin Basic Delete" do
|
|
4
|
+
|
|
5
|
+
subject { page }
|
|
6
|
+
|
|
7
|
+
describe "delete" do
|
|
8
|
+
before(:each) do
|
|
9
|
+
@player = FactoryGirl.create :player
|
|
10
|
+
visit delete_path(:model_name => "player", :id => @player.id)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should show \"Delete model\"" do
|
|
14
|
+
should have_content("delete this player")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe "delete with missing object" do
|
|
19
|
+
before(:each) do
|
|
20
|
+
visit delete_path(:model_name => "player", :id => 1)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should raise NotFound" do
|
|
24
|
+
page.driver.status_code.should eql(404)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe "delete with missing label" do
|
|
29
|
+
it "should respond successfully" do
|
|
30
|
+
@division = Division.create!(:name => "div #{Time.now.to_f}", :league => League.create!(:name => "league #{Time.now.to_f}"))
|
|
31
|
+
@team = FactoryGirl.create :team, :name => "", :division => @division
|
|
32
|
+
visit delete_path(:model_name => "division", :id => @division.id)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "RailsAdmin Basic Destroy" do
|
|
4
|
+
|
|
5
|
+
subject { page }
|
|
6
|
+
|
|
7
|
+
describe "destroy" do
|
|
8
|
+
before(:each) do
|
|
9
|
+
@player = FactoryGirl.create :player
|
|
10
|
+
visit delete_path(:model_name => "player", :id => @player.id)
|
|
11
|
+
click_button "Yes, I'm sure"
|
|
12
|
+
@player = RailsAdmin::AbstractModel.new("Player").first
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should destroy an object" do
|
|
16
|
+
@player.should be_nil
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "destroy with errors" do
|
|
21
|
+
before(:each) do
|
|
22
|
+
Player.any_instance.stub(:destroy).and_return false
|
|
23
|
+
@player = FactoryGirl.create :player
|
|
24
|
+
visit delete_path(:model_name => "player", :id => @player.id)
|
|
25
|
+
click_button "Yes, I'm sure"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should destroy an object" do
|
|
29
|
+
@player.reload.should be
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "destroy" do
|
|
34
|
+
before(:each) do
|
|
35
|
+
@player = FactoryGirl.create :player
|
|
36
|
+
visit delete_path(:model_name => "player", :id => @player.id)
|
|
37
|
+
click_button "Cancel"
|
|
38
|
+
@player = RailsAdmin::AbstractModel.new("Player").first
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should not destroy an object" do
|
|
42
|
+
@player.should be
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe "destroy with missing object" do
|
|
47
|
+
before(:each) do
|
|
48
|
+
page.driver.delete(destroy_path(:model_name => "player", :id => 1))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "should raise NotFound" do
|
|
52
|
+
page.driver.status_code.should eql(404)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "RailsAdmin Basic Edit" do
|
|
4
|
+
|
|
5
|
+
subject { page }
|
|
6
|
+
|
|
7
|
+
describe "edit" do
|
|
8
|
+
before(:each) do
|
|
9
|
+
@player = FactoryGirl.create :player
|
|
10
|
+
visit edit_path(:model_name => "player", :id => @player.id)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should show \"Update model\"" do
|
|
14
|
+
should have_content("Update player")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should show required fields as \"Required\"" do
|
|
18
|
+
should have_selector("div", :text => /Name\s*Required/)
|
|
19
|
+
should have_selector("div", :text => /Number\s*Required/)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should show non-required fields as \"Optional\"" do
|
|
23
|
+
find("#player_position_field .help-block").should have_content("Optional")
|
|
24
|
+
find("#player_born_on_field .help-block").should have_content("Optional")
|
|
25
|
+
find("#player_notes_field .help-block").should have_content("Optional")
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe "association with inverse_of option" do
|
|
30
|
+
it "should add a related id to the belongs_to create team link" do
|
|
31
|
+
@player = FactoryGirl.create :player
|
|
32
|
+
visit edit_path(:model_name => "player", :id => @player.id)
|
|
33
|
+
should have_selector("a", :href => 'admin/teams/new?associations[players]=' + @player.id.to_s)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should add a related id to the has_many create team link" do
|
|
37
|
+
@team = FactoryGirl.create :team
|
|
38
|
+
visit edit_path(:model_name => "team", :id => @team.id)
|
|
39
|
+
should have_selector("a", :href => 'admin/players/new?associations[team]=' + @team.id.to_s)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe "readonly associations" do
|
|
44
|
+
|
|
45
|
+
it 'should not be editable' do
|
|
46
|
+
@league = FactoryGirl.create :league
|
|
47
|
+
visit edit_path(:model_name => "league", :id => @league.id)
|
|
48
|
+
should_not have_selector('select#league_team_ids')
|
|
49
|
+
should have_selector('select#league_division_ids') # decoy, fails if naming scheme changes
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe "edit with has-and-belongs-to-many association" do
|
|
54
|
+
before(:each) do
|
|
55
|
+
@teams = 3.times.map { FactoryGirl.create :team }
|
|
56
|
+
@fan = FactoryGirl.create :fan, :teams => [@teams[0]]
|
|
57
|
+
visit edit_path(:model_name => "fan", :id => @fan.id)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should show associated objects" do
|
|
61
|
+
should have_selector "#fan_team_ids" do |select|
|
|
62
|
+
select[0].should have_selector 'option[selected="selected"]'
|
|
63
|
+
select[1].should_not have_selector 'option[selected="selected"]'
|
|
64
|
+
select[2].should_not have_selector 'option[selected="selected"]'
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe "edit with missing object" do
|
|
70
|
+
before(:each) do
|
|
71
|
+
visit edit_path(:model_name => "player", :id => 1)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "should raise NotFound" do
|
|
75
|
+
page.driver.status_code.should eql(404)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe "edit with missing label", :given => ["a player exists", "three teams with no name exist"] do
|
|
80
|
+
before(:each) do
|
|
81
|
+
@player = FactoryGirl.create :player
|
|
82
|
+
@teams = 3.times.map { FactoryGirl.create :team, :name => "" }
|
|
83
|
+
visit edit_path(:model_name => "player", :id => @player.id)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
describe "edit object with overridden to_param" do
|
|
88
|
+
before(:each) do
|
|
89
|
+
@ball = FactoryGirl.create :ball
|
|
90
|
+
visit edit_path(:model_name => "ball", :id => @ball.id)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "should display a link to the delete page" do
|
|
94
|
+
should have_selector "a[href='/admin/ball/#{@ball.id}/delete']"
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "RailsAdmin Export" do
|
|
4
|
+
|
|
5
|
+
subject { page }
|
|
6
|
+
|
|
7
|
+
before(:each) do
|
|
8
|
+
Comment.all.map &:destroy # rspec bug => doesn't get destroyed with transaction
|
|
9
|
+
|
|
10
|
+
@players = 4.times.map { FactoryGirl.create :player }
|
|
11
|
+
@player = @players.first
|
|
12
|
+
@player.team = FactoryGirl.create :team
|
|
13
|
+
@player.draft = FactoryGirl.create :draft
|
|
14
|
+
@player.comments = (@comments = 2.times.map { FactoryGirl.create(:comment) })
|
|
15
|
+
@player.save
|
|
16
|
+
|
|
17
|
+
# removed schema=>only=>created_at
|
|
18
|
+
@non_default_schema = {
|
|
19
|
+
"only"=>["id", "updated_at", "deleted_at", "name", "position", "number", "retired", "injured", "born_on", "notes", "suspended"],
|
|
20
|
+
"include"=>{
|
|
21
|
+
"team"=>{"only"=>["id", "created_at", "updated_at", "name", "logo_url", "manager", "ballpark", "mascot", "founded", "wins", "losses", "win_percentage", "revenue", "color"]},
|
|
22
|
+
"draft"=>{"only"=>["id", "created_at", "updated_at", "date", "round", "pick", "overall", "college", "notes"]},
|
|
23
|
+
"comments"=>{"only"=>["id", "content", "created_at", "updated_at"]}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe "POST /admin/players/export (prompt)" do
|
|
29
|
+
|
|
30
|
+
it "should allow to export to CSV with associations and default schema, containing properly translated header and follow configuration" do
|
|
31
|
+
RailsAdmin.config do |c|
|
|
32
|
+
c.model Player do
|
|
33
|
+
include_all_fields
|
|
34
|
+
field :name do
|
|
35
|
+
export_value do
|
|
36
|
+
"#{value} exported"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
visit export_path(:model_name => 'player')
|
|
43
|
+
should have_content 'Select fields to export'
|
|
44
|
+
select "<comma> ','", :from => "csv_options_generator_col_sep"
|
|
45
|
+
click_button 'Export to csv'
|
|
46
|
+
should have_content "Id,Created at,Updated at,Deleted at,Name,Position,Number,Retired,Injured,Born on,Notes,Suspended"
|
|
47
|
+
should have_content "Id [Team],Created at [Team],Updated at [Team],Name [Team],Logo url [Team],Team Manager [Team],Ballpark [Team],Mascot [Team],Founded [Team],Wins [Team],Losses [Team],Win percentage [Team],Revenue [Team],Color [Team]"
|
|
48
|
+
should have_content "Id [Draft],Created at [Draft],Updated at [Draft],Date [Draft],Round [Draft],Pick [Draft],Overall [Draft],College [Draft],Notes [Draft]"
|
|
49
|
+
should have_content "Id [Comments],Content [Comments],Created at [Comments],Updated at [Comments]"
|
|
50
|
+
should have_content @player.name + " exported"
|
|
51
|
+
should have_content @player.team.name
|
|
52
|
+
should have_content @player.draft.college
|
|
53
|
+
should have_content @player.comments.first.content.split("\n").first.strip # can't match for more than one line
|
|
54
|
+
should have_content @player.comments.second.content.split("\n").first.strip
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should allow to export to JSON" do
|
|
58
|
+
visit export_path(:model_name => 'player')
|
|
59
|
+
click_button 'Export to json'
|
|
60
|
+
should have_content @player.team.name
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "should allow to export to XML" do
|
|
64
|
+
visit export_path(:model_name => 'player')
|
|
65
|
+
click_button 'Export to xml'
|
|
66
|
+
should have_content @player.team.name
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "should export polymorphic fields the easy way for now" do
|
|
70
|
+
visit export_path(:model_name => 'comment')
|
|
71
|
+
select "<comma> ','", :from => "csv_options_generator_col_sep"
|
|
72
|
+
click_button 'Export to csv'
|
|
73
|
+
should have_content "Id,Commentable,Commentable type,Content,Created at,Updated at"
|
|
74
|
+
should have_content "#{@player.id},#{@player.class}"
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
describe "POST /admin/players/export :format => :csv" do
|
|
79
|
+
it "should export with modified schema" do
|
|
80
|
+
page.driver.post(export_path(:model_name => 'player', :schema => @non_default_schema, :csv => true, :all => true, :csv_options => { :generator => { :col_sep => "," } }))
|
|
81
|
+
should have_content "Id,Updated at,Deleted at,Name,Position,Number,Retired,Injured,Born on,Notes,Suspended" # no created_at
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe "RailsAdmin Basic List" do
|
|
6
|
+
|
|
7
|
+
subject { page }
|
|
8
|
+
|
|
9
|
+
describe "GET /admin" do
|
|
10
|
+
it "should respond successfully" do
|
|
11
|
+
visit dashboard_path
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe "GET /admin/player as list" do
|
|
16
|
+
before(:each) do
|
|
17
|
+
21.times { FactoryGirl.create :player } # two pages of players
|
|
18
|
+
visit index_path(:model_name => "player")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should show \"Select model to edit\", should show filters and should show column headers" do
|
|
22
|
+
should have_content("Select player to edit")
|
|
23
|
+
should have_content("Created at")
|
|
24
|
+
should have_content("Updated at")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "shows the show, edit and delete links" do
|
|
28
|
+
should have_selector("td a", :text => 'Show')
|
|
29
|
+
should have_selector("td a", :text => 'Edit')
|
|
30
|
+
should have_selector("td a", :text => 'Delete')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "has the search box with some prompt text" do
|
|
34
|
+
should have_selector("input[placeholder='Search']")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# https://github.com/sferik/rails_admin/issues/362
|
|
38
|
+
# test that no link uses the "wildcard route" with the main
|
|
39
|
+
# controller and list method
|
|
40
|
+
it "should not use the 'wildcard route'" do
|
|
41
|
+
should have_selector("a[href*='all=true']") # make sure we're fully testing pagination
|
|
42
|
+
should have_no_selector("a[href^='/rails_admin/main/list']")
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe "GET /admin/player with sort" do
|
|
47
|
+
before(:each) do
|
|
48
|
+
@players = 2.times.map { FactoryGirl.create :player }
|
|
49
|
+
visit index_path(:model_name => "player", :sort => "name")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should be sorted correctly" do
|
|
53
|
+
2.times { |i| should have_selector("td", :text => /#{@players[i].name}/) }
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe "GET /admin/player with reverse sort" do
|
|
58
|
+
|
|
59
|
+
before(:each) do
|
|
60
|
+
@players = 2.times.map { FactoryGirl.create :player }
|
|
61
|
+
visit index_path(:model_name => "player", :sort => "name", :sort_reverse => "true")
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "should be sorted correctly" do
|
|
65
|
+
2.times { |i| should have_selector("td", :text => /#{@players.reverse[i].name}/) }
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe "GET /admin/player" do
|
|
70
|
+
before(:each) do
|
|
71
|
+
@teams = 2.times.map do
|
|
72
|
+
FactoryGirl.create(:team)
|
|
73
|
+
end
|
|
74
|
+
@players = [
|
|
75
|
+
FactoryGirl.create(:player, :retired => true, :injured => true, :team => @teams[0]),
|
|
76
|
+
FactoryGirl.create(:player, :retired => true, :injured => false, :team => @teams[0]),
|
|
77
|
+
FactoryGirl.create(:player, :retired => false, :injured => true, :team => @teams[1]),
|
|
78
|
+
FactoryGirl.create(:player, :retired => false, :injured => false, :team => @teams[1]),
|
|
79
|
+
]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "should allow to query on any attribute" do
|
|
83
|
+
visit index_path(:model_name => "player", :query => @players[0].name)
|
|
84
|
+
should have_content(@players[0].name)
|
|
85
|
+
(1..3).each do |i|
|
|
86
|
+
should have_no_content(@players[i].name)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "should allow to filter on one attribute" do
|
|
91
|
+
visit index_path(:model_name => "player", :filters => {:injured => {"1" => {:value => "true"}}})
|
|
92
|
+
should have_content(@players[0].name)
|
|
93
|
+
should have_no_content(@players[1].name)
|
|
94
|
+
should have_content(@players[2].name)
|
|
95
|
+
should have_no_content(@players[3].name)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "should allow to combine filters on two different attributes" do
|
|
99
|
+
visit index_path(:model_name => "player", :filters => {:retired => {"1" => {:value => "true"}}, :injured => {"1" => {:value => "true"}}})
|
|
100
|
+
should have_content(@players[0].name)
|
|
101
|
+
(1..3).each do |i|
|
|
102
|
+
should have_no_content(@players[i].name)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "should allow to filter on belongs_to relationships" do
|
|
107
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => { :value => @teams[0].name }}})
|
|
108
|
+
should have_content(@players[0].name)
|
|
109
|
+
should have_content(@players[1].name)
|
|
110
|
+
should have_no_content(@players[2].name)
|
|
111
|
+
should have_no_content(@players[3].name)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it "should allow to disable search on attributes" do
|
|
115
|
+
RailsAdmin.config Player do
|
|
116
|
+
list do
|
|
117
|
+
field :position
|
|
118
|
+
field :name do
|
|
119
|
+
searchable false
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
visit index_path(:model_name => "player", :query => @players[0].name)
|
|
124
|
+
should have_no_content(@players[0].name)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it "should allow to search a belongs_to attribute over the base table" do
|
|
128
|
+
RailsAdmin.config Player do
|
|
129
|
+
list do
|
|
130
|
+
field :id
|
|
131
|
+
field :name
|
|
132
|
+
field :team do
|
|
133
|
+
searchable Player => :team_id
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.id}}})
|
|
138
|
+
should have_content(@players[0].name)
|
|
139
|
+
should have_content(@players[1].name)
|
|
140
|
+
should have_no_content(@players[2].name)
|
|
141
|
+
should have_no_content(@players[3].name)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
it "should allow to search a belongs_to attribute over the target table" do
|
|
146
|
+
RailsAdmin.config Player do
|
|
147
|
+
list do
|
|
148
|
+
field :id
|
|
149
|
+
field :name
|
|
150
|
+
field :team do
|
|
151
|
+
searchable Team => :name
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.name}}})
|
|
156
|
+
should have_content(@players[0].name)
|
|
157
|
+
should have_content(@players[1].name)
|
|
158
|
+
should have_no_content(@players[2].name)
|
|
159
|
+
should have_no_content(@players[3].name)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "should allow to search a belongs_to attribute over the target table with a table name specified as a hash" do
|
|
163
|
+
RailsAdmin.config Player do
|
|
164
|
+
list do
|
|
165
|
+
field :id
|
|
166
|
+
field :name
|
|
167
|
+
field :team do
|
|
168
|
+
searchable :teams => :name
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.name}}})
|
|
173
|
+
should have_content(@players[0].name)
|
|
174
|
+
should have_content(@players[1].name)
|
|
175
|
+
should have_no_content(@players[2].name)
|
|
176
|
+
should have_no_content(@players[3].name)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
it "should allow to search a belongs_to attribute over the target table with a table name specified as a string" do
|
|
180
|
+
RailsAdmin.config Player do
|
|
181
|
+
list do
|
|
182
|
+
field :id
|
|
183
|
+
field :name
|
|
184
|
+
field :team do
|
|
185
|
+
searchable 'teams.name'
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.name}}})
|
|
190
|
+
should have_content(@players[0].name)
|
|
191
|
+
should have_content(@players[1].name)
|
|
192
|
+
should have_no_content(@players[2].name)
|
|
193
|
+
should have_no_content(@players[3].name)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
it "should allow to search a belongs_to attribute over the label method by default" do
|
|
197
|
+
RailsAdmin.config Player do
|
|
198
|
+
list do
|
|
199
|
+
field :id
|
|
200
|
+
field :name
|
|
201
|
+
field :team
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.name}}})
|
|
205
|
+
should have_content(@players[0].name)
|
|
206
|
+
should have_content(@players[1].name)
|
|
207
|
+
should have_no_content(@players[2].name)
|
|
208
|
+
should have_no_content(@players[3].name)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
it "should allow to search a belongs_to attribute over the target table when an attribute is specified" do
|
|
212
|
+
RailsAdmin.config Player do
|
|
213
|
+
list do
|
|
214
|
+
field :id
|
|
215
|
+
field :name
|
|
216
|
+
field :team do
|
|
217
|
+
searchable :name
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.name}}})
|
|
222
|
+
should have_content(@players[0].name)
|
|
223
|
+
should have_content(@players[1].name)
|
|
224
|
+
should have_no_content(@players[2].name)
|
|
225
|
+
should have_no_content(@players[3].name)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
it "should allow to search over more than one attribute" do
|
|
229
|
+
RailsAdmin.config Player do
|
|
230
|
+
list do
|
|
231
|
+
field :id
|
|
232
|
+
field :name
|
|
233
|
+
field :team do
|
|
234
|
+
searchable [:name, {Player => :team_id}]
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.name}, "2" => {:value => @teams.first.id}}})
|
|
239
|
+
should have_content(@players[0].name)
|
|
240
|
+
should have_content(@players[1].name)
|
|
241
|
+
should have_no_content(@players[2].name)
|
|
242
|
+
should have_no_content(@players[3].name)
|
|
243
|
+
# same with a different id
|
|
244
|
+
visit index_path(:model_name => "player", :filters => {:team => {"1" => {:value => @teams.first.name}, "2" => {:value => @teams.last.id}}})
|
|
245
|
+
should have_no_content(@players[0].name)
|
|
246
|
+
should have_no_content(@players[1].name)
|
|
247
|
+
should have_no_content(@players[2].name)
|
|
248
|
+
should have_no_content(@players[3].name)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
it "should display base filters when no filters are present in the params" do
|
|
252
|
+
RailsAdmin.config Player do
|
|
253
|
+
list do
|
|
254
|
+
filters [:name, :team]
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
visit index_path(:model_name => "player")
|
|
259
|
+
should have_content("$.filters.append('Name', 'name', 'string', '', '', '', false, '1');$.filters.append('Team', 'team', 'belongs_to_association', '', '', '', false, '2');")
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
describe "GET /admin/player with 2 objects" do
|
|
264
|
+
before(:each) do
|
|
265
|
+
@players = 2.times.map { FactoryGirl.create :player }
|
|
266
|
+
visit index_path(:model_name => "player")
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
it "should show \"2 results\"" do
|
|
270
|
+
should have_content("2 players")
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
describe "GET /admin/player with 20 objects" do
|
|
275
|
+
before(:each) do
|
|
276
|
+
@players = 20.times.map { FactoryGirl.create :player }
|
|
277
|
+
visit index_path(:model_name => "player")
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
it "should show \"20 results\"" do
|
|
281
|
+
should have_content("20 players")
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
describe "GET /admin/player with 20 pages, page 8" do
|
|
286
|
+
before(:each) do
|
|
287
|
+
items_per_page = RailsAdmin.config.default_items_per_page
|
|
288
|
+
(items_per_page * 20).times { FactoryGirl.create(:player) }
|
|
289
|
+
visit index_path(:model_name => "player", :page => 8)
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
it "should paginate correctly" do
|
|
293
|
+
find('.pagination ul li:first').should have_content("« Prev")
|
|
294
|
+
find('.pagination ul li:last').should have_content("Next »")
|
|
295
|
+
find('.pagination ul li.active').should have_content("8")
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
describe "list with 20 pages, page 20" do
|
|
300
|
+
before(:each) do
|
|
301
|
+
items_per_page = RailsAdmin.config.default_items_per_page
|
|
302
|
+
@players = (items_per_page * 20).times.map { FactoryGirl.create(:player) }
|
|
303
|
+
visit index_path(:model_name => "player", :page => 20)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
it "should paginate correctly and contain the right item" do
|
|
307
|
+
find('.pagination ul li:first').should have_content("« Prev")
|
|
308
|
+
find('.pagination ul li:last').should have_content("Next »")
|
|
309
|
+
find('.pagination ul li.active').should have_content("20")
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
describe "GET /admin/player show all" do
|
|
314
|
+
it "should respond successfully" do
|
|
315
|
+
2.times.map { FactoryGirl.create :player }
|
|
316
|
+
visit index_path(:model_name => "player", :all => true)
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
describe "list as compact json" do
|
|
321
|
+
it "should have_content an array with 2 elements and contain an array of elements with keys id and label" do
|
|
322
|
+
2.times.map { FactoryGirl.create :player }
|
|
323
|
+
response = page.driver.get(index_path(:model_name => "player", :compact => true, :format => :json))
|
|
324
|
+
ActiveSupport::JSON.decode(response.body).length.should eql(2)
|
|
325
|
+
ActiveSupport::JSON.decode(response.body).each do |object|
|
|
326
|
+
object.should have_key("id")
|
|
327
|
+
object.should have_key("label")
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
describe "search operator" do
|
|
333
|
+
let(:player) { FactoryGirl.create :player }
|
|
334
|
+
|
|
335
|
+
before do
|
|
336
|
+
Player.count.should == 0
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
it "finds the player if the query matches the default search opeartor" do
|
|
340
|
+
RailsAdmin.config do |config|
|
|
341
|
+
config.default_search_operator = 'ends_with'
|
|
342
|
+
config.model Player do
|
|
343
|
+
list { field :name }
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
visit index_path(:model_name => "player", :query => player.name[2, -1])
|
|
347
|
+
should have_content(player.name)
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
it "does not find the player if the query does not match the default search opeartor" do
|
|
351
|
+
RailsAdmin.config do |config|
|
|
352
|
+
config.default_search_operator = 'ends_with'
|
|
353
|
+
config.model Player do
|
|
354
|
+
list { field :name }
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
visit index_path(:model_name => "player", :query => player.name[0, 2])
|
|
358
|
+
should have_no_content(player.name)
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
it "finds the player if the query matches the specified search operator" do
|
|
362
|
+
RailsAdmin.config Player do
|
|
363
|
+
list do
|
|
364
|
+
field :name do
|
|
365
|
+
search_operator 'starts_with'
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
visit index_path(:model_name => "player", :query => player.name[0, 2])
|
|
370
|
+
should have_content(player.name)
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
it "does not find the player if the query does not match the specified search operator" do
|
|
374
|
+
RailsAdmin.config Player do
|
|
375
|
+
list do
|
|
376
|
+
field :name do
|
|
377
|
+
search_operator 'starts_with'
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
visit index_path(:model_name => "player", :query => player.name[1..-1])
|
|
382
|
+
should have_no_content(player.name)
|
|
383
|
+
end
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
describe "list for objects with overridden to_param" do
|
|
387
|
+
before(:each) do
|
|
388
|
+
@ball = FactoryGirl.create :ball
|
|
389
|
+
|
|
390
|
+
visit index_path(:model_name => "ball")
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
it "shows the show, edit and delete links with valid url" do
|
|
394
|
+
should have_selector("td a[href='/admin/ball/#{@ball.id}']")
|
|
395
|
+
should have_selector("td a[href='/admin/ball/#{@ball.id}/edit']")
|
|
396
|
+
should have_selector("td a[href='/admin/ball/#{@ball.id}/delete']")
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
end
|