guara 0.0.1.rc
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/.gitignore +23 -0
- data/.rspec +2 -0
- data/.travis.yml +33 -0
- data/Gemfile +82 -0
- data/Gemfile.lock +323 -0
- data/Guardfile +32 -0
- data/MIT-LICENSE +20 -0
- data/README.md +8 -0
- data/Rakefile +7 -0
- data/app/admin/business_activities.rb +3 -0
- data/app/admin/business_departments.rb +3 -0
- data/app/admin/business_segments.rb +13 -0
- data/app/admin/cities.rb +3 -0
- data/app/admin/company_businesses.rb +3 -0
- data/app/admin/dashboard.rb +39 -0
- data/app/admin/districts.rb +3 -0
- data/app/admin/states.rb +3 -0
- data/app/admin/task_types.rb +3 -0
- data/app/admin/user_groups.rb +3 -0
- data/app/admin/users.rb +3 -0
- data/app/assets/images/close.gif +0 -0
- data/app/assets/images/custom/logo.png +0 -0
- data/app/assets/images/custom/nav_logo.png +0 -0
- data/app/assets/images/custom/nav_logo.psd +0 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/active_admin.js +5 -0
- data/app/assets/javascripts/application.js +97 -0
- data/app/assets/javascripts/business_departments.js.coffee +3 -0
- data/app/assets/javascripts/company_businesses.js.coffee +3 -0
- data/app/assets/javascripts/crm.js.coffee +14 -0
- data/app/assets/javascripts/fcbk.js +556 -0
- data/app/assets/javascripts/jquery-ui-timepicker-addon.js +1326 -0
- data/app/assets/javascripts/jquery.mask.1.3.js +7 -0
- data/app/assets/javascripts/jquery.multiselect.filter.xjs +173 -0
- data/app/assets/javascripts/jquery.multiselect.xjs +668 -0
- data/app/assets/javascripts/system_task_status.js.coffee +3 -0
- data/app/assets/javascripts/tests/ajaxes.js.coffee +3 -0
- data/app/assets/stylesheets/abilities.css.scss +6 -0
- data/app/assets/stylesheets/active_admin.css.scss +65 -0
- data/app/assets/stylesheets/application.css +19 -0
- data/app/assets/stylesheets/business_departments.css.scss +3 -0
- data/app/assets/stylesheets/company_businesses.css.scss +3 -0
- data/app/assets/stylesheets/custom.css.scss +322 -0
- data/app/assets/stylesheets/customer.scss +7 -0
- data/app/assets/stylesheets/fcbk.css +165 -0
- data/app/assets/stylesheets/guara.css.scss +159 -0
- data/app/assets/stylesheets/jquery-ui.css +567 -0
- data/app/assets/stylesheets/jquery_bootstrap.css.scss +92 -0
- data/app/assets/stylesheets/jquery_multiselect_filter.xcss +3 -0
- data/app/assets/stylesheets/scaffolds.css.scss +42 -0
- data/app/assets/stylesheets/users.css.scss +10 -0
- data/app/controllers/abilities_controller.rb +37 -0
- data/app/controllers/application_controller.rb +12 -0
- data/app/controllers/business_activities_controller.rb +87 -0
- data/app/controllers/business_departments_controller.rb +90 -0
- data/app/controllers/business_segments_controller.rb +88 -0
- data/app/controllers/company_businesses_controller.rb +46 -0
- data/app/controllers/contacts_controller.rb +105 -0
- data/app/controllers/customers_controller.rb +117 -0
- data/app/controllers/microposts_controller.rb +31 -0
- data/app/controllers/sessions_controller.rb +32 -0
- data/app/controllers/static_pages_controller.rb +23 -0
- data/app/controllers/system_task_status_controller.rb +84 -0
- data/app/controllers/task_feedbacks_controller.rb +6 -0
- data/app/controllers/task_types_controller.rb +85 -0
- data/app/controllers/tasks_controller.rb +107 -0
- data/app/controllers/tests/ajaxes_controller.rb +115 -0
- data/app/controllers/tests/lab_ajax_controller.rb +27 -0
- data/app/controllers/users_controller.rb +62 -0
- data/app/helpers/ability_helper.rb +15 -0
- data/app/helpers/application_helper.rb +32 -0
- data/app/helpers/business_activities_helper.rb +2 -0
- data/app/helpers/business_departments_helper.rb +2 -0
- data/app/helpers/business_segments_helper.rb +2 -0
- data/app/helpers/company_businesses_helper.rb +2 -0
- data/app/helpers/contacts_helper.rb +2 -0
- data/app/helpers/customers_helper.rb +23 -0
- data/app/helpers/email_helper.rb +8 -0
- data/app/helpers/form_ajax_helper.rb +8 -0
- data/app/helpers/guara_views_helper.rb +38 -0
- data/app/helpers/locale_helper.rb +24 -0
- data/app/helpers/menu_helper.rb +55 -0
- data/app/helpers/sessions_helper.rb +56 -0
- data/app/helpers/tasks_helper.rb +20 -0
- data/app/helpers/tests/ajaxes_helper.rb +2 -0
- data/app/helpers/user_abilities_helper.rb +12 -0
- data/app/helpers/users_helper.rb +29 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/ability.rb +52 -0
- data/app/models/address.rb +7 -0
- data/app/models/business_activity.rb +5 -0
- data/app/models/business_department.rb +3 -0
- data/app/models/business_segment.rb +5 -0
- data/app/models/city.rb +7 -0
- data/app/models/company_business.rb +6 -0
- data/app/models/contact.rb +69 -0
- data/app/models/customer.rb +117 -0
- data/app/models/customer_activity.rb +9 -0
- data/app/models/customer_financial.rb +10 -0
- data/app/models/customer_has_customers.rb +7 -0
- data/app/models/customer_pf.rb +13 -0
- data/app/models/customer_pj.rb +71 -0
- data/app/models/customer_pj_has_customers_pj.rb +7 -0
- data/app/models/customer_product.rb +3 -0
- data/app/models/customer_segment.rb +9 -0
- data/app/models/district.rb +6 -0
- data/app/models/email.rb +7 -0
- data/app/models/micropost.rb +10 -0
- data/app/models/relationship.rb +9 -0
- data/app/models/search.rb +17 -0
- data/app/models/state.rb +3 -0
- data/app/models/system_ability.rb +16 -0
- data/app/models/system_module.rb +16 -0
- data/app/models/system_task_resolution.rb +26 -0
- data/app/models/system_task_status.rb +19 -0
- data/app/models/task.rb +76 -0
- data/app/models/task_feedback.rb +11 -0
- data/app/models/task_type.rb +12 -0
- data/app/models/tests.rb +5 -0
- data/app/models/tests/ajax.rb +3 -0
- data/app/models/user.rb +126 -0
- data/app/models/user_ability.rb +23 -0
- data/app/models/user_group.rb +9 -0
- data/app/models/user_type.rb +9 -0
- data/app/models/users_has_groups.rb +9 -0
- data/app/validators/customer_cnpj_validator.rb +14 -0
- data/app/validators/email_validator.rb +21 -0
- data/app/views/abilities/index.html.erb +25 -0
- data/app/views/active_extend/_one_to_many_inputs.html.erb +7 -0
- data/app/views/active_extend/_one_to_many_inputs_fields.html.erb +10 -0
- data/app/views/active_extend/_one_to_many_inputs_with_glyph.html.erb +21 -0
- data/app/views/business_activities/_business_activity.html.erb +0 -0
- data/app/views/business_activities/_form.html.erb +25 -0
- data/app/views/business_activities/edit.html.erb +6 -0
- data/app/views/business_activities/index.html.erb +33 -0
- data/app/views/business_activities/new.html.erb +5 -0
- data/app/views/business_activities/show.html.erb +15 -0
- data/app/views/business_departments/_form.html.erb +10 -0
- data/app/views/business_departments/edit.html.erb +6 -0
- data/app/views/business_departments/index.html.erb +33 -0
- data/app/views/business_departments/new.html.erb +5 -0
- data/app/views/business_departments/show.html.erb +15 -0
- data/app/views/business_segments/_business_segment.html.erb +8 -0
- data/app/views/business_segments/_form.html.erb +25 -0
- data/app/views/business_segments/edit.html.erb +6 -0
- data/app/views/business_segments/index.html.erb +33 -0
- data/app/views/business_segments/new.html.erb +5 -0
- data/app/views/business_segments/show.html.erb +15 -0
- data/app/views/company_businesses/_form.html.erb +10 -0
- data/app/views/company_businesses/edit.html.erb +6 -0
- data/app/views/company_businesses/index.html.erb +25 -0
- data/app/views/company_businesses/new.html.erb +5 -0
- data/app/views/company_businesses/show.html.erb +15 -0
- data/app/views/contacts/_form.html.erb +53 -0
- data/app/views/contacts/_header.html.erb +3 -0
- data/app/views/contacts/_list.html.erb +46 -0
- data/app/views/contacts/_side_panel.html.erb +61 -0
- data/app/views/contacts/edit.html.erb +6 -0
- data/app/views/contacts/index.html.erb +72 -0
- data/app/views/contacts/new.html.erb +5 -0
- data/app/views/contacts/show.html.erb +52 -0
- data/app/views/customers/_businesses_done.html.erb +18 -0
- data/app/views/customers/_customer_segment.html.erb +9 -0
- data/app/views/customers/_form.html.erb +177 -0
- data/app/views/customers/_form_search.html.erb +119 -0
- data/app/views/customers/_modules.html.erb +6 -0
- data/app/views/customers/_navbar.html.erb +23 -0
- data/app/views/customers/_segment.html.erb +10 -0
- data/app/views/customers/edit.html.erb +8 -0
- data/app/views/customers/index.html.erb +46 -0
- data/app/views/customers/new.pj.html.erb +4 -0
- data/app/views/customers/show.pj.html.erb +200 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +24 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/emails/_email_fields.html.erb +1 -0
- data/app/views/layouts/_active_admin_footer.html.erb +4 -0
- data/app/views/layouts/_active_admin_header.html.erb +5 -0
- data/app/views/layouts/_footer.html.erb +12 -0
- data/app/views/layouts/_header.html.erb +51 -0
- data/app/views/layouts/_shim.html.erb +3 -0
- data/app/views/layouts/active_admin.html.arb +1 -0
- data/app/views/layouts/application.html.erb +24 -0
- data/app/views/microposts/_micropost.html.erb +11 -0
- data/app/views/sessions/new.html.erb +18 -0
- data/app/views/shared/_calendar.html.erb +17 -0
- data/app/views/shared/_error_messages.html.erb +13 -0
- data/app/views/shared/_feed.html.erb +10 -0
- data/app/views/shared/_feed_item.html.erb +15 -0
- data/app/views/shared/_micropost_form.html.erb +7 -0
- data/app/views/shared/_multi_selection.html.erb +16 -0
- data/app/views/shared/_multi_selection.html_checkbox.erb +11 -0
- data/app/views/shared/_multi_selection_autocomple.html.erb +5 -0
- data/app/views/shared/_notifies.html.erb +17 -0
- data/app/views/shared/_user_info.html.erb +14 -0
- data/app/views/static_pages/about.html.erb +5 -0
- data/app/views/static_pages/contact.html.erb +5 -0
- data/app/views/static_pages/help.html.erb +5 -0
- data/app/views/static_pages/home.html.erb +37 -0
- data/app/views/static_pages/news.html.erb +2 -0
- data/app/views/system_task_status/_form.html.erb +9 -0
- data/app/views/system_task_status/edit.html.erb +6 -0
- data/app/views/system_task_status/index.html.erb +23 -0
- data/app/views/system_task_status/new.html.erb +5 -0
- data/app/views/system_task_status/show.html.erb +10 -0
- data/app/views/task_feedbacks/_list.html.erb +51 -0
- data/app/views/task_feedbacks/_side_form.html.erb +56 -0
- data/app/views/task_feedbacks/_side_panel.html.erb +64 -0
- data/app/views/task_types/_form.html.erb +10 -0
- data/app/views/task_types/edit.html.erb +6 -0
- data/app/views/task_types/index.html.erb +23 -0
- data/app/views/task_types/new.html.erb +5 -0
- data/app/views/task_types/show.html.erb +10 -0
- data/app/views/tasks/_form.html.erb +52 -0
- data/app/views/tasks/_header.html.erb +3 -0
- data/app/views/tasks/_list.html.erb +50 -0
- data/app/views/tasks/_side_panel.html.erb +64 -0
- data/app/views/tasks/create.js.erb +1 -0
- data/app/views/tasks/edit.html.erb +6 -0
- data/app/views/tasks/index.html.erb +61 -0
- data/app/views/tasks/new.html.erb +5 -0
- data/app/views/tasks/show.html.erb +46 -0
- data/app/views/tests/ajaxes/_form.html.erb +10 -0
- data/app/views/tests/ajaxes/_list.html.erb +6 -0
- data/app/views/tests/ajaxes/add_and_update.html.erb +22 -0
- data/app/views/tests/ajaxes/all.js.erb +2 -0
- data/app/views/tests/ajaxes/edit.html.erb +6 -0
- data/app/views/tests/ajaxes/index.html.erb +25 -0
- data/app/views/tests/ajaxes/new.html.erb +5 -0
- data/app/views/tests/ajaxes/show.html.erb +15 -0
- data/app/views/tests/js.js +51 -0
- data/app/views/tests/lab_ajax/multiselection.html.erb +84 -0
- data/app/views/users/_user.html.erb +8 -0
- data/app/views/users/edit.html.erb +27 -0
- data/app/views/users/index.html.erb +9 -0
- data/app/views/users/new.html.erb +24 -0
- data/app/views/users/show.html.erb +26 -0
- data/bundle +0 -0
- data/config.ru +4 -0
- data/config/application.rb +73 -0
- data/config/boot.rb +6 -0
- data/config/database.yml +38 -0
- data/config/environment.rb +31 -0
- data/config/environments/development.rb +42 -0
- data/config/environments/production.rb +68 -0
- data/config/environments/test.rb +39 -0
- data/config/guara/menus.rb +34 -0
- data/config/initializers/active_admin.rb +210 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/cmgb_rules.rb +2 -0
- data/config/initializers/devise.rb +216 -0
- data/config/initializers/formtastic.rb +77 -0
- data/config/initializers/inflections.rb +19 -0
- data/config/initializers/json_paches_utf8.rb +13 -0
- data/config/initializers/kaminari.rb +21 -0
- data/config/initializers/locale.rb +7 -0
- data/config/initializers/meta_search.rb +10 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/string.rb +9 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/devise.en.yml +57 -0
- data/config/locales/devise.pt-BR.yml +62 -0
- data/config/locales/pt-BR.yml +404 -0
- data/config/routes.rb +129 -0
- data/db/migrate/20120610142404_create_users.rb +10 -0
- data/db/migrate/20120610183820_add_index_to_users_email.rb +5 -0
- data/db/migrate/20120610185217_add_password_digest_to_users.rb +5 -0
- data/db/migrate/20120612000411_add_remember_token_to_users.rb +6 -0
- data/db/migrate/20120616162515_add_admin_to_users.rb +5 -0
- data/db/migrate/20120616215835_create_microposts.rb +11 -0
- data/db/migrate/20120617224530_create_relationships.rb +14 -0
- data/db/migrate/20120621095918_create_customers.rb +36 -0
- data/db/migrate/20120621100528_create_customer_pfs.rb +14 -0
- data/db/migrate/20120621100534_create_customer_pjs.rb +13 -0
- data/db/migrate/20120621100557_create_emails.rb +13 -0
- data/db/migrate/20120621100618_create_tasks.rb +26 -0
- data/db/migrate/20120621100639_create_customer_products.rb +14 -0
- data/db/migrate/20120621100705_create_districts.rb +11 -0
- data/db/migrate/20120621100720_create_cities.rb +11 -0
- data/db/migrate/20120624192444_create_business_segments.rb +10 -0
- data/db/migrate/20120624224245_create_business_activities.rb +13 -0
- data/db/migrate/20120628092744_create_customer_activities.rb +9 -0
- data/db/migrate/20120628092754_create_customer_segments.rb +9 -0
- data/db/migrate/20120703102859_create_states.rb +10 -0
- data/db/migrate/20120705121011_create_contacts.rb +18 -0
- data/db/migrate/20120711233943_add_devise_to_users.rb +56 -0
- data/db/migrate/20120723102847_create_user_abilities.rb +10 -0
- data/db/migrate/20120723104500_create_system_modules.rb +9 -0
- data/db/migrate/20120723104639_create_system_abilities.rb +9 -0
- data/db/migrate/20120728181903_create_user_groups.rb +10 -0
- data/db/migrate/20120729112600_create_users_has_groups.rb +14 -0
- data/db/migrate/20120729121922_add_groups_to_users.rb +6 -0
- data/db/migrate/20120910002835_create_system_task_status.rb +7 -0
- data/db/migrate/20120910010153_create_system_task_resolutions.rb +7 -0
- data/db/migrate/20120911021535_create_task_types.rb +10 -0
- data/db/migrate/20120911070836_create_task_feedbacks.rb +14 -0
- data/db/migrate/20120924022719_create_tests_ajaxes.rb +10 -0
- data/db/migrate/20121007131035_create_business_departments.rb +10 -0
- data/db/migrate/20121013120849_add_notes_and_other_contacts_to_customer.rb +5 -0
- data/db/migrate/20121014201255_create_company_businesses.rb +10 -0
- data/db/migrate/20121014202449_add_company_business_to_task_type.rb +6 -0
- data/db/migrate/20121014212430_add_primary_company_business_to_user.rb +5 -0
- data/db/migrate/20121015101844_add_parent_id_to_system_task_resolution.rb +5 -0
- data/db/migrate/20121026231241_create_customer_has_customers.rb +10 -0
- data/db/migrate/20121026232755_create_customer_pj_has_customers_pjs.rb +10 -0
- data/db/migrate/20121029094047_create_admin_notes.rb +17 -0
- data/db/migrate/20121029094048_move_admin_notes_to_comments.rb +25 -0
- data/db/migrate/20121103183646_add_enabled_to_cities.rb +5 -0
- data/db/migrate/20121104135014_create_customer_financials.rb +17 -0
- data/db/migrate/20121104141751_create_addresses.rb +19 -0
- data/db/migrate/20121205150619_add_type_id_to_users.rb +5 -0
- data/db/schema.rb~ +378 -0
- data/db/seeds.rb +99 -0
- data/gemfiles/Gemfile.rails.3.2.x +82 -0
- data/guara.gemspec +31 -0
- data/lib/active_extend/README.md +19 -0
- data/lib/active_extend/active_disablable.rb +59 -0
- data/lib/active_extend/string_helper.rb +9 -0
- data/lib/active_migration.rb +4 -0
- data/lib/active_migration/converters/rtf_to_html.rb +123 -0
- data/lib/active_migration/dictionary.rb +19 -0
- data/lib/active_migration/migration.rb +211 -0
- data/lib/active_migration/schemas.rb +143 -0
- data/lib/active_migration/spelling_fix.rb +20 -0
- data/lib/active_migration/transformer/grouped_field_fixed_spelling.rb +110 -0
- data/lib/assets/.gitkeep +0 -0
- data/lib/cmgb_rules/app/models/task.rb +19 -0
- data/lib/guara/version.rb +3 -0
- data/lib/spec/asserts/sheet1.xls +0 -0
- data/lib/spec/lib/active_migration_schemas_spec.rb +40 -0
- data/lib/spec/lib/active_migration_spec.rb +78 -0
- data/lib/spec/spec_helper.rb +121 -0
- data/lib/spec/support/active_migration_helper.rb +109 -0
- data/lib/spec/support/utilities.rb +7 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/add_privilegies.rake +6 -0
- data/lib/tasks/external_migration.rake +22 -0
- data/lib/tasks/sample_data.rake +77 -0
- data/lib/tasks/smaple_data_test.rake +13 -0
- data/lib/templates/erb/scaffold/_form.html.erb +11 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +25 -0
- data/public/data.txt +1 -0
- data/public/favicon.ico +0 -0
- data/public/javascripts/autocomplete-rails.js +16 -0
- data/public/robots.txt +5 -0
- data/script/create_db +5 -0
- data/script/rails +6 -0
- data/script/recreate_db +5 -0
- data/script/recreate_db.bat +9 -0
- data/script/recreate_db_test +5 -0
- data/script/recreate_development_db +10 -0
- data/spec/controllers/business_activities_controller_spec.disabled +167 -0
- data/spec/controllers/business_departments_controller_spec.disabled +164 -0
- data/spec/controllers/business_segments_controller_spec.disabled +165 -0
- data/spec/controllers/company_businesses_controller_spec.disabled +164 -0
- data/spec/controllers/system_task_status_controller_spec.disabled +164 -0
- data/spec/controllers/system_task_status_spec.disabled +11 -0
- data/spec/controllers/task_types_controller_spec.disabled +164 -0
- data/spec/controllers/tasks_controller_spec.disabled +23 -0
- data/spec/controllers/tests/ajaxes_controller_spec.disabled +164 -0
- data/spec/factories.rb +101 -0
- data/spec/factories/addresses.rb +13 -0
- data/spec/factories/business_departments.rb +8 -0
- data/spec/factories/company_businesses.rb +8 -0
- data/spec/factories/customer_financials.rb +11 -0
- data/spec/factories/customer_has_customers.rb +8 -0
- data/spec/factories/customer_pj_has_customers_pjs.rb +8 -0
- data/spec/factories/system_task_resolutions.rb +7 -0
- data/spec/factories/system_task_status.rb +7 -0
- data/spec/factories/task.rb +17 -0
- data/spec/factories/task_feedbacks.rb +19 -0
- data/spec/factories/task_types.rb +8 -0
- data/spec/factories/tests_ajaxes.rb +8 -0
- data/spec/helpers/business_activities_helper_spec.rb +15 -0
- data/spec/helpers/business_departments_helper_spec.rb +15 -0
- data/spec/helpers/business_segments_helper_spec.rb +15 -0
- data/spec/helpers/company_businesses_helper_spec.rb +15 -0
- data/spec/helpers/customers/contacts_helper_spec.rb +15 -0
- data/spec/helpers/menu_helper_spec.rb +25 -0
- data/spec/helpers/tests/ajaxes_helper_spec.rb +15 -0
- data/spec/helpers/users_helpers_spec.rb +32 -0
- data/spec/models/address_spec.rb +5 -0
- data/spec/models/business_activity_spec.rb +5 -0
- data/spec/models/business_department_spec.rb +5 -0
- data/spec/models/business_segment_spec.rb +5 -0
- data/spec/models/city_spec.rb +5 -0
- data/spec/models/company_business_spec.rb +19 -0
- data/spec/models/contact_spec.rb +60 -0
- data/spec/models/customer_activity_spec.rb +5 -0
- data/spec/models/customer_financial_spec.rb +48 -0
- data/spec/models/customer_has_customers_spec.rb +18 -0
- data/spec/models/customer_pf_spec.rb +24 -0
- data/spec/models/customer_pj_has_customers_pj_spec.rb +34 -0
- data/spec/models/customer_pj_spec.rb +72 -0
- data/spec/models/customer_product_spec.rb +5 -0
- data/spec/models/customer_segment_spec.rb +5 -0
- data/spec/models/customer_spec.rb +135 -0
- data/spec/models/district_spec.rb +5 -0
- data/spec/models/emails_spec.rb +24 -0
- data/spec/models/micropost_spec.rb +49 -0
- data/spec/models/relationship_spec.rb +38 -0
- data/spec/models/state_spec.rb +5 -0
- data/spec/models/system_ability_spec.rb +5 -0
- data/spec/models/system_module_spec.rb +5 -0
- data/spec/models/system_task_resolution_spec.rb +17 -0
- data/spec/models/system_task_status_spec.rb +17 -0
- data/spec/models/task_feedback_spec.rb +46 -0
- data/spec/models/task_spec.rb +176 -0
- data/spec/models/task_type_spec.rb +27 -0
- data/spec/models/tests/ajax_spec.rb +5 -0
- data/spec/models/user_ability_spec.rb +35 -0
- data/spec/models/user_group_spec.rb +26 -0
- data/spec/models/user_spec.rb +274 -0
- data/spec/models/users_has_groups_spec.rb +29 -0
- data/spec/requests/authentication_pages_spec.rb +157 -0
- data/spec/requests/business_activities_spec.rb +7 -0
- data/spec/requests/business_departments_spec.rb +7 -0
- data/spec/requests/business_segments_spec.rb +7 -0
- data/spec/requests/company_businesses_spec.rb +11 -0
- data/spec/requests/customer_contacts_pages_spec.rb +96 -0
- data/spec/requests/customer_pages_spec.rb +60 -0
- data/spec/requests/micropost_pages_spec.rb +58 -0
- data/spec/requests/static_pages_spec.rb +57 -0
- data/spec/requests/task_pages_spec.rb +124 -0
- data/spec/requests/tests/tests_ajaxes_spec.rb +11 -0
- data/spec/requests/user_abilities_pages_spec.rb +73 -0
- data/spec/requests/user_pages_spec.rb +116 -0
- data/spec/routing/business_activities_routing_spec.rb +35 -0
- data/spec/routing/business_departments_routing_spec.rb +35 -0
- data/spec/routing/business_segments_routing_spec.rb +35 -0
- data/spec/routing/company_businesses_routing_spec.rb +35 -0
- data/spec/routing/system_task_status_routing_spec.rb +35 -0
- data/spec/routing/task_types_routing_spec.rb +35 -0
- data/spec/routing/tests/ajaxes_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +123 -0
- data/spec/support/custom_matchers.rb +9 -0
- data/spec/support/utilities.rb +120 -0
- data/spec/views/business_departments/edit.html.erb_spec.rb +20 -0
- data/spec/views/business_departments/index.html.erb_spec.disabled +23 -0
- data/spec/views/business_departments/new.html.erb_spec.rb +20 -0
- data/spec/views/business_departments/show.html.erb_spec.rb +17 -0
- data/spec/views/company_businesses/edit.html.erb_spec.rb +20 -0
- data/spec/views/company_businesses/index.html.erb_spec.rb +23 -0
- data/spec/views/company_businesses/new.html.erb_spec.rb +20 -0
- data/spec/views/company_businesses/show.html.erb_spec.rb +17 -0
- data/spec/views/task_types/edit.html.erb_spec.rb +18 -0
- data/spec/views/task_types/index.html.erb_spec.rb +20 -0
- data/spec/views/task_types/new.html.erb_spec.rb +18 -0
- data/spec/views/task_types/show.html.erb_spec.rb +15 -0
- data/test/fixtures/.gitkeep +0 -0
- data/test/functional/.gitkeep +0 -0
- data/test/integration/.gitkeep +0 -0
- data/test/performance/browsing_test.rb +12 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/.gitkeep +0 -0
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/active_admin/_base.css.scss +45 -0
- data/vendor/assets/stylesheets/active_admin/_forms.css.scss +270 -0
- data/vendor/assets/stylesheets/active_admin/_header.css.scss +137 -0
- data/vendor/assets/stylesheets/active_admin/_mixins.css.scss +1 -0
- data/vendor/assets/stylesheets/active_admin/_typography.css.scss +100 -0
- data/vendor/assets/stylesheets/active_admin/components/_batch_actions.css.scss +11 -0
- data/vendor/assets/stylesheets/active_admin/components/_blank_slates.scss +31 -0
- data/vendor/assets/stylesheets/active_admin/components/_breadcrumbs.scss +20 -0
- data/vendor/assets/stylesheets/active_admin/components/_buttons.scss +11 -0
- data/vendor/assets/stylesheets/active_admin/components/_columns.scss +3 -0
- data/vendor/assets/stylesheets/active_admin/components/_comments.css.scss +40 -0
- data/vendor/assets/stylesheets/active_admin/components/_date_picker.css.scss +123 -0
- data/vendor/assets/stylesheets/active_admin/components/_dropdown_menu.scss +151 -0
- data/vendor/assets/stylesheets/active_admin/components/_flash_messages.css.scss +39 -0
- data/vendor/assets/stylesheets/active_admin/components/_grid.scss +9 -0
- data/vendor/assets/stylesheets/active_admin/components/_links.scss +5 -0
- data/vendor/assets/stylesheets/active_admin/components/_pagination.scss +34 -0
- data/vendor/assets/stylesheets/active_admin/components/_panels.scss +6 -0
- data/vendor/assets/stylesheets/active_admin/components/_popovers.css.scss +123 -0
- data/vendor/assets/stylesheets/active_admin/components/_scopes.scss +10 -0
- data/vendor/assets/stylesheets/active_admin/components/_status_tags.scss +12 -0
- data/vendor/assets/stylesheets/active_admin/components/_table_tools.css.scss +94 -0
- data/vendor/assets/stylesheets/active_admin/components/_tables.css.scss +108 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_all.css.scss +11 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_buttons.css.scss +66 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_gradients.css.scss +37 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_icons.css.scss +24 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_reset.css.scss +165 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_rounded.css.scss +43 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_sections.css.scss +36 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_shadows.css.scss +22 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_typography.scss +3 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_utilities.scss +26 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_variables.css.scss +24 -0
- data/vendor/assets/stylesheets/active_admin/pages/_dashboard.scss +5 -0
- data/vendor/assets/stylesheets/active_admin/pages/_logged_out.scss +44 -0
- data/vendor/assets/stylesheets/active_admin/print.css.scss +290 -0
- data/vendor/assets/stylesheets/active_admin/structure/_footer.scss +14 -0
- data/vendor/assets/stylesheets/active_admin/structure/_main_structure.scss +26 -0
- data/vendor/assets/stylesheets/active_admin/structure/_title_bar.scss +44 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +731 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#encoding: utf-8
|
|
2
|
+
namespace :db do
|
|
3
|
+
desc "Fill database with sample data"
|
|
4
|
+
task populate_test: :environment do
|
|
5
|
+
|
|
6
|
+
FileTest.exist? File.dirname(__FILE__) + '/../../spec/factories.rb'
|
|
7
|
+
|
|
8
|
+
require File.dirname(__FILE__) + '/../../spec/factories.rb'
|
|
9
|
+
5.times { Factory(:customer_pj) }
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%%= semantic_form_for @<%= singular_name %> do |f| %>
|
|
2
|
+
<%%= f.inputs do %>
|
|
3
|
+
<%- attributes.each do |attribute| -%>
|
|
4
|
+
<%%= f.input :<%= attribute.name %> %>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
<%% end %>
|
|
7
|
+
|
|
8
|
+
<%%= f.actions do %>
|
|
9
|
+
<%%= f.action :submit, :as => :input %>
|
|
10
|
+
<%% end %>
|
|
11
|
+
<%% end %>
|
data/public/404.html
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/404.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
data/public/422.html
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/422.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
data/public/500.html
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/500.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
23
|
+
</div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
data/public/data.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"key": "hello world", "value": "hello world"}, {"key": "movies", "value": "movies"}, {"key": "ski", "value": "ski"}, {"key": "snowbord", "value": "snowbord"}, {"key": "computer", "value": "computer"}, {"key": "apple", "value": "apple"}, {"key": "pc", "value": "pc"}, {"key": "ipod", "value": "ipod"}, {"key": "ipad", "value": "ipad"}, {"key": "iphone", "value": "iphone"}, {"key": "iphon4", "value": "iphone4"}, {"key": "iphone5", "value": "iphone5"}, {"key": "samsung", "value": "samsung"}, {"key": "blackberry", "value": "blackberry"}]
|
data/public/favicon.ico
ADDED
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unobtrusive autocomplete
|
|
3
|
+
*
|
|
4
|
+
* To use it, you just have to include the HTML attribute autocomplete
|
|
5
|
+
* with the autocomplete URL as the value
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
* <input type="text" data-autocomplete="/url/to/autocomplete">
|
|
9
|
+
*
|
|
10
|
+
* Optionally, you can use a jQuery selector to specify a field that can
|
|
11
|
+
* be updated with the element id whenever you find a matching value
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* <input type="text" data-autocomplete="/url/to/autocomplete" data-id-element="#id_field">
|
|
15
|
+
*/
|
|
16
|
+
(function(a){var b=null;a.fn.railsAutocomplete=function(){return this.live("focus",function(){this.railsAutoCompleter||(this.railsAutoCompleter=new a.railsAutocomplete(this))})},a.railsAutocomplete=function(a){_e=a,this.init(_e)},a.railsAutocomplete.fn=a.railsAutocomplete.prototype={railsAutocomplete:"0.0.1"},a.railsAutocomplete.fn.extend=a.railsAutocomplete.extend=a.extend,a.railsAutocomplete.fn.extend({init:function(b){function c(a){return a.split(b.delimiter)}function d(a){return c(a).pop().replace(/^\s+/,"")}b.delimiter=a(b).attr("data-delimiter")||null,a(b).autocomplete({source:function(c,f){a.getJSON(a(b).attr("data-autocomplete"),{term:d(c.term)},function(){a(arguments[0]).each(function(c,d){var f={};f[d.id]=d,a(b).data(f)}),f.apply(null,arguments)})},search:function(){var a=d(this.value);if(a.length<2)return!1},focus:function(){return!1},select:function(d,f){var g=c(this.value);g.pop(),g.push(f.item.value);if(b.delimiter!=null)g.push(""),this.value=g.join(b.delimiter);else{this.value=g.join(""),a(this).attr("data-id-element")&&a(a(this).attr("data-id-element")).val(f.item.id);if(a(this).attr("data-update-elements")){var h=a(this).data(f.item.id.toString()),i=a.parseJSON(a(this).attr("data-update-elements"));for(var j in i)a(i[j]).val(h[j])}}var k=this.value;return a(this).bind("keyup.clearId",function(){a(this).val().trim()!=k.trim()&&(a(a(this).attr("data-id-element")).val(""),a(this).unbind("keyup.clearId"))}),a(this).trigger("railsAutocomplete.select",f),!1}})}}),a(document).ready(function(){a("input[data-autocomplete]").railsAutocomplete()})})(jQuery);
|
data/public/robots.txt
ADDED
data/script/create_db
ADDED
data/script/rails
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
|
6
|
+
require 'rails/commands'
|
data/script/recreate_db
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
|
6
|
+
#
|
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
|
9
|
+
# controller code, this generated spec may or may not pass.
|
|
10
|
+
#
|
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
|
14
|
+
#
|
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
|
19
|
+
# that an instance is receiving a specific message.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
describe BusinessActivitiesController do
|
|
23
|
+
|
|
24
|
+
# This should return the minimal set of attributes required to create a valid
|
|
25
|
+
# BusinessActivity. As you add validations to BusinessActivity, be sure to
|
|
26
|
+
# update the return value of this method accordingly.
|
|
27
|
+
def valid_attributes
|
|
28
|
+
{}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# This should return the minimal set of values that should be in the session
|
|
32
|
+
# in order to pass any filters (e.g. authentication) defined in
|
|
33
|
+
# BusinessActivitiesController. Be sure to keep this updated too.
|
|
34
|
+
def valid_session
|
|
35
|
+
{}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
describe "GET index" do
|
|
40
|
+
it "assigns all business_activities as @business_activities" do
|
|
41
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
42
|
+
get :index, {}, valid_session
|
|
43
|
+
assigns(:business_activities).should eq([business_activity])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe "GET show" do
|
|
48
|
+
it "assigns the requested business_activity as @business_activity" do
|
|
49
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
50
|
+
get :show, {:id => business_activity.to_param}, valid_session
|
|
51
|
+
assigns(:business_activity).should eq(business_activity)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe "GET new" do
|
|
56
|
+
it "assigns a new business_activity as @business_activity" do
|
|
57
|
+
get :new, {}, valid_session
|
|
58
|
+
assigns(:business_activity).should be_a_new(BusinessActivity)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe "GET edit" do
|
|
63
|
+
it "assigns the requested business_activity as @business_activity" do
|
|
64
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
65
|
+
get :edit, {:id => business_activity.to_param}, valid_session
|
|
66
|
+
assigns(:business_activity).should eq(business_activity)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
describe "POST create" do
|
|
71
|
+
describe "with valid params" do
|
|
72
|
+
it "creates a new BusinessActivity" do
|
|
73
|
+
expect {
|
|
74
|
+
post :create, {:business_activity => valid_attributes}, valid_session
|
|
75
|
+
}.to change(BusinessActivity, :count).by(1)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "assigns a newly created business_activity as @business_activity" do
|
|
79
|
+
post :create, {:business_activity => valid_attributes}, valid_session
|
|
80
|
+
assigns(:business_activity).should be_a(BusinessActivity)
|
|
81
|
+
assigns(:business_activity).should be_persisted
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "redirects to the created business_activity" do
|
|
85
|
+
post :create, {:business_activity => valid_attributes}, valid_session
|
|
86
|
+
response.should redirect_to(BusinessActivity.last)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
describe "with invalid params" do
|
|
91
|
+
it "assigns a newly created but unsaved business_activity as @business_activity" do
|
|
92
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
93
|
+
BusinessActivity.any_instance.stub(:save).and_return(false)
|
|
94
|
+
post :create, {:business_activity => {}}, valid_session
|
|
95
|
+
assigns(:business_activity).should be_a_new(BusinessActivity)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "re-renders the 'new' template" do
|
|
99
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
100
|
+
BusinessActivity.any_instance.stub(:save).and_return(false)
|
|
101
|
+
post :create, {:business_activity => {}}, valid_session
|
|
102
|
+
response.should render_template("new")
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
describe "PUT update" do
|
|
108
|
+
describe "with valid params" do
|
|
109
|
+
it "updates the requested business_activity" do
|
|
110
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
111
|
+
# Assuming there are no other business_activities in the database, this
|
|
112
|
+
# specifies that the BusinessActivity created on the previous line
|
|
113
|
+
# receives the :update_attributes message with whatever params are
|
|
114
|
+
# submitted in the request.
|
|
115
|
+
BusinessActivity.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
|
116
|
+
put :update, {:id => business_activity.to_param, :business_activity => {'these' => 'params'}}, valid_session
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it "assigns the requested business_activity as @business_activity" do
|
|
120
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
121
|
+
put :update, {:id => business_activity.to_param, :business_activity => valid_attributes}, valid_session
|
|
122
|
+
assigns(:business_activity).should eq(business_activity)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it "redirects to the business_activity" do
|
|
126
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
127
|
+
put :update, {:id => business_activity.to_param, :business_activity => valid_attributes}, valid_session
|
|
128
|
+
response.should redirect_to(business_activity)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
describe "with invalid params" do
|
|
133
|
+
it "assigns the business_activity as @business_activity" do
|
|
134
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
135
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
136
|
+
BusinessActivity.any_instance.stub(:save).and_return(false)
|
|
137
|
+
put :update, {:id => business_activity.to_param, :business_activity => {}}, valid_session
|
|
138
|
+
assigns(:business_activity).should eq(business_activity)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "re-renders the 'edit' template" do
|
|
142
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
143
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
144
|
+
BusinessActivity.any_instance.stub(:save).and_return(false)
|
|
145
|
+
put :update, {:id => business_activity.to_param, :business_activity => {}}, valid_session
|
|
146
|
+
response.should render_template("edit")
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
describe "DELETE destroy" do
|
|
152
|
+
it "destroys the requested business_activity" do
|
|
153
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
154
|
+
expect {
|
|
155
|
+
delete :destroy, {:id => business_activity.to_param}, valid_session
|
|
156
|
+
}.to change(BusinessActivity, :count).by(-1)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it "redirects to the business_activities list" do
|
|
160
|
+
business_activity = BusinessActivity.create! valid_attributes
|
|
161
|
+
delete :destroy, {:id => business_activity.to_param}, valid_session
|
|
162
|
+
response.should redirect_to(business_activities_url)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
end
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
|
6
|
+
#
|
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
|
9
|
+
# controller code, this generated spec may or may not pass.
|
|
10
|
+
#
|
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
|
14
|
+
#
|
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
|
19
|
+
# that an instance is receiving a specific message.
|
|
20
|
+
|
|
21
|
+
describe BusinessDepartmentsController do
|
|
22
|
+
|
|
23
|
+
# This should return the minimal set of attributes required to create a valid
|
|
24
|
+
# BusinessDepartment. As you add validations to BusinessDepartment, be sure to
|
|
25
|
+
# update the return value of this method accordingly.
|
|
26
|
+
def valid_attributes
|
|
27
|
+
{}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# This should return the minimal set of values that should be in the session
|
|
31
|
+
# in order to pass any filters (e.g. authentication) defined in
|
|
32
|
+
# BusinessDepartmentsController. Be sure to keep this updated too.
|
|
33
|
+
def valid_session
|
|
34
|
+
{}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "GET index" do
|
|
38
|
+
it "assigns all business_departments as @business_departments" do
|
|
39
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
40
|
+
get :index, {}, valid_session
|
|
41
|
+
assigns(:business_departments).should eq([business_department])
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe "GET show" do
|
|
46
|
+
it "assigns the requested business_department as @business_department" do
|
|
47
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
48
|
+
get :show, {:id => business_department.to_param}, valid_session
|
|
49
|
+
assigns(:business_department).should eq(business_department)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe "GET new" do
|
|
54
|
+
it "assigns a new business_department as @business_department" do
|
|
55
|
+
get :new, {}, valid_session
|
|
56
|
+
assigns(:business_department).should be_a_new(BusinessDepartment)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
describe "GET edit" do
|
|
61
|
+
it "assigns the requested business_department as @business_department" do
|
|
62
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
63
|
+
get :edit, {:id => business_department.to_param}, valid_session
|
|
64
|
+
assigns(:business_department).should eq(business_department)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
describe "POST create" do
|
|
69
|
+
describe "with valid params" do
|
|
70
|
+
it "creates a new BusinessDepartment" do
|
|
71
|
+
expect {
|
|
72
|
+
post :create, {:business_department => valid_attributes}, valid_session
|
|
73
|
+
}.to change(BusinessDepartment, :count).by(1)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "assigns a newly created business_department as @business_department" do
|
|
77
|
+
post :create, {:business_department => valid_attributes}, valid_session
|
|
78
|
+
assigns(:business_department).should be_a(BusinessDepartment)
|
|
79
|
+
assigns(:business_department).should be_persisted
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "redirects to the created business_department" do
|
|
83
|
+
post :create, {:business_department => valid_attributes}, valid_session
|
|
84
|
+
response.should redirect_to(BusinessDepartment.last)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
describe "with invalid params" do
|
|
89
|
+
it "assigns a newly created but unsaved business_department as @business_department" do
|
|
90
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
91
|
+
BusinessDepartment.any_instance.stub(:save).and_return(false)
|
|
92
|
+
post :create, {:business_department => {}}, valid_session
|
|
93
|
+
assigns(:business_department).should be_a_new(BusinessDepartment)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "re-renders the 'new' template" do
|
|
97
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
98
|
+
BusinessDepartment.any_instance.stub(:save).and_return(false)
|
|
99
|
+
post :create, {:business_department => {}}, valid_session
|
|
100
|
+
response.should render_template("new")
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
describe "PUT update" do
|
|
106
|
+
describe "with valid params" do
|
|
107
|
+
it "updates the requested business_department" do
|
|
108
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
109
|
+
# Assuming there are no other business_departments in the database, this
|
|
110
|
+
# specifies that the BusinessDepartment created on the previous line
|
|
111
|
+
# receives the :update_attributes message with whatever params are
|
|
112
|
+
# submitted in the request.
|
|
113
|
+
BusinessDepartment.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
|
114
|
+
put :update, {:id => business_department.to_param, :business_department => {'these' => 'params'}}, valid_session
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
it "assigns the requested business_department as @business_department" do
|
|
118
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
119
|
+
put :update, {:id => business_department.to_param, :business_department => valid_attributes}, valid_session
|
|
120
|
+
assigns(:business_department).should eq(business_department)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it "redirects to the business_department" do
|
|
124
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
125
|
+
put :update, {:id => business_department.to_param, :business_department => valid_attributes}, valid_session
|
|
126
|
+
response.should redirect_to(business_department)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
describe "with invalid params" do
|
|
131
|
+
it "assigns the business_department as @business_department" do
|
|
132
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
133
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
134
|
+
BusinessDepartment.any_instance.stub(:save).and_return(false)
|
|
135
|
+
put :update, {:id => business_department.to_param, :business_department => {}}, valid_session
|
|
136
|
+
assigns(:business_department).should eq(business_department)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it "re-renders the 'edit' template" do
|
|
140
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
141
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
142
|
+
BusinessDepartment.any_instance.stub(:save).and_return(false)
|
|
143
|
+
put :update, {:id => business_department.to_param, :business_department => {}}, valid_session
|
|
144
|
+
response.should render_template("edit")
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
describe "DELETE destroy" do
|
|
150
|
+
it "destroys the requested business_department" do
|
|
151
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
152
|
+
expect {
|
|
153
|
+
delete :destroy, {:id => business_department.to_param}, valid_session
|
|
154
|
+
}.to change(BusinessDepartment, :count).by(-1)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it "redirects to the business_departments list" do
|
|
158
|
+
business_department = BusinessDepartment.create! valid_attributes
|
|
159
|
+
delete :destroy, {:id => business_department.to_param}, valid_session
|
|
160
|
+
response.should redirect_to(business_departments_url)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
end
|