From 796c1a279e418b9ce79e3bb0d7c4b9fd0b86f351 Mon Sep 17 00:00:00 2001 From: Alinson S Xavier Date: Fri, 12 Jul 2013 15:54:20 -0400 Subject: [PATCH] Gemify and upgrade to shoulda-2.11.3, remove dr_nic_magic_models --- config/environment.rb | 2 +- doc/environment.txt | 7 +- .../functional/attachments_controller_test.rb | 36 +- test/functional/courses_controller_test.rb | 8 +- test/functional/user_controller_test.rb | 8 +- test/functional/wiki_controller_test.rb | 52 +- .../dr_nic_magic_models-0.9.2/.specification | 107 ---- .../gems/dr_nic_magic_models-0.9.2/CHANGELOG | 9 - .../dr_nic_magic_models-0.9.2/History.txt | 28 - .../dr_nic_magic_models-0.9.2/Manifest.txt | 56 -- vendor/gems/dr_nic_magic_models-0.9.2/README | 294 --------- .../gems/dr_nic_magic_models-0.9.2/Rakefile | 134 ---- vendor/gems/dr_nic_magic_models-0.9.2/init.rb | 3 - .../gems/dr_nic_magic_models-0.9.2/install.rb | 30 - .../dr_nic_magic_models-0.9.2/lib/base.rb | 12 - .../abstract/schema_statements.rb | 0 .../connection_adapters/abstract_adapter.rb | 32 - .../lib/connection_adapters/mysql_adapter.rb | 42 -- .../connection_adapters/postgresql_adapter.rb | 45 -- .../lib/dr_nic_magic_models.rb | 34 - .../lib/dr_nic_magic_models/inflector.rb | 14 - .../lib/dr_nic_magic_models/magic_model.rb | 133 ---- .../lib/dr_nic_magic_models/schema.rb | 270 -------- .../lib/dr_nic_magic_models/validations.rb | 46 -- .../lib/dr_nic_magic_models/version.rb | 9 - .../dr_nic_magic_models-0.9.2/lib/module.rb | 33 - .../dr_nic_magic_models-0.9.2/lib/rails.rb | 19 - .../scripts/txt2html | 66 -- .../dr_nic_magic_models-0.9.2/scripts/txt2js | 58 -- vendor/gems/dr_nic_magic_models-0.9.2/test.db | Bin 17408 -> 0 bytes .../test/abstract_unit.rb | 72 --- .../connections/native_mysql/connection.rb | 13 - .../native_postgresql/connection.rb | 12 - .../connections/native_sqlite/connection.rb | 10 - .../test/dummy_test.rb | 13 - .../test/env_test.rb | 10 - .../test/fixtures/.DS_Store | Bin 6148 -> 0 bytes .../test/fixtures/adjectives.yml | 3 - .../test/fixtures/adjectives_fun_users.yml | 3 - .../fixtures/db_definitions/mysql.drop.sql | 4 - .../test/fixtures/db_definitions/mysql.sql | 56 -- .../fixtures/db_definitions/postgresql.sql | 55 -- .../test/fixtures/db_definitions/sqlite.sql | 49 -- .../test/fixtures/fun_users.yml | 14 - .../test/fixtures/group_memberships.yml | 4 - .../test/fixtures/group_tag.yml | 11 - .../test/fixtures/groups.yml | 12 - .../test/foreign_keys_test.rb | 0 .../test/fun_user_plus.rb | 2 - .../test/invisible_model_access_test.rb | 71 --- .../test/invisible_model_assoc_test.rb | 61 -- .../test/invisible_model_classes_test.rb | 23 - .../test/magic_module_test.rb | 20 - .../test/test_existing_model.rb | 20 - .../website/index.html | 404 ------------ .../website/index.txt | 291 --------- .../javascripts/rounded_corners_lite.inc.js | 285 --------- .../website/stylesheets/screen.css | 96 --- .../website/template.js | 3 - .../website/template.rhtml | 55 -- .../website/version-raw.js | 3 - .../website/version-raw.txt | 2 - .../website/version.js | 4 - .../website/version.txt | 3 - .../thoughtbot-shoulda-2.10.1/.specification | 258 -------- .../CONTRIBUTION_GUIDELINES.rdoc | 12 - .../thoughtbot-shoulda-2.10.1/MIT-LICENSE | 22 - .../thoughtbot-shoulda-2.10.1/README.rdoc | 169 ----- .../gems/thoughtbot-shoulda-2.10.1/Rakefile | 72 --- .../bin/convert_to_should_syntax | 42 -- .../thoughtbot-shoulda-2.10.1/lib/shoulda.rb | 9 - .../lib/shoulda/action_controller.rb | 32 - .../shoulda/action_controller/formats/html.rb | 199 ------ .../shoulda/action_controller/formats/xml.rb | 168 ----- .../lib/shoulda/action_controller/helpers.rb | 64 -- .../lib/shoulda/action_controller/macros.rb | 296 --------- .../lib/shoulda/action_controller/matchers.rb | 37 -- .../matchers/assign_to_matcher.rb | 109 ---- .../matchers/filter_param_matcher.rb | 57 -- .../matchers/render_with_layout_matcher.rb | 81 --- .../respond_with_content_type_matcher.rb | 70 --- .../matchers/respond_with_matcher.rb | 81 --- .../matchers/route_matcher.rb | 93 --- .../matchers/set_session_matcher.rb | 87 --- .../matchers/set_the_flash_matcher.rb | 85 --- .../action_controller/resource_options.rb | 233 ------- .../lib/shoulda/action_mailer.rb | 10 - .../lib/shoulda/action_mailer/assertions.rb | 38 -- .../lib/shoulda/action_view.rb | 10 - .../lib/shoulda/action_view/macros.rb | 56 -- .../lib/shoulda/active_record.rb | 16 - .../lib/shoulda/active_record/assertions.rb | 69 -- .../lib/shoulda/active_record/helpers.rb | 40 -- .../lib/shoulda/active_record/macros.rb | 589 ------------------ .../lib/shoulda/active_record/matchers.rb | 42 -- .../allow_mass_assignment_of_matcher.rb | 83 --- .../matchers/allow_value_matcher.rb | 102 --- .../matchers/association_matcher.rb | 226 ------- .../matchers/ensure_inclusion_of_matcher.rb | 87 --- .../matchers/ensure_length_of_matcher.rb | 141 ----- .../matchers/have_db_column_matcher.rb | 169 ----- .../matchers/have_index_matcher.rb | 105 ---- .../matchers/have_named_scope_matcher.rb | 125 ---- .../have_readonly_attribute_matcher.rb | 59 -- .../validate_acceptance_of_matcher.rb | 41 -- .../validate_numericality_of_matcher.rb | 39 -- .../matchers/validate_presence_of_matcher.rb | 60 -- .../validate_uniqueness_of_matcher.rb | 148 ----- .../matchers/validation_matcher.rb | 56 -- .../lib/shoulda/assertions.rb | 59 -- .../lib/shoulda/autoload_macros.rb | 46 -- .../lib/shoulda/context.rb | 304 --------- .../lib/shoulda/helpers.rb | 8 - .../lib/shoulda/macros.rb | 73 --- .../lib/shoulda/private_helpers.rb | 20 - .../lib/shoulda/proc_extensions.rb | 14 - .../lib/shoulda/rails.rb | 13 - .../lib/shoulda/rspec.rb | 11 - .../lib/shoulda/tasks.rb | 3 - .../lib/shoulda/tasks/list_tests.rake | 29 - .../lib/shoulda/tasks/yaml_to_shoulda.rake | 28 - .../lib/shoulda/test_unit.rb | 19 - .../thoughtbot-shoulda-2.10.1/rails/init.rb | 7 - .../thoughtbot-shoulda-2.10.1/test/README | 36 -- .../test/fail_macros.rb | 34 - .../test/fixtures/addresses.yml | 3 - .../test/fixtures/friendships.yml | 0 .../test/fixtures/posts.yml | 5 - .../test/fixtures/products.yml | 0 .../test/fixtures/taggings.yml | 0 .../test/fixtures/tags.yml | 9 - .../test/fixtures/users.yml | 6 - .../test/functional/posts_controller_test.rb | 125 ---- .../test/functional/users_controller_test.rb | 19 - .../allow_mass_assignment_of_matcher_test.rb | 68 -- .../active_record/allow_value_matcher_test.rb | 41 -- .../active_record/association_matcher_test.rb | 258 -------- .../ensure_inclusion_of_matcher_test.rb | 80 --- .../ensure_length_of_matcher_test.rb | 158 ----- .../have_db_column_matcher_test.rb | 169 ----- .../active_record/have_index_matcher_test.rb | 74 --- .../have_named_scope_matcher_test.rb | 65 -- .../have_readonly_attributes_matcher_test.rb | 29 - .../validate_acceptance_of_matcher_test.rb | 44 -- .../validate_numericality_of_matcher_test.rb | 52 -- .../validate_presence_of_matcher_test.rb | 86 --- .../validate_uniqueness_of_matcher_test.rb | 147 ----- .../controller/assign_to_matcher_test.rb | 35 -- .../controller/filter_param_matcher_test.rb | 32 - .../render_with_layout_matcher_test.rb | 33 - .../respond_with_content_type_matcher_test.rb | 27 - .../controller/respond_with_matcher_test.rb | 106 ---- .../matchers/controller/route_matcher_test.rb | 58 -- .../controller/set_session_matcher_test.rb | 31 - .../controller/set_the_flash_matcher.rb | 41 -- .../test/model_builder.rb | 106 ---- .../test/other/autoload_macro_test.rb | 18 - .../test/other/context_test.rb | 145 ----- .../other/convert_to_should_syntax_test.rb | 63 -- .../test/other/helpers_test.rb | 241 ------- .../test/other/private_helpers_test.rb | 34 - .../test/other/should_test.rb | 266 -------- .../rails_root/app/controllers/application.rb | 25 - .../app/controllers/posts_controller.rb | 86 --- .../app/controllers/users_controller.rb | 84 --- .../app/helpers/application_helper.rb | 3 - .../rails_root/app/helpers/posts_helper.rb | 2 - .../rails_root/app/helpers/users_helper.rb | 2 - .../test/rails_root/app/models/address.rb | 7 - .../test/rails_root/app/models/flea.rb | 3 - .../test/rails_root/app/models/friendship.rb | 4 - .../test/rails_root/app/models/pets/dog.rb | 10 - .../test/rails_root/app/models/post.rb | 12 - .../test/rails_root/app/models/product.rb | 12 - .../test/rails_root/app/models/tag.rb | 8 - .../test/rails_root/app/models/tagging.rb | 4 - .../test/rails_root/app/models/treat.rb | 3 - .../test/rails_root/app/models/user.rb | 29 - .../rails_root/app/views/layouts/posts.rhtml | 19 - .../rails_root/app/views/layouts/users.rhtml | 17 - .../app/views/layouts/wide.html.erb | 1 - .../rails_root/app/views/posts/edit.rhtml | 27 - .../rails_root/app/views/posts/index.rhtml | 25 - .../test/rails_root/app/views/posts/new.rhtml | 26 - .../rails_root/app/views/posts/show.rhtml | 18 - .../rails_root/app/views/users/edit.rhtml | 22 - .../rails_root/app/views/users/index.rhtml | 22 - .../test/rails_root/app/views/users/new.rhtml | 21 - .../rails_root/app/views/users/show.rhtml | 13 - .../test/rails_root/config/boot.rb | 109 ---- .../test/rails_root/config/environment.rb | 14 - .../rails_root/config/environments/test.rb | 0 .../config/initializers/new_rails_defaults.rb | 15 - .../rails_root/config/initializers/shoulda.rb | 8 - .../test/rails_root/config/routes.rb | 6 - .../rails_root/db/migrate/001_create_users.rb | 19 - .../rails_root/db/migrate/002_create_posts.rb | 13 - .../db/migrate/003_create_taggings.rb | 12 - .../rails_root/db/migrate/004_create_tags.rb | 11 - .../rails_root/db/migrate/005_create_dogs.rb | 12 - .../db/migrate/006_create_addresses.rb | 14 - .../rails_root/db/migrate/007_create_fleas.rb | 11 - .../db/migrate/008_create_dogs_fleas.rb | 12 - .../db/migrate/009_create_products.rb | 17 - .../db/migrate/010_create_friendships.rb | 14 - .../db/migrate/011_create_treats.rb | 12 - .../test/rails_root/db/schema.rb | 0 .../test/rails_root/public/404.html | 30 - .../test/rails_root/public/422.html | 30 - .../test/rails_root/public/500.html | 30 - .../test/rails_root/script/console | 3 - .../test/rails_root/script/generate | 3 - .../test/shoulda_macros/custom_macro.rb | 6 - .../shoulda_macros/gem_macro.rb | 6 - .../shoulda_macros/plugin_macro.rb | 6 - .../test/rspec_test.rb | 207 ------ .../test/test_helper.rb | 35 -- .../test/unit/address_test.rb | 10 - .../test/unit/dog_test.rb | 10 - .../test/unit/flea_test.rb | 6 - .../test/unit/friendship_test.rb | 6 - .../test/unit/post_test.rb | 19 - .../test/unit/product_test.rb | 27 - .../test/unit/tag_test.rb | 15 - .../test/unit/tagging_test.rb | 6 - .../test/unit/user_test.rb | 70 --- 226 files changed, 56 insertions(+), 12509 deletions(-) delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/.specification delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/CHANGELOG delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/History.txt delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/Manifest.txt delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/README delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/Rakefile delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/init.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/install.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/base.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/abstract/schema_statements.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/abstract_adapter.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/mysql_adapter.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/postgresql_adapter.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/inflector.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/magic_model.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/schema.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/validations.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/version.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/module.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/lib/rails.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2html delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2js delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test.db delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/abstract_unit.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_mysql/connection.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_postgresql/connection.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_sqlite/connection.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/dummy_test.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/env_test.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/.DS_Store delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives.yml delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives_fun_users.yml delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.drop.sql delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.sql delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/postgresql.sql delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/sqlite.sql delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/fun_users.yml delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_memberships.yml delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_tag.yml delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/groups.yml delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/foreign_keys_test.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/fun_user_plus.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_access_test.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_assoc_test.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_classes_test.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/magic_module_test.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/test/test_existing_model.rb delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/index.html delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/index.txt delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/javascripts/rounded_corners_lite.inc.js delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/stylesheets/screen.css delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/template.js delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/template.rhtml delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.js delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.txt delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/version.js delete mode 100644 vendor/gems/dr_nic_magic_models-0.9.2/website/version.txt delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/.specification delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/CONTRIBUTION_GUIDELINES.rdoc delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/MIT-LICENSE delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/README.rdoc delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/Rakefile delete mode 100755 vendor/gems/thoughtbot-shoulda-2.10.1/bin/convert_to_should_syntax delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/html.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/xml.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/helpers.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/macros.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/assign_to_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/filter_param_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/route_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_session_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/resource_options.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer/assertions.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view/macros.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/assertions.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/helpers.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_value_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/association_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_db_column_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_index_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validation_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/autoload_macros.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/helpers.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/macros.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/private_helpers.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/proc_extensions.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rails.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rspec.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/list_tests.rake delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/yaml_to_shoulda.rake delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/test_unit.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/rails/init.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/README delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fail_macros.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/addresses.yml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/friendships.yml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/posts.yml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/products.yml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/taggings.yml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/tags.yml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/users.yml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/posts_controller_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/users_controller_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_value_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/association_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_length_of_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_db_column_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_index_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_named_scope_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_readonly_attributes_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_acceptance_of_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_numericality_of_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_presence_of_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/assign_to_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/filter_param_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/render_with_layout_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_content_type_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/route_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_session_matcher_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_the_flash_matcher.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/model_builder.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/other/autoload_macro_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/other/context_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/other/convert_to_should_syntax_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/other/helpers_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/other/private_helpers_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/other/should_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/application.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/posts_controller.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/users_controller.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/application_helper.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/posts_helper.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/users_helper.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/address.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/flea.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/friendship.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/pets/dog.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/post.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/product.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tag.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tagging.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/treat.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/user.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/posts.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/users.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/wide.html.erb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/edit.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/index.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/new.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/show.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/edit.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/index.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/new.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/show.rhtml delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/boot.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environment.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environments/test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/new_rails_defaults.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/shoulda.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/routes.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/001_create_users.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/002_create_posts.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/003_create_taggings.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/004_create_tags.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/005_create_dogs.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/006_create_addresses.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/007_create_fleas.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/008_create_dogs_fleas.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/009_create_products.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/010_create_friendships.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/011_create_treats.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/schema.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/404.html delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/422.html delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/500.html delete mode 100755 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/console delete mode 100755 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/generate delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/test/shoulda_macros/custom_macro.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/rspec_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/test_helper.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/address_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/dog_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/flea_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/friendship_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/post_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/product_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tag_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tagging_test.rb delete mode 100644 vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/user_test.rb diff --git a/config/environment.rb b/config/environment.rb index f868e7e..ad89a79 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -81,5 +81,5 @@ Rails::Initializer.run do |config| config.gem "icalendar" config.gem "will_paginate" config.gem "calendar_helper" - config.gem 'thoughtbot-shoulda', :lib => 'shoulda/rails', :source => "http://gems.github.com" + config.gem "shoulda" end diff --git a/doc/environment.txt b/doc/environment.txt index 995be78..c0e55d4 100644 --- a/doc/environment.txt +++ b/doc/environment.txt @@ -6,17 +6,14 @@ activeresource (2.3.18) activesupport (2.3.18) acts_as_versioned (0.2.3) atomic (1.1.10) -brazilian-rails (2.1.15) -brcep (2.1.15) -brcpfcnpj (2.1.15) brdata (2.1.15) -brdinheiro (2.1.15) brhelper (2.1.15) brI18n (2.1.15) brnumeros (2.1.15) brstring (2.1.15) bundler (1.3.5) bundler-unload (1.0.1) +calendar_helper (0.2.5) haml (3.1.8) hoe (1.3.0) hpricot (0.6) @@ -26,6 +23,7 @@ json_pure (1.8.0) magic_encoding (0.0.2) minitest (4.7.5) multi_json (1.7.7) +open4 (1.3.0) quietbacktrace (0.1.1) rack (1.1.6, 1.0.1) rails (2.3.18) @@ -34,6 +32,7 @@ redgreen (1.2.2) rubyforge (2.0.4) rubygems-update (1.4.2, 1.4.0, 1.3.2) rvm (1.11.3.8) +shoulda (2.11.3) sqlite3-ruby (1.3.1) thread_safe (0.1.0) tzinfo (0.3.37) diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index 2dabad3..c7b7057 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -46,7 +46,7 @@ class AttachmentsControllerTest < ActionController::TestCase context "on get to :show" do setup { get :show, :course_id => @course.id, :id => @att.id } - should_respond_with :success + should respond_with :success should "link to the attachment" do assert_select 'a[href=?]', download_course_attachment_url(@course, @att) @@ -59,8 +59,8 @@ class AttachmentsControllerTest < ActionController::TestCase context "on get to :new" do setup { get :new, :course_id => @course.id } - should_render_a_form - should_respond_with :success + #should render_a_form + should respond_with :success end context "on post to :create" do @@ -74,15 +74,15 @@ class AttachmentsControllerTest < ActionController::TestCase assert @att end - should_set_the_flash_to(/created/i) - should_redirect_to('the attachment') { course_attachment_url(@course, @att) } + should set_the_flash.to(/created/i) + should redirect_to('the attachment') { course_attachment_url(@course, @att) } should_create_log_entry {[ AttachmentCreateLogEntry, @att.id, users(:bob).id ]} end context "on get to :edit" do setup { get :edit, :course_id => @course.id, :id => @att.id } - should_render_a_form - should_render_template 'edit' + #should render_a_form + should render_template 'edit' end context "on post to :update" do @@ -91,8 +91,8 @@ class AttachmentsControllerTest < ActionController::TestCase post :update, :course_id => @course.id, :id => @att.id, :attachment => { :description => @att.description, :path => "", :front_page => 't' } end - should_not_set_the_flash - should_redirect_to('the attachment') { course_attachment_url(@course, @att) } + should_not set_the_flash + should redirect_to('the attachment') { course_attachment_url(@course, @att) } should "not create a new log entry" do assert_nil AttachmentEditLogEntry.find(:first, :conditions => { :target_id => @att.id }) @@ -103,8 +103,8 @@ class AttachmentsControllerTest < ActionController::TestCase setup do post :update, :course_id => @course.id, :id => @att.id, :attachment => { :description => 'new description', :front_page => 't' } end - should_set_the_flash_to(/updated/i) - should_redirect_to('the attachment') { course_attachment_url(@course, @att) } + should set_the_flash.to(/updated/i) + should redirect_to('the attachment') { course_attachment_url(@course, @att) } should_create_log_entry {[ AttachmentEditLogEntry, @att.id, users(:bob).id ]} end @@ -116,8 +116,8 @@ class AttachmentsControllerTest < ActionController::TestCase teardown do @new_data.close! end - should_set_the_flash_to(/updated/i) - should_redirect_to('the attachment') { course_attachment_url(@course, @att) } + should set_the_flash.to(/updated/i) + should redirect_to('the attachment') { course_attachment_url(@course, @att) } should_create_log_entry {[ AttachmentEditLogEntry, @att.id, users(:bob).id ]} end end @@ -125,8 +125,8 @@ class AttachmentsControllerTest < ActionController::TestCase context "on post to :destroy" do setup { post :destroy, :course_id => @course.id, :id => @att.id } - should_set_the_flash_to(/removed/i) - should_redirect_to('the course page'){ course_url(@course) } + should set_the_flash.to(/removed/i) + should redirect_to('the course page'){ course_url(@course) } should_create_log_entry {[ AttachmentDeleteLogEntry, @att.id, users(:bob).id ]} should "destroy the attachment" do @@ -141,8 +141,8 @@ class AttachmentsControllerTest < ActionController::TestCase # post :undelete, :course_id => @course.id, :id => @att.id # end - # should_set_the_flash_to(/restored/i) - # should_redirect_to('the attachment'){ course_attachment_url(@course, @att) } + # should set_the_flash.to(/restored/i) + # should redirect_to('the attachment'){ course_attachment_url(@course, @att) } # should_create_log_entry {[ AttachmentRestoreLogEntry, @att.id, users(:bob).id ]} # should "restore the attachment" do @@ -152,7 +152,7 @@ class AttachmentsControllerTest < ActionController::TestCase context "on get to :download" do setup { get :download, :course_id => @course.id, :id => @att.id } - should_respond_with :success + should respond_with :success end end end diff --git a/test/functional/courses_controller_test.rb b/test/functional/courses_controller_test.rb index 35d5fa0..a54c384 100644 --- a/test/functional/courses_controller_test.rb +++ b/test/functional/courses_controller_test.rb @@ -41,8 +41,8 @@ class CoursesControllerTest < ActionController::TestCase context "on get to :index" do setup { get :index } - should_respond_with :success - should_render_template 'index' + should respond_with :success + should render_template 'index' should "display the course list" do assert_select 'h1', "Disciplinas #{App.current_period}" @@ -58,8 +58,8 @@ class CoursesControllerTest < ActionController::TestCase context "on get to :show" do setup { get :show, :id => @course.id } - should_respond_with :success - should_render_template 'show' + should respond_with :success + should render_template 'show' should "display the course" do assert_select 'a[href=?]', course_log_url(@course) diff --git a/test/functional/user_controller_test.rb b/test/functional/user_controller_test.rb index 1dc97ce..41029d9 100644 --- a/test/functional/user_controller_test.rb +++ b/test/functional/user_controller_test.rb @@ -28,15 +28,15 @@ class UsersControllerTest < ActionController::TestCase context "on get to :dashboard" do setup { get :dashboard } - should_respond_with :success - should_render_template "dashboard" + should respond_with :success + should render_template "dashboard" end context "on post to :logout" do setup { get :logout } - should_respond_with :redirect - should_redirect_to('the main page') { index_url } + should respond_with :redirect + should redirect_to('the main page') { index_url } should "log out" do assert_nil session[:user_id] diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 9d67207..9d8c0c8 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -51,14 +51,14 @@ class WikiControllerTest < ActionController::TestCase #context "on get to :index" do # setup { get :index, :course_id => @course.id } - # should_redirect_to('the course page') { course_url(@course) } + # should redirect_to('the course page') { course_url(@course) } #end context "on get to :show" do setup { get :show, :course_id => @course.id, :id => @wiki_page.id } - should_respond_with :success - should_render_template 'show' + should respond_with :success + should render_template 'show' should "show the wiki page" do assert_select 'h1.title', @wiki_page.title @@ -74,8 +74,8 @@ class WikiControllerTest < ActionController::TestCase context "on get to :versions" do setup { get :versions, :course_id => @course.id, :id => @wiki_page.id } - should_respond_with :success - should_render_template 'versions' + should respond_with :success + should render_template 'versions' should "show the wiki page versions" do @wiki_page.versions.each do |v| @@ -88,7 +88,7 @@ class WikiControllerTest < ActionController::TestCase context "with valid markup" do setup { get :preview, :text => "hello {$x$} x" } - should_respond_with :success + should respond_with :success should "display latex formulas" do assert_select 'img[class=tex_inline]' @@ -102,14 +102,14 @@ class WikiControllerTest < ActionController::TestCase context "with invalid markup" do setup { get :preview, :text => " @course.id, :id => @wiki_page.id, :from => 1, :to => 2 } - should_respond_with :success - should_assign_to :diff + should respond_with :success + should assign_to :diff end end @@ -119,8 +119,8 @@ class WikiControllerTest < ActionController::TestCase context "on get to :new" do setup { get :new, :course_id => @course.id } - should_render_a_form - should_respond_with :success + #should render_a_form + should respond_with :success end context "on post to :create" do @@ -130,8 +130,8 @@ class WikiControllerTest < ActionController::TestCase @wiki_page = @course.wiki_pages.find_by_title('test2') end - should_set_the_flash_to(/created/i) - should_redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) } + should set_the_flash.to(/created/i) + should redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) } should_create_log_entry {[ WikiCreateLogEntry, @wiki_page.id, users(:bob).id ]} should "create a new wiki page" do @@ -144,8 +144,8 @@ class WikiControllerTest < ActionController::TestCase context "on get to :edit" do setup { get :edit, :course_id => @course.id, :id => @wiki_page.id } - should_render_a_form - should_render_template 'edit' + #should render_a_form + should render_template 'edit' should "render a form with the correct fields" do assert_select "input[name='wiki_page[title]'][value=?]", @wiki_page.title @@ -168,8 +168,8 @@ class WikiControllerTest < ActionController::TestCase :title => @wiki_page.title, :content => @wiki_page.content} end - should_not_set_the_flash - should_redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) } + should_not set_the_flash + should redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) } should "not create a new log entry" do assert_nil WikiEditLogEntry.find(:first, :conditions => { :target_id => @wiki_page.id }) @@ -184,8 +184,8 @@ class WikiControllerTest < ActionController::TestCase @wiki_page.reload end - should_set_the_flash_to(/updated/i) - should_redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) } + should set_the_flash.to(/updated/i) + should redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) } should_create_log_entry {[ WikiEditLogEntry, @wiki_page.id, users(:bob).id ]} should "update the wiki page" do @@ -200,8 +200,8 @@ class WikiControllerTest < ActionController::TestCase context "on post to :destroy" do setup { post :destroy, :course_id => @course.id, :id => @wiki_page.id } - should_set_the_flash_to(/removed/i) - should_redirect_to('the course page') { course_url(@course) } + should set_the_flash.to(/removed/i) + should redirect_to('the course page') { course_url(@course) } should_create_log_entry {[ WikiDeleteLogEntry, @wiki_page.id, users(:bob).id ]} should "delete the wiki page" do @@ -217,7 +217,7 @@ class WikiControllerTest < ActionController::TestCase get :move_up, :course_id => @course.id, :id => @another_wiki_page.id end - should_redirect_to('the course page') { course_url(@course) } + should redirect_to('the course page') { course_url(@course) } should "move the page up" do @wiki_page.reload @@ -234,7 +234,7 @@ class WikiControllerTest < ActionController::TestCase get :move_down, :course_id => @course.id, :id => @wiki_page.id end - should_redirect_to('the course page') { course_url(@course) } + should redirect_to('the course page') { course_url(@course) } should "move the page up" do @wiki_page.reload @@ -246,17 +246,17 @@ class WikiControllerTest < ActionController::TestCase end - #def test_should_accept_text_on_show + #def test_should accept_text_on_show # get :show, :format => 'txt', :course_id => 1, :id => @wiki_page.id # assert_formatted_response :text #end - #def test_should_accept_html_on_versions + #def test_should accept_html_on_versions # get :versions, :course_id => 1, :id => @wiki_page.id # assert_response :success #end - #def test_should_accept_xml_on_versions + #def test_should accept_xml_on_versions # get :versions, :format => 'xml', :course_id => 1, :id => @wiki_page.id # assert_formatted_response :xml, :versions #end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/.specification b/vendor/gems/dr_nic_magic_models-0.9.2/.specification deleted file mode 100644 index ad62c58..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/.specification +++ /dev/null @@ -1,107 +0,0 @@ ---- !ruby/object:Gem::Specification -name: dr_nic_magic_models -version: !ruby/object:Gem::Version - version: 0.9.2 -platform: ruby -authors: -- nicwilliams -autorequire: -bindir: bin -cert_chain: -date: 2007-04-29 00:00:00 -03:00 -default_executable: -dependencies: [] - -description: Dr Nic's Magic Models - Invisible validations, assocations and Active Record models themselves! -email: drnicwilliams@gmail.com -executables: [] - -extensions: [] - -extra_rdoc_files: [] - -files: -- CHANGELOG -- History.txt -- Manifest.txt -- README -- Rakefile -- install.rb -- lib/base.rb -- lib/connection_adapters/abstract/schema_statements.rb -- lib/connection_adapters/abstract_adapter.rb -- lib/connection_adapters/mysql_adapter.rb -- lib/connection_adapters/postgresql_adapter.rb -- lib/dr_nic_magic_models.rb -- lib/dr_nic_magic_models/inflector.rb -- lib/dr_nic_magic_models/magic_model.rb -- lib/dr_nic_magic_models/schema.rb -- lib/dr_nic_magic_models/validations.rb -- lib/dr_nic_magic_models/version.rb -- lib/module.rb -- lib/rails.rb -- scripts/txt2html -- scripts/txt2js -- test.db -- test/abstract_unit.rb -- test/connections/native_mysql/connection.rb -- test/connections/native_postgresql/connection.rb -- test/connections/native_sqlite/connection.rb -- test/dummy_test.rb -- test/env_test.rb -- test/fixtures/.DS_Store -- test/fixtures/adjectives.yml -- test/fixtures/adjectives_fun_users.yml -- test/fixtures/db_definitions/mysql.drop.sql -- test/fixtures/db_definitions/mysql.sql -- test/fixtures/db_definitions/postgresql.sql -- test/fixtures/db_definitions/sqlite.sql -- test/fixtures/fun_users.yml -- test/fixtures/group_memberships.yml -- test/fixtures/group_tag.yml -- test/fixtures/groups.yml -- test/foreign_keys_test.rb -- test/fun_user_plus.rb -- test/invisible_model_access_test.rb -- test/invisible_model_assoc_test.rb -- test/invisible_model_classes_test.rb -- test/magic_module_test.rb -- test/test_existing_model.rb -- website/index.html -- website/index.txt -- website/javascripts/rounded_corners_lite.inc.js -- website/stylesheets/screen.css -- website/template.js -- website/template.rhtml -- website/version-raw.js -- website/version-raw.txt -- website/version.js -- website/version.txt -has_rdoc: true -homepage: http://magicmodels.rubyforge.org -post_install_message: -rdoc_options: [] - -require_paths: -- lib -required_ruby_version: !ruby/object:Gem::Requirement - requirements: - - - ">" - - !ruby/object:Gem::Version - version: 0.0.0 - version: -required_rubygems_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: -requirements: [] - -rubyforge_project: magicmodels -rubygems_version: 1.3.1 -signing_key: -specification_version: 1 -summary: Dr Nic's Magic Models - Invisible validations, assocations and Active Record models themselves! -test_files: -- test/test_existing_model.rb diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/CHANGELOG b/vendor/gems/dr_nic_magic_models-0.9.2/CHANGELOG deleted file mode 100644 index 43c5a55..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/CHANGELOG +++ /dev/null @@ -1,9 +0,0 @@ -* 0.2.5 * - Initial public release -- ActiveRecords can now be auto-created in memory when first referenced - from their table name, without an explicit class definition. -- ActiveRecords will automatically include validates_presence_of on - each field with :null => false -- ActiveRecords will automatically generate simple has_many, has_one, - belongs_to assocations based upon assumed foreign keys. E.g. - foreign key to products table is assumed to be product_id. - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/History.txt b/vendor/gems/dr_nic_magic_models-0.9.2/History.txt deleted file mode 100644 index 3c09e90..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/History.txt +++ /dev/null @@ -1,28 +0,0 @@ -*** 0.9.2 / 2007-4-30 - -+ 1 major buxfix: - + #generate_validations now works if you haven't already created a connection to the database; previously - validations wouldn't get created until you had already established the connection; now it does it for - you if its not already established - + Associations can be generated via the assignment methods, e.g. @membership.group= will generate the "belongs_to :group" association now. This allows the website tutorial to work correctly! Yay. That is, you can now do: Membership.create(:person => person, :group => group) - + has_many's should work now - -*** 0.9.1 / 2007-4-11 - -+ 1 minor enhancement: - + ActiveRecord::Base includes all the magic model functionality via the MagicModel module - + Existing ARs can get magic validation via #generate_validations call - + Website tutorial works :D - -*** 0.9.0 / 2007-4-9 - -+ 1 major enhancement: - + Support for dynamic loading of classes again -+ 2 new DB supported: - + Tests run on sqlite (no fk support) - + Tests run on postgresql (fk support) - + Including FK bug fix -+ Many fixes that I've lost track of -+ History.txt to keep track of changes like these -+ Using Hoe for Rakefile -+ Use modules to specify common table prefixes diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/Manifest.txt b/vendor/gems/dr_nic_magic_models-0.9.2/Manifest.txt deleted file mode 100644 index 1cf2c98..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/Manifest.txt +++ /dev/null @@ -1,56 +0,0 @@ -CHANGELOG -History.txt -Manifest.txt -README -Rakefile -install.rb -lib/base.rb -lib/connection_adapters/abstract/schema_statements.rb -lib/connection_adapters/abstract_adapter.rb -lib/connection_adapters/mysql_adapter.rb -lib/connection_adapters/postgresql_adapter.rb -lib/dr_nic_magic_models.rb -lib/dr_nic_magic_models/inflector.rb -lib/dr_nic_magic_models/magic_model.rb -lib/dr_nic_magic_models/schema.rb -lib/dr_nic_magic_models/validations.rb -lib/dr_nic_magic_models/version.rb -lib/module.rb -lib/rails.rb -scripts/txt2html -scripts/txt2js -test.db -test/abstract_unit.rb -test/connections/native_mysql/connection.rb -test/connections/native_postgresql/connection.rb -test/connections/native_sqlite/connection.rb -test/dummy_test.rb -test/env_test.rb -test/fixtures/.DS_Store -test/fixtures/adjectives.yml -test/fixtures/adjectives_fun_users.yml -test/fixtures/db_definitions/mysql.drop.sql -test/fixtures/db_definitions/mysql.sql -test/fixtures/db_definitions/postgresql.sql -test/fixtures/db_definitions/sqlite.sql -test/fixtures/fun_users.yml -test/fixtures/group_memberships.yml -test/fixtures/group_tag.yml -test/fixtures/groups.yml -test/foreign_keys_test.rb -test/fun_user_plus.rb -test/invisible_model_access_test.rb -test/invisible_model_assoc_test.rb -test/invisible_model_classes_test.rb -test/magic_module_test.rb -test/test_existing_model.rb -website/index.html -website/index.txt -website/javascripts/rounded_corners_lite.inc.js -website/stylesheets/screen.css -website/template.js -website/template.rhtml -website/version-raw.js -website/version-raw.txt -website/version.js -website/version.txt diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/README b/vendor/gems/dr_nic_magic_models-0.9.2/README deleted file mode 100644 index 0af8c80..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/README +++ /dev/null @@ -1,294 +0,0 @@ -See http://magicmodels.rubyforge.org/dr_nic_magic_models for pretty README - -Ugly README (from website/index.txt in Textile format): -h1. Dr Nic's Magic Models - -If you've used Ruby on Rails you'll have written at least one model class like this: - -
-class Person < ActiveRecord::Base
-  has_many :memberships
-  has_many :groups, :through => :memberships
-  belongs_to :family
-  validates_presence_of :firstname, :lastname, :email
-end
-
- -A few minutes later you'll have wondered to yourself, - -
-Why do I have write my own has_many, belongs_to, and validates_presence_of -commands if all the data is in the database schema? -
- -Now, for the very first time, your classes can look like this: - -
-class Person < ActiveRecord::Base
-end
-
- -or, if you are lazy... - -
-class Person < ActiveRecord::Base; end
-
- -or, if you read right to the end of this page, this... - -
-# Go fish.
-
- -Magic and mystery abound. All for you. Impress your friends, amaze your mother. - -NOTE: The gratuitous use of *Dr Nic's* in the name should only enhance the mystical magikery, -for magic needs a magician; and I love magic. I always wanted to create my own magic trick. -So I shall be the magician for the sake of magic itself. I look a bit like Harry Potter too, -if Harry were 32 and better dressed. - -h2. Installation - -To install the Dr Nic's Magic Models gem you can run the following command to -fetch the gem remotely from RubyForge: -
-gem install dr_nic_magic_models
-
- -or "download the gem manually":http://rubyforge.org/projects/magicmodels and -run the above command in the download directory. - -Now you need to require the gem into your Ruby/Rails app. Insert the following -line into your script (use config/environment.rb for your Rails apps): - -
-require 'dr_nic_magic_models'
-
- -Your application is now blessed with magical mystery. - -h2. David Copperfield eat your Ruby-crusted heart out - -Let's demonstrate the magical mystery in all its full-stage glory. Create a Ruby on Rails app (example uses sqlite3, but use your favourite databas): - -
-rails magic_show -d sqlite3
-cd magic_show
-ruby script/generate model Person
-ruby script/generate model Group
-ruby script/generate model Membership
-
- -Update the migration 001_create_people.rb with: -
-class CreatePeople < ActiveRecord::Migration
-  def self.up
-    create_table :people do |t|
-      t.column :firstname, :string, :null => false
-      t.column :lastname, :string, :null => false
-      t.column :email, :string, :null => false
-    end
-  end
-
-  def self.down
-    drop_table :people
-  end
-end
-
- -Similarly, update the def self.up method of 002_create_groups.rb -with: -
-    create_table :groups do |t|
-      t.column :name, :string, :null => false
-      t.column :description, :string
-    end
-
- -and 003_create_memberships.rb with: -
-    create_table :memberships do |t|
-      t.column :person_id, :integer, :null => false
-      t.column :group_id, :integer, :null => false
-    end
-
- -And run your migrations to create the three tables: -
-rake db:migrate
-
- -h3. And now for some "woofle dust":http://en.wikipedia.org/wiki/List_of_conjuring_terms ... - -At the end of config/environment.rb add the following line: - -
-require 'dr_nic_magic_models'
-
- -Now, let's do a magic trick. First, let's check our model classes (app/models/person.rb etc): - -
-class Person < ActiveRecord::Base
-end
-class Group < ActiveRecord::Base
-end
-class Membership < ActiveRecord::Base
-end
-
- -Nothing suspicious here. We have no validations and no associations. Just some plain old model classes. - -UPDATE: To turn on magic validations, you now need to invoke generate_validations on defined classes. So, update your model classes: - -
-class Person < ActiveRecord::Base
-  generate_validations
-end
-class Group < ActiveRecord::Base
-  generate_validations
-end
-class Membership < ActiveRecord::Base
-  generate_validations
-end
-
- -For this trick, we'll need an ordinary console session. Any old one lying around the house will do. - -
-ruby script/console
-
- -Now a normal model class is valid until you explicitly add validates_xxx commands. -With Dr Nic's Magic Models: - -
-person = Person.new
-=> #"", "firstname"=>"", "email"=>""}, @new_record=true>
-person.valid?
-=> false
-person.errors
-=> #["can't be blank", "is too long (maximum is 255 characters)"], 
-	"lastname"=>["can't be blank", "is too long (maximum is 255 characters)"], 
-	"email"=>["can't be blank", "is too long (maximum is 255 characters)"]},
-	 @base=#, @new_record=true, 
-		@attributes={"lastname"=>nil, "firstname"=>nil, "email"=>nil}>>
-
- -*Kapoow!* Instant validation! (NOTE: not as instant as it used to be - remember - you need to call generate_validations on each class as required) - -Because you specified the three columns as :null => false, -your ActiveRecord models will now automagically generated validates_presence_of -for each non-null field, plus several other validations (since version 0.8.0). - -Ok, we're just warming up. - -Your models normally require association commands (has_many, belongs_to, etc, as -demonstrated above) to have the brilliantly simple support that Rails/ActiveRecords are known for. - -Let's just watch what Dr Nic's Magic Models can do without any effort at all... - -
-person = Person.create(:firstname => "Nic", :lastname => "Williams", :email => "drnicwilliams@gmail.com")
-group = Group.create(:name => "Magic Models Forum", :description => "http://groups.google.com/magicmodels")
-membership = Membership.create(:person => person, :group => group)
-person.memberships.length
-=> 1
-membership.person
-=> "Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>
-group.memberships
-=> ["1", "id"=>"1", "person_id"=>"1"}>]
-
- - -The final association trick is a ripper. Automatic generation of has_many :through associations... - -
->> person.groups
-=> ["Magic Models Forum", "id"=>"1", "description"=>nil}>]
->> group.people
-=> ["Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>]
-
- -h3. Drum roll... - -Ladies and gentlemen. For my final feat of magical mastery, I'll ask you to do -something you've never done before. This illusion is akin to the "floating lady":http://www.toytent.com/Posters/985.html -illusion that has been passed down through generations of magicians. - -Exit your console session. - -DELETE your three model classes: person.rb, group.rb, and membership.rb from the -app/models folder. (You can always get them back via the model generator... be fearless!) - -
rm app/models/*.rb
- -Re-launch your console. - -*drums are still rolling...* - -Be prepared to applaud loudly... - -
->> Person
-=> Person
-
- -You applaud loudly, but watch for more... - -
->> Person.new.valid?
-=> false
->> person = Person.find(1)
-=> "Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>
->> person.valid?
-=> true
->> person.memberships
-=> ["1", "id"=>"1", "person_id"=>"1"}>]
->> person.groups
-=> ["Magic Models Forum", "id"=>"1", "description"=>nil}>]
-
- -h3. Tada! - -The end. - -h3. Use modules to scope your magic - -Only want to pick up tables starting with blog_? - -
module Blog
-  magic_module :table_name_prefix => 'blog_'
-end
-
-Blog::Post.table_name #	=> 'blog_posts'
-
- -h2. Dr Nic's Blog - -"http://www.drnicwilliams.com":http://www.drnicwilliams.com - for future announcements and -other stories and things. - -h2. Articles about Magic Models - -* "Announcement":http://drnicwilliams.com/2006/08/07/ann-dr-nics-magic-models/ -* "BTS - Class creation":http://drnicwilliams.com/2006/08/10/bts-magic-models-class-creation/ - - -h2. Forum - -"http://groups.google.com/group/magicmodels":http://groups.google.com/group/magicmodels - -h2. Licence - -This code is free to use under the terms of the MIT licence. - -h2. Contact - -Comments are welcome. Send an email to "Dr Nic Williams":mailto:drnicwilliams@gmail.com -or via his blog at "http://www.drnicwilliams.com":http://www.drnicwilliams.com - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/Rakefile b/vendor/gems/dr_nic_magic_models-0.9.2/Rakefile deleted file mode 100644 index 402e2bf..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/Rakefile +++ /dev/null @@ -1,134 +0,0 @@ -require 'rubygems' -require 'rake' -require 'rake/clean' -require 'rake/testtask' -require 'rake/rdoctask' -require 'rake/packagetask' -require 'rake/gempackagetask' -require 'rake/contrib/rubyforgepublisher' -require 'hoe' -require File.join(File.dirname(__FILE__), 'lib', 'dr_nic_magic_models', 'version') - -AUTHOR = "nicwilliams" # can also be an array of Authors -EMAIL = "drnicwilliams@gmail.com" -DESCRIPTION = "Dr Nic's Magic Models - Invisible validations, assocations and Active Record models themselves!" -GEM_NAME = "dr_nic_magic_models" # what ppl will type to install your gem -RUBYFORGE_PROJECT = "magicmodels" # The unix name for your project -HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org" - - -NAME = "magic_multi_connections" -REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil -VERS = ENV['VERSION'] || (DrNicMagicModels::VERSION::STRING + (REV ? ".#{REV}" : "")) -CLEAN.include ['**/.*.sw?', '*.gem', '.config'] -RDOC_OPTS = ['--quiet', '--title', "dr_nic_magic_models documentation", - "--opname", "index.html", - "--line-numbers", - "--main", "README", - "--inline-source"] - -class Hoe - def extra_deps - @extra_deps.reject { |x| Array(x).first == 'hoe' } - end -end - -# Generate all the Rake tasks -# Run 'rake -T' to see list of generated tasks (from gem root directory) -hoe = Hoe.new(GEM_NAME, VERS) do |p| - p.author = AUTHOR - p.description = DESCRIPTION - p.email = EMAIL - p.summary = DESCRIPTION - p.url = HOMEPATH - p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT - p.test_globs = ["test/**/test_*.rb"] - p.clean_globs = CLEAN #An array of file patterns to delete on clean. - - # == Optional - p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") - - #p.extra_deps - An array of rubygem dependencies. - #p.spec_extras - A hash of extra values to set in the gemspec. -end - -# Run the unit tests - -for adapter in %w( sqlite mysql postgresql ) # UNTESTED - postgresql sqlite sqlite3 firebird sqlserver sqlserver_odbc db2 oracle sybase openbase ) - Rake::TestTask.new("test_#{adapter}") { |t| - t.libs << "test" << "test/connections/native_#{adapter}" - t.pattern = "test/*_test{,_#{adapter}}.rb" - t.verbose = true - } -end - -SCHEMA_PATH = File.join(File.dirname(__FILE__), *%w(test fixtures db_definitions)) - -desc 'Build the MySQL test databases' -task :build_mysql_databases do - puts File.join(SCHEMA_PATH, 'mysql.sql') - %x( mysqladmin -u root create "#{GEM_NAME}_unittest" ) - cmd = "mysql -u root #{GEM_NAME}_unittest < \"#{File.join(SCHEMA_PATH, 'mysql.sql')}\"" - puts "#{cmd}\n" - %x( #{cmd} ) -end - -desc 'Drop the MySQL test databases' -task :drop_mysql_databases do - %x( mysqladmin -u root -f drop "#{GEM_NAME}_unittest" ) -end - -desc 'Rebuild the MySQL test databases' -task :rebuild_mysql_databases => [:drop_mysql_databases, :build_mysql_databases] - -desc 'Build the sqlite test databases' -task :build_sqlite_databases do - # puts File.join(SCHEMA_PATH, 'sqlite.sql') - # %x( sqlite3 test.db < test/fixtures/db_definitions/sqlite.sql ) - file = File.join(SCHEMA_PATH, 'sqlite.sql') - cmd = "sqlite3 test.db < #{file}" - puts cmd - %x( #{cmd} ) -end - -desc 'Drop the sqlite test databases' -task :drop_sqlite_databases do - %x( rm -f test.db ) -end - -desc 'Rebuild the sqlite test databases' -task :rebuild_sqlite_databases => [:drop_sqlite_databases, :build_sqlite_databases] - -desc 'Build the PostgreSQL test databases' -task :build_postgresql_databases do - %x( createdb "#{GEM_NAME}_unittest" ) - %x( psql "#{GEM_NAME}_unittest" -f "#{File.join(SCHEMA_PATH, 'postgresql.sql')}" ) -end - -desc 'Drop the PostgreSQL test databases' -task :drop_postgresql_databases do - %x( dropdb "#{GEM_NAME}_unittest" ) -end - -desc 'Rebuild the PostgreSQL test databases' -task :rebuild_postgresql_databases => [:drop_postgresql_databases, :build_postgresql_databases] - - -desc 'Generate website files' -task :website_generate do - sh %{ ruby scripts/txt2html website/index.txt > website/index.html } - sh %{ ruby scripts/txt2js website/version.txt > website/version.js } - sh %{ ruby scripts/txt2js website/version-raw.txt > website/version-raw.js } -end - -desc 'Upload website files to rubyforge' -task :website_upload do - config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml"))) - host = "#{config["username"]}@rubyforge.org" - remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{GEM_NAME}" - local_dir = 'website' - sh %{rsync -av --delete #{local_dir}/ #{host}:#{remote_dir}} -end - -desc 'Generate and upload website files' -task :website => [:website_generate, :website_upload] diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/init.rb b/vendor/gems/dr_nic_magic_models-0.9.2/init.rb deleted file mode 100644 index 3df0c5e..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/init.rb +++ /dev/null @@ -1,3 +0,0 @@ - - require File.join(File.dirname(__FILE__), 'lib', 'dr_nic_magic_models') - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/install.rb b/vendor/gems/dr_nic_magic_models-0.9.2/install.rb deleted file mode 100644 index da7af40..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/install.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'rbconfig' -require 'find' -require 'ftools' - -include Config - -# this was adapted from rdoc's install.rb by ways of Log4r - -$sitedir = CONFIG["sitelibdir"] -unless $sitedir - version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"] - $libdir = File.join(CONFIG["libdir"], "ruby", version) - $sitedir = $:.find {|x| x =~ /site_ruby/ } - if !$sitedir - $sitedir = File.join($libdir, "site_ruby") - elsif $sitedir !~ Regexp.quote(version) - $sitedir = File.join($sitedir, version) - end -end - -# the acual gruntwork -Dir.chdir("lib") - -Find.find("dr_nic_magic_models", "dr_nic_magic_models.rb") { |f| - if f[-3..-1] == ".rb" - File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true) - else - File::makedirs(File.join($sitedir, *f.split(/\//))) - end -} diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/base.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/base.rb deleted file mode 100644 index e915841..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/base.rb +++ /dev/null @@ -1,12 +0,0 @@ -#TODO: Use :dependent for FK cascade? - -module ActiveRecord - class Base - class << self - public - def get_unique_index_columns - self.connection.indexes(self.table_name, "#{self.name} Indexes").select { |index| index.unique && index.columns.size == 1 }.map{ |index| index.columns.first } - end - end - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/abstract/schema_statements.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/abstract/schema_statements.rb deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/abstract_adapter.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/abstract_adapter.rb deleted file mode 100644 index 9a16608..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/abstract_adapter.rb +++ /dev/null @@ -1,32 +0,0 @@ - -module ActiveRecord - module ConnectionAdapters # :nodoc: - - # Generic holder for foreign key constraint meta-data from the database schema. - class ForeignKeyConstraint < Struct.new(:name, :table, :foreign_key, :reference_table, :reference_column, :on_update, :on_delete) - end - - class AbstractAdapter - - # Does this adapter support the ability to fetch foreign key information? - # Backend specific, as the abstract adapter always returns +false+. - def supports_fetch_foreign_keys? - false - end - - def foreign_key_constraints(table, name = nil) - raise NotImplementedError, "foreign_key_constraints is not implemented for #{self.class}" - end - - def remove_foreign_key_constraint(table_name, constraint_name) - raise NotImplementedError, "rename_table is not implemented for #{self.class}" - end - - protected - def symbolize_foreign_key_constraint_action(constraint_action) - return nil if constraint_action.nil? - constraint_action.downcase.gsub(/\s/, '_').to_sym - end - end - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/mysql_adapter.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/mysql_adapter.rb deleted file mode 100644 index 160cf69..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/mysql_adapter.rb +++ /dev/null @@ -1,42 +0,0 @@ -# Foreign Key support from http://wiki.rubyonrails.org/rails/pages/Foreign+Key+Schema+Dumper+Plugin - -module ActiveRecord - module ConnectionAdapters - class MysqlAdapter < AbstractAdapter - def supports_fetch_foreign_keys? - true - end - - def foreign_key_constraints(table, name = nil) - constraints = [] - execute("SHOW CREATE TABLE #{table}", name).each do |row| - row[1].each do |create_line| - if create_line.strip =~ /CONSTRAINT `([^`]+)` FOREIGN KEY \(`([^`]+)`\) REFERENCES `([^`]+)` \(`([^`]+)`\)([^,]*)/ - constraint = ForeignKeyConstraint.new(Regexp.last_match(1), table, Regexp.last_match(2), Regexp.last_match(3), Regexp.last_match(4), nil, nil) - - constraint_params = {} - - unless Regexp.last_match(5).nil? - Regexp.last_match(5).strip.split('ON ').each do |param| - constraint_params[Regexp.last_match(1).upcase] = Regexp.last_match(2).strip.upcase if param.strip =~ /([^ ]+) (.+)/ - end - end - - constraint.on_update = symbolize_foreign_key_constraint_action(constraint_params['UPDATE']) if constraint_params.include? 'UPDATE' - constraint.on_delete = symbolize_foreign_key_constraint_action(constraint_params['DELETE']) if constraint_params.include? 'DELETE' - - constraints << constraint - end - end - end - - constraints - end - - def remove_foreign_key_constraint(table_name, constraint_name) - execute "ALTER TABLE #{table_name} DROP FOREIGN KEY #{constraint_name}" - end - - end - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/postgresql_adapter.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/postgresql_adapter.rb deleted file mode 100644 index 4315598..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/connection_adapters/postgresql_adapter.rb +++ /dev/null @@ -1,45 +0,0 @@ -# Foreign Key support from http://wiki.rubyonrails.org/rails/pages/Foreign+Key+Schema+Dumper+Plugin - -module ActiveRecord - module ConnectionAdapters - class PostgreSQLAdapter < AbstractAdapter - - def supports_fetch_foreign_keys? - true - end - - def foreign_key_constraints(table, name = nil) - - - sql = "SELECT conname, pg_catalog.pg_get_constraintdef(oid) AS consrc FROM pg_catalog.pg_constraint WHERE contype='f' " - sql += "AND conrelid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='#{table}')" - - result = query(sql, name) - - keys = [] - re = /(?i)^FOREIGN KEY \((.+)\) REFERENCES (.+)\((.+)\)(?: ON UPDATE (\w+))?(?: ON DELETE (\w+))?$/ - result.each do |row| - # pg_catalog.pg_get_constraintdef returns a string like this: - # FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE - if match = re.match(row[1]) - - keys << ForeignKeyConstraint.new(row[0], - table, - match[1], - match[2], - match[3], - symbolize_foreign_key_constraint_action(match[4]), - symbolize_foreign_key_constraint_action(match[5])) - end - end - - keys - end - - def remove_foreign_key_constraint(table_name, constraint_name) - execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{constraint_name}" - end - - end - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models.rb deleted file mode 100644 index cae51ec..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models.rb +++ /dev/null @@ -1,34 +0,0 @@ -$:.unshift(File.dirname(__FILE__)) unless - $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) - -unless defined?(ActiveRecord) - begin - require 'active_record' - rescue LoadError - require 'rubygems' - require_gem 'activerecord' - end -end - -module DrNicMagicModels - Logger = RAILS_DEFAULT_LOGGER rescue Logger.new(STDERR) -end - -require 'dr_nic_magic_models/magic_model' -require 'dr_nic_magic_models/schema' -require 'dr_nic_magic_models/validations' -require 'dr_nic_magic_models/inflector' -require 'base' -require 'module' -require 'rails' rescue nil -require 'connection_adapters/abstract_adapter' -require 'connection_adapters/mysql_adapter' -require 'connection_adapters/postgresql_adapter' - -# load the schema -# TODO - add this to README - DrNicMagicModels::Schema.load_schema(true) - -class ActiveRecord::Base - include DrNicMagicModels::MagicModel - extend DrNicMagicModels::Validations -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/inflector.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/inflector.rb deleted file mode 100644 index 0465be6..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/inflector.rb +++ /dev/null @@ -1,14 +0,0 @@ -module DrNicMagicModels - class Inflector - def table_names ; DrNicMagicModels::Schema.table_names; end - def tables ; DrNicMagicModels::Schema.tables; end - def models ; DrNicMagicModels::Schema.model; end - - def class_name(table_name) - ActiveRecord::Base.class_name(table_name) - end - - def post_class_creation(klass) - end - end -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/magic_model.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/magic_model.rb deleted file mode 100644 index babd73a..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/magic_model.rb +++ /dev/null @@ -1,133 +0,0 @@ -# Mixed into a class that is dynamically created, unless -# the class was created by the Schema.load_schema process -# which builds the whole class, thus no magicalness is -# needed -module DrNicMagicModels::MagicModel - def self.append_features(base) - super - base.send(:include, InstanceMethods) - class << base - # Returns the AssociationReflection object for the named +aggregation+ (use the symbol). Example: - # Account.reflect_on_association(:owner) # returns the owner AssociationReflection - # Invoice.reflect_on_association(:line_items).macro # returns :has_many - def reflect_on_association(association) - unless reflections[association] - # See if an assocation can be generated - self.new.send(association) rescue nil - end - reflections[association].is_a?(ActiveRecord::Reflection::AssociationReflection) ? reflections[association] : nil - end - end - end - - module InstanceMethods - - def method_missing(method, *args, &block) - begin - super - rescue - if unknown_method? method - result = find_belongs_to method, *args, &block - result = find_has_some method, *args, &block if not result - result = find_has_some_indirect method, *args, &block if not result - return result if result - end - add_known_unknown method - raise - end - end - - def add_known_unknown(method) - @known_unknowns ||= {} - @known_unknowns[method] = true - end - - def unknown_method?(method) - @known_unknowns.nil? or @known_unknowns.include? method - end - - def find_belongs_to(method, *args, &block) - method_clean = clean_method method - fkc = - begin - self.class.connection.foreign_key_constraints(self.class.table_name, method_clean) - rescue NotImplementedError - nil - end - if !fkc.nil? && fkc.length > 0 - foreign_key = fkc.first.foreign_key - options = {:dependent => :destroy, - :foreign_key => fkc.first.foreign_key, - :class_name => self.class.class_name(fkc.first.reference_table)} - else - foreign_key = self.class.columns.select {|column| column.name == method_clean.to_s.foreign_key}.first - end - options ||= {} - return add_belongs_to(method, method_clean, options, *args, &block) if foreign_key - end - - def add_belongs_to(method, method_clean, options, *args, &block) - self.class.send 'belongs_to', method_clean.to_sym, options rescue puts $! - self.send(method, *args, &block) - end - - def find_has_some(method, *args, &block) - method_clean = clean_method method - fkc = [method_clean.to_s.pluralize, method_clean.to_s.singularize].inject({}) do |pair, table_name| - fkc = begin - self.class.connection.foreign_key_constraints(table_name) - rescue NotImplementedError - nil - end - pair[table_name] = fkc if not fkc.blank? - pair - end - if not fkc.blank? - # assumes there is only one table found - that schema doesn't have a singular and plural table of same name - foreign_key = fkc.values.first.find {|fk| fk.reference_table == self.class.table_name} - if foreign_key - foreign_key = foreign_key.foreign_key - table_name = fkc.keys.first - klass = Module.const_get table_name.singularize.camelize rescue nil - options = {:foreign_key => foreign_key, :class_name => klass.name} - end - end - unless foreign_key - klass = Module.const_get method_clean.to_s.downcase.singularize.camelize rescue nil - foreign_key = klass.columns.select {|column| column.name == self.class.name.foreign_key}.first if klass - end - options ||= {} - return add_has_some(method, method_clean, options, *args, &block) if foreign_key - end - - def add_has_some(method, method_clean, options, *args, &block) - association = method_clean.singularize == method_clean ? 'has_one' : 'has_many' - self.class.send association, method_clean.to_sym, options rescue puts $! - self.send(method, *args, &block) - end - - def find_has_some_indirect(method, *args, &block) - klass = Module.const_get method.to_s.downcase.singularize.camelize rescue return - join_table = nil - self.connection.tables.each do |table| - unless [self.class.table_name, klass.table_name].include? table - columns = self.connection.columns(table).map(&:name) - join_table = table if columns.include?(self.class.to_s.foreign_key) and columns.include?(klass.to_s.foreign_key) - end - break if join_table - end - return add_has_some_through(join_table, method, *args, &block) if join_table - end - - def add_has_some_through(join_table, method, *args, &block) - self.class.send 'has_many', method, :through => join_table.to_sym - self.send(method, *args, &block) - end - - private - - def clean_method(method) - method.to_s.gsub(/=$/,'') # remove any = from the end of the method name - end - end -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/schema.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/schema.rb deleted file mode 100644 index d9d3986..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/schema.rb +++ /dev/null @@ -1,270 +0,0 @@ -module DrNicMagicModels - - # ONE Schema per namespace module - # Person, Company, etc share the Object namespace module, ie. ::Person, ::Company - # Blog::Post, Blog::Comment, share the Blog namespace module - class Schema - attr_reader :modul - - def initialize(modul) - @modul = modul - @table_name_prefix = modul.instance_variable_get("@table_name_prefix") rescue '' - logger.info "Create Schema for #{@modul}, table_name_prefix '#{@table_name_prefix}'" - end - - cattr_accessor :inflector - cattr_accessor :superklass - - # Need to store models etc per-module, not in @ @models - def inflector - @inflector ||= Inflector.new - end - - # all in lower case please - ReservedTables = [:schema_info, :sessions] - @models = nil - - def logger - @logger ||= DrNicMagicModels::Logger - end - - def models - load_schema if @models.nil? - @models - end - - def tables - load_schema if @tables.nil? - @tables - end - - def table_names - load_schema if @table_names.nil? - @table_names - end - - def fks_on_table(table_name) - load_schema if @models.nil? - @fks_by_table[table_name.to_s] || [] - end - - # active record only support 2 column link tables, otherwise use a model table, has_many and through - def is_link_table?(table_name) - load_schema if @models.nil? - return @link_tables[table_name] if ! @link_tables[table_name].nil? - column_names = @conn.columns(table_name).map{|x| x.name } - @link_tables[table_name] = ! column_names.include?("id") && column_names.length == 2 && column_names.select { |x| x =~ /_id$/ } == column_names - return @link_tables[table_name] - end - - def link_tables_for_class(klass) - load_schema if @models.nil? - end - - def load_schema(preload = false) - return if !@models.nil? - - @superklass ||= ActiveRecord::Base - raise "No database connection" if !(@conn = @superklass.connection) - - @models = ModelHash.new - @tables = Hash.new - @fks_by_table = Hash.new - @link_tables = Hash.new - - @table_names = @conn.tables - @table_names = @table_names.grep(/^#{@table_name_prefix}/) if @table_name_prefix - @table_names = @table_names.sort - - logger.info "For #{modul} tables are #{@table_names.inspect}" - - # Work out which tables are in the model and which aren't - @table_names.each do |table_name| - - # deal with reserved tables & link_tables && other stray id-less tables - #key = 'id' - #case ActiveRecord::Base.primary_key_prefix_type - # when :table_name - # key = Inflector.foreign_key(table_name, false) - # when :table_name_with_underscore - # key = Inflector.foreign_key(table_name) - #end - #next if ReservedTables.include?(table_name.downcase.to_sym) || - # is_link_table?(table_name) || - # ! @conn.columns(table_name).map{ |x| x.name}.include?(key) - - table_name_clean = table_name.gsub(/^#{@table_name_prefix}/,'') - - # a model table then... - model_class_name = inflector.class_name(table_name_clean) - - logger.debug "Got a model table: #{table_name} => class #{model_class_name}" - - @models[model_class_name] = table_name - @tables[table_name] = model_class_name - - if preload - # create by MAGIC! - klass = model_class_name.constantize - - # Process FKs? - if @conn.supports_fetch_foreign_keys? - - tables.each do |table_name| - logger.debug "Getting FKs for #{table_name}" - @fks_by_table[table_name] = Array.new - @conn.foreign_key_constraints(table_name).each do |fk| - logger.debug "Got one: #{fk}" - @fks_by_table[table_name].push(fk) - end # do each fk - - end # each table - end - - # Try to work out our link tables now... - @models.keys.sort.each{|klass| process_table(@models[klass.to_s])} - @link_tables.keys.sort.each{|table_name| process_link_table(table_name) if @link_tables[table_name]} - end - end - - end - - def process_table(table_name) - - logger.debug "Processing model table #{table_name}" - - # ok, so let's look at the foreign keys on the table... - belongs_to_klass = @tables[table_name].constantize rescue return - - processed_columns = Hash.new - - fks_on_table(table_name).each do |fk| - logger.debug "Found FK column by suffix _id [#{fk.foreign_key}]" - has_some_klass = Inflector.classify(fk.reference_table).constantize rescue next - processed_columns[fk.foreign_key] = { :has_some_klass => has_some_klass } - processed_columns[fk.foreign_key].merge! add_has_some_belongs_to(belongs_to_klass, fk.foreign_key, has_some_klass) rescue next - end - - column_names = @conn.columns(table_name).map{ |x| x.name} - column_names.each do |column_name| - next if not column_name =~ /_id$/ - logger.debug "Found FK column by suffix _id [#{column_name}]" - if processed_columns.key?(column_name) - logger.debug "Skipping, already processed" - next - end - has_some_klass = Inflector.classify(column_name.sub(/_id$/,"")).constantize rescue next - processed_columns[column_name] = { :has_some_klass => has_some_klass } - processed_columns[column_name].merge! add_has_some_belongs_to(belongs_to_klass, column_name, has_some_klass) rescue next - end - - #TODO: what if same classes in table? - - # is this a link table with attributes? (has_many through?) - return if processed_columns.keys.length < 2 - - processed_columns.keys.each do |key1| - processed_columns.keys.each do |key2| - next if key1 == key2 - logger.debug "\n*** #{processed_columns[key1][:has_some_class]}.send 'has_many', #{processed_columns[key2][:belongs_to_name].to_s.pluralize.to_sym}, :through => #{processed_columns[key2][:has_some_name]}\n\n" - processed_columns[key1][:has_some_class].send 'has_many', processed_columns[key2][:belongs_to_name].to_s.pluralize.to_sym, :through => processed_columns[key2][:has_some_name].to_sym - end - end - - end - - def add_has_some_belongs_to(belongs_to_klass, belongs_to_fk, has_some_klass) - - logger.debug "Trying to add a #{belongs_to_klass} belongs_to #{has_some_klass}..." - - # so this is a belongs_to & has_some style relationship... - # is it a has_many, or a has_one? Well, let's assume a has_one has a unique index on the column please... good db design, haha! - unique = belongs_to_klass.get_unique_index_columns.include?(belongs_to_fk) - belongs_to_name = belongs_to_fk.sub(/_id$/, '').to_sym - - logger.debug "\n*** #{belongs_to_klass}.send 'belongs_to', #{belongs_to_name}, :class_name => #{has_some_klass}, :foreign_key => #{belongs_to_fk}\n" - belongs_to_klass.send(:belongs_to, belongs_to_name, :class_name => has_some_klass.to_s, :foreign_key => belongs_to_fk.to_sym) - - # work out if we need a prefix - has_some_name = ( - (unique ? belongs_to_klass.table_name.singularize : belongs_to_klass.table_name) + - (belongs_to_name.to_s == has_some_klass.table_name.singularize ? "" : "_as_"+belongs_to_name.to_s) - ).downcase.to_sym - method = unique ? :has_one : :has_many - logger.debug "\n*** #{has_some_klass}.send(#{method}, #{has_some_name}, :class_name => #{belongs_to_klass.to_s}, :foreign_key => #{belongs_to_fk.to_sym})\n\n" - has_some_klass.send(method, has_some_name, :class_name => belongs_to_klass.to_s, :foreign_key => belongs_to_fk.to_sym) - - return { :method => method, :belongs_to_name => belongs_to_name, :has_some_name => has_some_name, :has_some_class => has_some_klass } - - end - - def process_link_table(table_name) - - logger.debug "Processing link table #{table_name}" - - classes_map = Hash.new - column_names = @conn.columns(table_name).map{ |x| x.name} - - # use foreign keys first - fks_on_table(table_name).each do |fk| - logger.debug "Processing fk: #{fk}" - klass = Inflector.classify(fk.reference_table).constantize rescue logger.debug("Cannot find model #{class_name} for table #{fk.reference_table}") && return - classes_map[fk.foreign_key] = klass - end - - logger.debug "Got #{classes_map.keys.length} references from FKs" - - if classes_map.keys.length < 2 - - #Fall back on good ol _id recognition - - column_names.each do |column_name| - - # check we haven't processed by fks already - next if ! classes_map[column_name].nil? - referenced_table = column_name.sub(/_id$/, '') - - begin - klass = Inflector.classify(referenced_table).constantize - # fall back on FKs here - if ! klass.nil? - classes_map[column_name] = klass - end - rescue - end - end - end - - # not detected the link table? - logger.debug "Got #{classes_map.keys.length} references" - logger.debug "Cannot detect both tables referenced in link table" && return if classes_map.keys.length != 2 - - logger.debug "Adding habtm relationship" - - logger.debug "\n*** #{classes_map[column_names[0]]}.send 'has_and_belongs_to_many', #{column_names[1].sub(/_id$/,'').pluralize.to_sym}, :class_name => #{classes_map[column_names[1]].to_s}, :join_table => #{table_name.to_sym}\n" - logger.debug "\n*** #{classes_map[column_names[1]]}.send 'has_and_belongs_to_many', #{column_names[0].sub(/_id$/,'').pluralize.to_sym}, :class_name => #{classes_map[column_names[0]].to_s}, :join_table => #{table_name.to_sym}\n\n" - - classes_map[column_names[0]].send 'has_and_belongs_to_many', column_names[1].sub(/_id$/,'').pluralize.to_sym, :class_name => classes_map[column_names[1]].to_s, :join_table => table_name.to_sym - classes_map[column_names[1]].send 'has_and_belongs_to_many', column_names[0].sub(/_id$/,'').pluralize.to_sym, :class_name => classes_map[column_names[0]].to_s, :join_table => table_name.to_sym - - end - end - - class ModelHash < Hash - def unenquire(class_id) - @enquired ||= {} - @enquired[class_id = class_id.to_s] = false - end - - def enquired?(class_id) - @enquired ||= {} - @enquired[class_id.to_s] - end - - def [](class_id) - enquired?(class_id = class_id.to_s) - @enquired[class_id] = true - super(class_id) - end - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/validations.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/validations.rb deleted file mode 100644 index 4b16983..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/validations.rb +++ /dev/null @@ -1,46 +0,0 @@ -module DrNicMagicModels - module Validations - - def generate_validations - - logger = DrNicMagicModels::Logger - - # Ensure that the connection to db is established, else validations don't get created. - ActiveRecord::Base.connection - - # Code reworked from http://www.redhillconsulting.com.au/rails_plugins.html - # Thanks Red Hill Consulting for using an MIT licence :o) - - # NOT NULL constraints - self.columns.reject { |column| column.name =~ /(?i)^(((created|updated)_(at|on))|position|type|id)$/ }.each do |column| - - if column.type == :integer - logger.debug "validates_numericality_of #{column.name}, :allow_nil => #{column.null.inspect}, :only_integer => true" - self.validates_numericality_of column.name, :allow_nil => column.null, :only_integer => true - elsif column.number? - logger.debug "validates_numericality_of #{column.name}, :allow_nil => #{column.null.inspect}" - self.validates_numericality_of column.name, :allow_nil => column.null - elsif column.text? && column.limit - logger.debug "validates_length_of #{column.name}, :allow_nil => #{column.null.inspect}, :maximum => #{column.limit}" - self.validates_length_of column.name, :allow_nil => column.null, :maximum => column.limit - end - - # Active record seems to interpolate booleans anyway to either true, false or nil... - if column.type == :boolean - logger.debug "validates_inclusion_of #{column.name}, :in => [true, false], :allow_nil => #{column.null}, :message => ActiveRecord::Errors.default_error_messages[:blank]" - self.validates_inclusion_of column.name, :in => [true, false], :allow_nil => column.null, :message => ActiveRecord::Errors.default_error_messages[:blank] - elsif !column.null - logger.debug "validates_presence_of #{column.name}" - self.validates_presence_of column.name - end - end - - # Single-column UNIQUE indexes - get_unique_index_columns.each do |col| - logger.debug "validates_uniqueness_of #{col}" - self.validates_uniqueness_of col - end - - end - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/version.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/version.rb deleted file mode 100644 index 50d2a70..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/dr_nic_magic_models/version.rb +++ /dev/null @@ -1,9 +0,0 @@ -module DrNicMagicModels #:nodoc: - module VERSION #:nodoc: - MAJOR = 0 - MINOR = 9 - TINY = 2 - - STRING = [MAJOR, MINOR, TINY].join('.') - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/module.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/module.rb deleted file mode 100644 index 909acb0..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/module.rb +++ /dev/null @@ -1,33 +0,0 @@ -class Module - alias :normal_const_missing :const_missing - - def const_missing(class_id) - begin - return normal_const_missing(class_id) - rescue - end - @magic_schema ||= DrNicMagicModels::Schema.new self - unless table_name = @magic_schema.models[class_id] - raise NameError.new("uninitialized constant #{class_id}") if @magic_schema.models.enquired? class_id - end - superklass = @magic_schema.superklass || ActiveRecord::Base - klass = create_class(class_id, superklass) do - set_table_name table_name - # include DrNicMagicModels::MagicModel - # extend DrNicMagicModels::Validations - end - klass.generate_validations # need to call this AFTER the class name has been assigned - @magic_schema.inflector.post_class_creation klass - klass - end - - def magic_module(options) - self.instance_variable_set "@table_name_prefix", options[:table_name_prefix] if options[:table_name_prefix] - end - - private - def create_class(class_name, superclass, &block) - klass = Class.new superclass, &block - self.const_set class_name, klass - end -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/lib/rails.rb b/vendor/gems/dr_nic_magic_models-0.9.2/lib/rails.rb deleted file mode 100644 index b215db9..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/lib/rails.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Dependencies #:nodoc:# - - @@models_dir = File.expand_path(File.join(RAILS_ROOT,'app','models')) - - # don't reload models... it doesn't work anyway, not sure why they haven't done this? - # submit as patch? - alias require_or_load_old require_or_load - def require_or_load(file_name, *args) - file_name = $1 if file_name =~ /^(.*)\.rb$/ - expanded = File.expand_path(file_name) - old_mechanism = Dependencies.mechanism - if expanded =~ /^#{@@models_dir}/ - RAILS_DEFAULT_LOGGER.debug "*** Not reloading #{file_name}" - Dependencies.mechanism = :require - end - require_or_load_old(file_name, *args) - Dependencies.mechanism = old_mechanism - end -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2html b/vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2html deleted file mode 100644 index 03e89c1..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2html +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'redcloth' -require 'syntax/convertors/html' -require 'erb' -require File.dirname(__FILE__) + '/../lib/dr_nic_magic_models/version.rb' - -version = DrNicMagicModels::VERSION::STRING -download = 'http://rubyforge.org/projects/magicmodels' - -class Fixnum - def ordinal - # teens - return 'th' if (10..19).include?(self % 100) - # others - case self % 10 - when 1: return 'st' - when 2: return 'nd' - when 3: return 'rd' - else return 'th' - end - end -end - -class Time - def pretty - return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}" - end -end - -def convert_syntax(syntax, source) - return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^
|
$!,'') -end - -if ARGV.length >= 1 - src, template = ARGV - template ||= File.dirname(__FILE__) + '/../website/template.rhtml' -else - puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html") - exit! -end - -template = ERB.new(File.open(template).read) - -title = nil -body = nil -File.open(src) do |fsrc| - title_text = fsrc.readline - body_text = fsrc.read - syntax_items = [] - body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)!m){ - ident = syntax_items.length - element, syntax, source = $1, $2, $3 - syntax_items << "<#{element} class=\"syntax\">#{convert_syntax(syntax, source)}" - "syntax-temp-#{ident}" - } - title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip - body = RedCloth.new(body_text).to_html - body.gsub!(%r!(?:
)?syntax-temp-(\d+)(?:
)?!){ syntax_items[$1.to_i] } -end -stat = File.stat(src) -created = stat.ctime -modified = stat.mtime - -$stdout << template.result(binding) diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2js b/vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2js deleted file mode 100644 index fb329ea..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/scripts/txt2js +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'redcloth' -require 'syntax/convertors/html' -require 'erb' -require 'active_support' -require File.dirname(__FILE__) + '/../lib/dr_nic_magic_models/version.rb' - -version = DrNicMagicModels::VERSION::STRING -download = 'http://rubyforge.org/projects/magicmodels' - -class Fixnum - def ordinal - # teens - return 'th' if (10..19).include?(self % 100) - # others - case self % 10 - when 1: return 'st' - when 2: return 'nd' - when 3: return 'rd' - else return 'th' - end - end -end - -class Time - def pretty - return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}" - end -end - -def convert_syntax(syntax, source) - return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^
|
$!,'') -end - -if ARGV.length >= 1 - src, template = ARGV - template ||= File.dirname(__FILE__) + '/../website/template.js' -else - puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html") - exit! -end - -template = ERB.new(File.open(template).read) - -title = nil -body = nil -File.open(src) do |fsrc| - title_text = fsrc.readline - body = fsrc.read - title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip -end -stat = File.stat(src) -created = stat.ctime -modified = stat.mtime - -$stdout << template.result(binding) diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test.db b/vendor/gems/dr_nic_magic_models-0.9.2/test.db deleted file mode 100644 index 6716a0de9794cd53b83a41dbea70381c930725fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17408 zcmeI3OK;mo5P&&ciF6dpd7&VL2G9z*SV&q&33TbDQ3J&Y>e`NNp$KxIXldmzl}MGO z(iBJ!QhV+XD9~ej%x`FaK#S%d_}WWPNt?%|%cV?GPrHC(8TG7)|qNxCxw5 z(!5ET{3wy%d4vH8Ac2!ZU`1BpeJ!JX0Czf8#bwSN({a5`=D4=i@RK6C)fR#eYj*28 zsBk5dxs;dt1vZ-*Ym!$TyVIur@?L)8F{{q%REREf3m|)iYe1l} zVKHGe&^^Dv=qFhJpI;>VFolI-V`Q>*4tILYO4I%S6>O8Tjs!fGDa1aOnqD*+uH9lfpC&O^Y>zo~yh@{K8(c}8CaCP%Hs|Tb z%&UQHfB`9`3ubZ;xFwz2}fVgz1qvDPlXf*+dgU=HE} zbY{)TU`jkULKo>8>b+@z62P3naxeYU%iQng|c zdZnShM=n969m&#@#uKUZM|QYr8PDVxxM%DIrZ7*O8-x(b|J$67_;%Ax?W)5X%wblI)%7u&+zCAJrKb3T>1n=T zIF5sBoe%YVVd-c^0vAT-MJ@#P|7(f7p7Sk^%_9LMaC`)k+yw~t|6fVu)$uirEg=CU zFkb>{|M_3={_nm-{v!MH?Gd()1dzb22`tJ "mysql", - :username => "root", - :encoding => "utf8", - :database => db1 -) diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_postgresql/connection.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_postgresql/connection.rb deleted file mode 100644 index eb1f3d0..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_postgresql/connection.rb +++ /dev/null @@ -1,12 +0,0 @@ -print "Using Postgres\n" -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -db1 = "dr_nic_magic_models_unittest" - -ActiveRecord::Base.establish_connection( - :adapter => "postgresql", - :encoding => "utf8", - :database => db1 -) diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_sqlite/connection.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_sqlite/connection.rb deleted file mode 100644 index 04805df..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/connections/native_sqlite/connection.rb +++ /dev/null @@ -1,10 +0,0 @@ -print "Using native Sqlite3\n" -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.establish_connection( - :adapter => "sqlite3", - :dbfile => "test.db" -) - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/dummy_test.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/dummy_test.rb deleted file mode 100644 index bb086cc..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/dummy_test.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'abstract_unit' -#require 'fixtures/user' -#require 'fixtures/group' -#require 'fixtures/membership' - -class DummyTest < Test::Unit::TestCase - def setup - end - - def test_truth - assert true - end -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/env_test.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/env_test.rb deleted file mode 100644 index 71463ec..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/env_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'abstract_unit' - -class EnvTest < Test::Unit::TestCase - - def test_modules - assert_not_nil DrNicMagicModels - assert_not_nil DrNicMagicModels::Validations - assert_not_nil DrNicMagicModels::Schema - end -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/.DS_Store b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/.DS_Store deleted file mode 100644 index 00ad5ecd262189d1430461b4c0417522aa732d72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}N773{KiT6a?9$;AI{`-(V^26ZiniT5A{9E_7{s9bco*>cKBRg2jcNDk=#i zUz$m>J0EmrLqt5?E^diRBAP%2S)2ip@Zi$OlgB{T9#6EShSt#6fkwYEB=3Gn3##cJ z_UrpM)L|$6a^Kw4ZC4|&qyxQ=u8Z+w`?8ZApRVoqZMS|#-r;oaZq={44XAvR#v#E# zFc1s`1Hr(V7_b|RCKqSwA8mtyVBqgEAm>AZ3RaHUP>&869RYv^!Yc4(mXMm{SUF}x ztU%aGfmX^sVz8AXo;-5cvoEBS`+ttV z%;1o(DPe+vVBo(pz{TutHpTAzZvD1TxoZ>j0V*PSSsV!bqmKamkaOfp7i~R>kG#q; V8%h_6YdJ7J1eB04!N3nN@Bs#6EZzVB diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives.yml b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives.yml deleted file mode 100644 index d0b31ea..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives.yml +++ /dev/null @@ -1,3 +0,0 @@ -first: - id: 1 - name: kind \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives_fun_users.yml b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives_fun_users.yml deleted file mode 100644 index 2666e18..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/adjectives_fun_users.yml +++ /dev/null @@ -1,3 +0,0 @@ -first: - fun_user_id: 1 - adjective_id: 1 \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.drop.sql b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.drop.sql deleted file mode 100644 index a5f2252..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.drop.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE fun_users; -DROP TABLE groups; -DROP TABLE group_memberships; -DROP TABLE group_tag; \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.sql b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.sql deleted file mode 100644 index 378f471..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/mysql.sql +++ /dev/null @@ -1,56 +0,0 @@ -CREATE TABLE `fun_users` ( - `id` int(11) NOT NULL auto_increment, - `type` varchar(255) NOT NULL, - `firstname` varchar(50) NOT NULL, - `lastname` varchar(50) NOT NULL, - `login` varchar(50) NOT NULL, - `email` varchar(50) NULL, - PRIMARY KEY (`id`) -) TYPE=InnoDB; - -CREATE TABLE `groups` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL UNIQUE, - `description` varchar(50) default NULL, - `some_int` integer default NULL, - `some_float` float default NULL, - `some_bool` boolean default NULL, - PRIMARY KEY (`id`) -) TYPE=InnoDB; - -CREATE TABLE `group_memberships` ( - `id` int(11) NOT NULL auto_increment, - `fun_user_id` int(11) NOT NULL, - `group_id` int(11) NOT NULL, - PRIMARY KEY (`id`) -) TYPE=InnoDB; - -CREATE TABLE `adjectives` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(255), - PRIMARY KEY (`id`) -) TYPE=InnoDB; - -CREATE TABLE `adjectives_fun_users` ( - `fun_user_id` int(11) NOT NULL, - `adjective_id` int(11) NOT NULL, - PRIMARY KEY (`fun_user_id`,`adjective_id`) -) TYPE=InnoDB; - - -CREATE TABLE `group_tag` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL, - `group_id` int(11) NOT NULL, - `referenced_group_id` int(11) NULL UNIQUE, - PRIMARY KEY (`id`) -) TYPE=InnoDB; - -ALTER TABLE `group_tag` - ADD FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE; - -ALTER TABLE `group_tag` - ADD FOREIGN KEY (`referenced_group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE; - -ALTER TABLE `adjectives_fun_users` - ADD FOREIGN KEY (`adjective_id`) REFERENCES `adjectives` (`id`) ON DELETE CASCADE; diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/postgresql.sql b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/postgresql.sql deleted file mode 100644 index f8e07a1..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/postgresql.sql +++ /dev/null @@ -1,55 +0,0 @@ -CREATE TABLE "fun_users" ( - "id" SERIAL NOT NULL, - "type" varchar(255) NOT NULL, - "firstname" varchar(50) NOT NULL, - "lastname" varchar(50) NOT NULL, - "login" varchar(50) NOT NULL, - "email" varchar(50) NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "groups" ( - "id" SERIAL NOT NULL, - "name" varchar(50) NOT NULL UNIQUE, - "description" varchar(50) default NULL, - "some_int" integer default NULL, - "some_float" float default NULL, - "some_bool" boolean default NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "group_memberships" ( - "id" SERIAL, - "fun_user_id" int NOT NULL, - "group_id" int NOT NULL, - PRIMARY KEY ("id") -); - -CREATE TABLE "adjectives" ( - "id" SERIAL, - "name" varchar(255), - PRIMARY KEY ("id") -); - -CREATE TABLE "adjectives_fun_users" ( - "fun_user_id" int NOT NULL, - "adjective_id" int NOT NULL, - PRIMARY KEY ("fun_user_id","adjective_id") -); - -CREATE TABLE "group_tag" ( - "id" SERIAL NOT NULL, - "name" varchar(50) NOT NULL, - "group_id" int NOT NULL, - "referenced_group_id" int NULL UNIQUE, - PRIMARY KEY ("id") -); - -ALTER TABLE "group_tag" - ADD FOREIGN KEY ("group_id") REFERENCES "groups" ("id") ON DELETE CASCADE; - -ALTER TABLE "group_tag" - ADD FOREIGN KEY ("referenced_group_id") REFERENCES "groups" ("id") ON DELETE CASCADE; - -ALTER TABLE "adjectives_fun_users" - ADD FOREIGN KEY ("adjective_id") REFERENCES "adjectives" ("id") ON DELETE CASCADE; diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/sqlite.sql b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/sqlite.sql deleted file mode 100644 index 66a8347..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/db_definitions/sqlite.sql +++ /dev/null @@ -1,49 +0,0 @@ -CREATE TABLE `fun_users` ( - `id` int(11) NOT NULL, - `type` varchar(255) NOT NULL, - `firstname` varchar(50) NOT NULL, - `lastname` varchar(50) NOT NULL, - `login` varchar(50) NOT NULL, - `email` varchar(50) NULL, - PRIMARY KEY (`id`) -); - -CREATE TABLE `groups` ( - `id` int(11) NOT NULL , - `name` varchar(50) NOT NULL UNIQUE, - `description` varchar(50) default NULL, - `some_int` integer default NULL, - `some_float` float default NULL, - `some_bool` boolean default NULL, - PRIMARY KEY (`id`) -); - -CREATE TABLE `group_memberships` ( - `id` int(11) NOT NULL, - `fun_user_id` int(11) NOT NULL, - `group_id` int(11) NOT NULL, - PRIMARY KEY (`id`) -); - -CREATE TABLE `adjectives` ( - `id` int(11) NOT NULL, - `name` varchar(255), - PRIMARY KEY (`id`) -); - -CREATE TABLE `adjectives_fun_users` ( - `fun_user_id` int(11) NOT NULL, - `adjective_id` int(11) NOT NULL, - PRIMARY KEY (`fun_user_id`,`adjective_id`) -); - - -CREATE TABLE `group_tag` ( - `id` int(11) NOT NULL, - `name` varchar(50) NOT NULL, - `group_id` int(11) NOT NULL, - `referenced_group_id` int(11) NULL UNIQUE, - PRIMARY KEY (`id`) -); - - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/fun_users.yml b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/fun_users.yml deleted file mode 100644 index cb413d5..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/fun_users.yml +++ /dev/null @@ -1,14 +0,0 @@ -first: - id: 1 - firstname: First - lastname: Person - login: first - email: first@person.com - type: FunUser -second: - id: 2 - firstname: Second - lastname: Person - login: sec - email: sec@person.com - type: FunUserPlus diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_memberships.yml b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_memberships.yml deleted file mode 100644 index 97c1244..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_memberships.yml +++ /dev/null @@ -1,4 +0,0 @@ -first_first: - id: 1 - group_id: 1 - fun_user_id: 1 diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_tag.yml b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_tag.yml deleted file mode 100644 index 2f17265..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/group_tag.yml +++ /dev/null @@ -1,11 +0,0 @@ -first: - id: 1 - name: Test - group_id: 1 - referenced_group_id: 1 -second: - id: 2 - name: Also Test - group_id: 1 - referenced_group_id: NULL - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/groups.yml b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/groups.yml deleted file mode 100644 index 0317099..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/groups.yml +++ /dev/null @@ -1,12 +0,0 @@ -first: - id: 1 - name: Group One - description: First group -other: - id: 2 - name: Group Plus - description: Extended Group -other: - id: 2 - name: Group Plus - description: Extended Group diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/foreign_keys_test.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/foreign_keys_test.rb deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fun_user_plus.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/fun_user_plus.rb deleted file mode 100644 index 06868f1..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/fun_user_plus.rb +++ /dev/null @@ -1,2 +0,0 @@ -class FunUserPlus < FunUser -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_access_test.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_access_test.rb deleted file mode 100644 index afd6542..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_access_test.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'abstract_unit' -require 'pp' - -class InvisibleModelAccessTest < Test::Unit::TestCase - # fixtures :fun_users, :groups, :group_memberships, :group_tag - - def setup - create_fixtures :fun_users, :groups, :group_memberships, :group_tag - @classes = [FunUser, Group, GroupMembership, GroupTag] - @group = Group.find(:first) - end - - def test_attributes - assert_not_nil @group.name - end - - def test_find - @classes.each do |klass| - assert_not_nil obj = klass.find(1) - assert_equal klass, obj.class - end - end - - def test_sti - require 'fun_user_plus' - x = FunUserPlus.find(:all) - assert x.inject {|n,v| n &= v.class == FunUserPlus}, "Wrong object class in FunUserPlus.find(:all)" - plus = x.first - assert_not_nil plus - assert plus.is_a?(FunUser) - assert plus.class == FunUserPlus - end - - def test_new - assert group = Group.new(:name => 'New Group') - assert_equal Group, group.class - end - - def test_update - assert @group.update_attributes(:name => 'Group 1'), "Couldn't update:\n#{str=""; @group.errors.each_full { |msg| str += "#{msg}\n" }; str }" - end - - def test_delete - assert @group.destroy - end - - def test_validations - group = Group.new - group.description = "x"*100 - group.some_int = 99.9 - group.some_float = "bah" - # Active record seems to interpolate booleans anyway to either true, false or nil... - # group.some_bool = "xxx" => false (!) - - assert !group.valid?, "Group should not be valid" - [:name, :description, :some_int, :some_float].each do |x| - assert_not_nil group.errors[x], "Failed on #{x}=[#{group.send(x)}], it should be invalid" - end - - group = Group.new - group.name = "name" - group.description = "x"*49 - group.some_int = 99 - group.some_float = 99.9 - group.some_bool = true - assert group.valid?, "Group should be valid" - - group.name = @group.name - assert !group.valid?, "Groups should have unique names" - end -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_assoc_test.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_assoc_test.rb deleted file mode 100644 index 815d298..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_assoc_test.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'abstract_unit' - -class InvisibleModelAssocTest < Test::Unit::TestCase - # fixtures :fun_users, :groups, :group_memberships, :group_tag, :adjectives, :adjectives_fun_users - - def setup - create_fixtures :fun_users, :groups, :group_memberships, :group_tag, :adjectives, :adjectives_fun_users - @group = Group.find(1) - @group_tag = GroupTag.find(1) - @user = FunUser.find(1) - @membership = GroupMembership.find(1) - end - - def test_hatbm - assert_equal([Adjective.find(1)], @user.adjectives) - end - - def test_fk - - gt = GroupTag.find(1) - - # Not using FKs - g = gt.group - assert g.class == Group - assert g.id == 1 - - # Using FKs - if g.connection.supports_fetch_foreign_keys? - g = gt.referenced_group - assert g.class == Group - assert g.id == 1 - end - end - - def test_has_many - assert_equal [@membership], @group.group_memberships - assert_equal @group, @membership.group - end - - def test_has_one - if @group_tag.connection.supports_fetch_foreign_keys? - assert_equal @group, @group_tag.referenced_group - # assert_equal @group_tag, @group.group_tag_as_referenced_group - end - end - - def test_belongs_to - assert_equal @user, @membership.fun_user - assert_equal @group, @membership.group - manual_result = GroupTag.find(:all, :conditions => ['group_tag.group_id = ?', @group.id]) #.sort{|a,b| a.id <=> b.id} - auto_result = @group.group_tags #.sort{|a,b| a.id <=> b.id} - assert manual_result == auto_result, "[#{manual_result.join(',')}] != [#{auto_result.join(',')}]" - - end - - def test_indirect - assert_equal [@user], @group.fun_users - assert_equal [@group], @user.groups - end - -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_classes_test.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_classes_test.rb deleted file mode 100644 index 883d175..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/invisible_model_classes_test.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'abstract_unit' - -class InvisibleModelClassesTest < Test::Unit::TestCase - - def setup - - end - - def test_available - assert_not_nil Group - assert_not_nil FunUser - assert_not_nil GroupMembership - assert_not_nil GroupTag, "Could not find GroupTag with singularized table name 'GroupTag'" - end - - def test_table_names - assert_equal 'groups', Group.table_name - assert_equal 'fun_users', FunUser.table_name - assert_equal 'group_memberships', GroupMembership.table_name - assert_equal 'group_tag', GroupTag.table_name - end - -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/magic_module_test.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/magic_module_test.rb deleted file mode 100644 index 27a5c74..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/magic_module_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'abstract_unit' - -module MagicGroup - magic_module :table_name_prefix => 'group_' -end - -class MagicModuleTest < Test::Unit::TestCase - - def setup - - end - - def test_table_prefix - assert_nothing_thrown { MagicGroup::Membership } - assert_equal('group_memberships', MagicGroup::Membership.table_name) - assert_nothing_thrown { MagicGroup::Tag } - assert_equal('group_tag', MagicGroup::Tag.table_name) - end - -end diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/test_existing_model.rb b/vendor/gems/dr_nic_magic_models-0.9.2/test/test_existing_model.rb deleted file mode 100644 index 29378d1..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/test/test_existing_model.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'abstract_unit' -require 'pp' - -module TestBed - class Group < ActiveRecord::Base - generate_validations - end -end - -class TestExistingModel < Test::Unit::TestCase - # fixtures :fun_users, :groups, :group_memberships, :group_tag - - def setup - create_fixtures :fun_users, :groups, :group_memberships, :group_tag - end - - def test_valid - assert(!TestBed::Group.new.valid?) - end -end \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/index.html b/vendor/gems/dr_nic_magic_models-0.9.2/website/index.html deleted file mode 100644 index 06a2dca..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/index.html +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - Dr Nic’s Magic Models - - - - - - - -
-

↩ More Magic

- -
- Get Version - -
-

Dr Nic’s Magic Models

-

If you’ve used Ruby on Rails you’ll have written at least one model class like this:

- - -

-class Person < ActiveRecord::Base
-  has_many :memberships
-  has_many :groups, :through => :memberships
-  belongs_to :family
-  validates_presence_of :firstname, :lastname, :email
-end
-

- - -

A few minutes later you’ll have wondered to yourself,

- - -
-Why do I have write my own has_many, belongs_to, and validates_presence_of -commands if all the data is in the database schema? -
- -

Now, for the very first time, your classes can look like this:

- - -

-class Person < ActiveRecord::Base
-end
-

- - -

or, if you are lazy…

- - -

-class Person < ActiveRecord::Base; end
-

- - -

or, if you read right to the end of this page, this…

- - -

-# Go fish.
-

- - -

Magic and mystery abound. All for you. Impress your friends, amaze your mother.

- - -

NOTE: The gratuitous use of Dr Nic’s in the name should only enhance the mystical magikery, -for magic needs a magician; and I love magic. I always wanted to create my own magic trick. -So I shall be the magician for the sake of magic itself. I look a bit like Harry Potter too, -if Harry were 32 and better dressed.

- - -

Installation

- - -To install the Dr Nic’s Magic Models gem you can run the following command to -fetch the gem remotely from RubyForge: -
-gem install dr_nic_magic_models
-
- -

or download the gem manually and -run the above command in the download directory.

- - -

Now you need to require the gem into your Ruby/Rails app. Insert the following -line into your script (use config/environment.rb for your Rails apps):

- - -
-require 'dr_nic_magic_models'
-
- -

Your application is now blessed with magical mystery.

- - -

David Copperfield eat your Ruby-crusted heart out

- - -

Let’s demonstrate the magical mystery in all its full-stage glory. Create a Ruby on Rails app (example uses sqlite3, but use your favourite databas):

- - -

-rails magic_show -d sqlite3
-cd magic_show
-ruby script/generate model Person
-ruby script/generate model Group
-ruby script/generate model Membership
-

- - -

Update the migration 001_create_people.rb with: -

-class CreatePeople < ActiveRecord::Migration
-  def self.up
-    create_table :people do |t|
-      t.column :firstname, :string, :null => false
-      t.column :lastname, :string, :null => false
-      t.column :email, :string, :null => false
-    end
-  end
-
-  def self.down
-    drop_table :people
-  end
-end
-

- - -

Similarly, update the def self.up method of 002_create_groups.rb -with: -

-    create_table :groups do |t|
-      t.column :name, :string, :null => false
-      t.column :description, :string
-    end
-

- - -

and 003_create_memberships.rb with: -

-    create_table :memberships do |t|
-      t.column :person_id, :integer, :null => false
-      t.column :group_id, :integer, :null => false
-    end
-

- - -And run your migrations to create the three tables: -
-rake db:migrate
-
- -

And now for some woofle dust ...

- - -

At the end of config/environment.rb add the following line:

- - -
-require 'dr_nic_magic_models'
-
- -

Now, let’s do a magic trick. First, let’s check our model classes (app/models/person.rb etc):

- - -

-class Person < ActiveRecord::Base
-end
-class Group < ActiveRecord::Base
-end
-class Membership < ActiveRecord::Base
-end
-

- - -

Nothing suspicious here. We have no validations and no associations. Just some plain old model classes.

- - -

UPDATE: To turn on magic validations, you now need to invoke generate_validations on defined classes. So, update your model classes:

- - -

-class Person < ActiveRecord::Base
-  generate_validations
-end
-class Group < ActiveRecord::Base
-  generate_validations
-end
-class Membership < ActiveRecord::Base
-  generate_validations
-end
-

- - -

For this trick, we’ll need an ordinary console session. Any old one lying around the house will do.

- - -
-ruby script/console
-
- -

Now a normal model class is valid until you explicitly add validates_xxx commands. -With Dr Nic’s Magic Models:

- - -

-person = Person.new
-=> #<Person:0x393e0f8 @attributes={"lastname"=>"", "firstname"=>"", "email"=>""}, @new_record=true>
-person.valid?
-=> false
-person.errors
-=> #<ActiveRecord::Errors:0x3537b38 @errors={
-	"firstname"=>["can't be blank", "is too long (maximum is 255 characters)"], 
-	"lastname"=>["can't be blank", "is too long (maximum is 255 characters)"], 
-	"email"=>["can't be blank", "is too long (maximum is 255 characters)"]},
-	 @base=#<Person:0x3538bf0 @errors=#<ActiveRecord::Errors:0x3537b38 ...>, @new_record=true, 
-		@attributes={"lastname"=>nil, "firstname"=>nil, "email"=>nil}>>
-

- - -

Kapoow! Instant validation! (NOTE: not as instant as it used to be – remember – you need to call generate_validations on each class as required)

- - -

Because you specified the three columns as :null => false, -your ActiveRecord models will now automagically generated validates_presence_of -for each non-null field, plus several other validations (since version 0.8.0).

- - -

Ok, we’re just warming up.

- - -

Your models normally require association commands (has_many, belongs_to, etc, as -demonstrated above) to have the brilliantly simple support that Rails/ActiveRecords are known for.

- - -

Let’s just watch what Dr Nic’s Magic Models can do without any effort at all…

- - -

-person = Person.create(:firstname => "Nic", :lastname => "Williams", :email => "drnicwilliams@gmail.com")
-group = Group.create(:name => "Magic Models Forum", :description => "http://groups.google.com/magicmodels")
-membership = Membership.create(:person => person, :group => group)
-person.memberships.length
-=> 1
-membership.person
-=> <Person:0x38898e8 @attributes={"lastname"=>"Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>
-group.memberships
-=> [<Membership:0x3c8cd70 @attributes={"group_id"=>"1", "id"=>"1", "person_id"=>"1"}>]
-

- - -

That final association trick is a ripper. Automatic generation of has_many :through associations…

- - -

->> person.groups
-=> [<Group:0x39047e0 @attributes={"name"=>"Magic Models Forum", "id"=>"1", "description"=>nil}>]
->> group.people
-=> [<Person:0x3c33580 @attributes={"lastname"=>"Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>]
-

- - -

Drum roll…

- - -

Ladies and gentlemen. For my final feat of magical mastery, I’ll ask you to do -something you’ve never done before. This illusion is akin to the floating lady -illusion that has been passed down through generations of magicians.

- - -

Exit your console session.

- - -DELETE your three model classes: person.rb, group.rb, and membership.rb from the -app/models folder. (You can always get them back via the model generator… be fearless!) - -
rm app/models/*.rb
- -

Re-launch your console.

- - -

drums are still rolling…

- - -

Be prepared to applaud loudly…

- - -

->> Person
-=> Person
-

- - -

You applaud loudly, but watch for more…

- - -

->> Person.new.valid?
-=> false
->> person = Person.find(1)
-=> <Person:0x3958930 @attributes={"lastname"=>"Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>
->> person.valid?
-=> true
->> person.memberships
-=> [<Membership:0x393a000 @attributes={"group_id"=>"1", "id"=>"1", "person_id"=>"1"}>]
->> person.groups
-=> [<Group:0x390df60 @attributes={"name"=>"Magic Models Forum", "id"=>"1", "description"=>nil}>]
-

- - -

Tada!

- - -

The end.

- - -

Use modules to scope your magic

- - -

Only want to pick up tables starting with blog_?

- - -

module Blog
-  magic_module :table_name_prefix => 'blog_'
-end
-
-Blog::Post.table_name #	=> 'blog_posts'
-

- - -

Dr Nic’s Blog

- - -

http://www.drnicwilliams.com – for future announcements and -other stories and things.

- - -

Articles about Magic Models

- - - - - -

Forum

- - -

http://groups.google.com/group/magicmodels

- - -

Licence

- - -

This code is free to use under the terms of the MIT licence.

- - -

Contact

- - -

Comments are welcome. Send an email to Dr Nic Williams -or via his blog at http://www.drnicwilliams.com

-

- Dr Nic, 30th April 2007
- Theme extended from Paul Battley -

-
- - - - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/index.txt b/vendor/gems/dr_nic_magic_models-0.9.2/website/index.txt deleted file mode 100644 index e3cc4cf..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/index.txt +++ /dev/null @@ -1,291 +0,0 @@ -h1. Dr Nic's Magic Models - -If you've used Ruby on Rails you'll have written at least one model class like this: - -
-class Person < ActiveRecord::Base
-  has_many :memberships
-  has_many :groups, :through => :memberships
-  belongs_to :family
-  validates_presence_of :firstname, :lastname, :email
-end
-
- -A few minutes later you'll have wondered to yourself, - -
-Why do I have write my own has_many, belongs_to, and validates_presence_of -commands if all the data is in the database schema? -
- -Now, for the very first time, your classes can look like this: - -
-class Person < ActiveRecord::Base
-end
-
- -or, if you are lazy... - -
-class Person < ActiveRecord::Base; end
-
- -or, if you read right to the end of this page, this... - -
-# Go fish.
-
- -Magic and mystery abound. All for you. Impress your friends, amaze your mother. - -NOTE: The gratuitous use of *Dr Nic's* in the name should only enhance the mystical magikery, -for magic needs a magician; and I love magic. I always wanted to create my own magic trick. -So I shall be the magician for the sake of magic itself. I look a bit like Harry Potter too, -if Harry were 32 and better dressed. - -h2. Installation - -To install the Dr Nic's Magic Models gem you can run the following command to -fetch the gem remotely from RubyForge: -
-gem install dr_nic_magic_models
-
- -or "download the gem manually":http://rubyforge.org/projects/magicmodels and -run the above command in the download directory. - -Now you need to require the gem into your Ruby/Rails app. Insert the following -line into your script (use config/environment.rb for your Rails apps): - -
-require 'dr_nic_magic_models'
-
- -Your application is now blessed with magical mystery. - -h2. David Copperfield eat your Ruby-crusted heart out - -Let's demonstrate the magical mystery in all its full-stage glory. Create a Ruby on Rails app (example uses sqlite3, but use your favourite databas): - -
-rails magic_show -d sqlite3
-cd magic_show
-ruby script/generate model Person
-ruby script/generate model Group
-ruby script/generate model Membership
-
- -Update the migration 001_create_people.rb with: -
-class CreatePeople < ActiveRecord::Migration
-  def self.up
-    create_table :people do |t|
-      t.column :firstname, :string, :null => false
-      t.column :lastname, :string, :null => false
-      t.column :email, :string, :null => false
-    end
-  end
-
-  def self.down
-    drop_table :people
-  end
-end
-
- -Similarly, update the def self.up method of 002_create_groups.rb -with: -
-    create_table :groups do |t|
-      t.column :name, :string, :null => false
-      t.column :description, :string
-    end
-
- -and 003_create_memberships.rb with: -
-    create_table :memberships do |t|
-      t.column :person_id, :integer, :null => false
-      t.column :group_id, :integer, :null => false
-    end
-
- -And run your migrations to create the three tables: -
-rake db:migrate
-
- -h3. And now for some "woofle dust":http://en.wikipedia.org/wiki/List_of_conjuring_terms ... - -At the end of config/environment.rb add the following line: - -
-require 'dr_nic_magic_models'
-
- -Now, let's do a magic trick. First, let's check our model classes (app/models/person.rb etc): - -
-class Person < ActiveRecord::Base
-end
-class Group < ActiveRecord::Base
-end
-class Membership < ActiveRecord::Base
-end
-
- -Nothing suspicious here. We have no validations and no associations. Just some plain old model classes. - -UPDATE: To turn on magic validations, you now need to invoke generate_validations on defined classes. So, update your model classes: - -
-class Person < ActiveRecord::Base
-  generate_validations
-end
-class Group < ActiveRecord::Base
-  generate_validations
-end
-class Membership < ActiveRecord::Base
-  generate_validations
-end
-
- -For this trick, we'll need an ordinary console session. Any old one lying around the house will do. - -
-ruby script/console
-
- -Now a normal model class is valid until you explicitly add validates_xxx commands. -With Dr Nic's Magic Models: - -
-person = Person.new
-=> #"", "firstname"=>"", "email"=>""}, @new_record=true>
-person.valid?
-=> false
-person.errors
-=> #["can't be blank", "is too long (maximum is 255 characters)"], 
-	"lastname"=>["can't be blank", "is too long (maximum is 255 characters)"], 
-	"email"=>["can't be blank", "is too long (maximum is 255 characters)"]},
-	 @base=#, @new_record=true, 
-		@attributes={"lastname"=>nil, "firstname"=>nil, "email"=>nil}>>
-
- -*Kapoow!* Instant validation! (NOTE: not as instant as it used to be - remember - you need to call generate_validations on each class as required) - -Because you specified the three columns as :null => false, -your ActiveRecord models will now automagically generated validates_presence_of -for each non-null field, plus several other validations (since version 0.8.0). - -Ok, we're just warming up. - -Your models normally require association commands (has_many, belongs_to, etc, as -demonstrated above) to have the brilliantly simple support that Rails/ActiveRecords are known for. - -Let's just watch what Dr Nic's Magic Models can do without any effort at all... - -
-person = Person.create(:firstname => "Nic", :lastname => "Williams", :email => "drnicwilliams@gmail.com")
-group = Group.create(:name => "Magic Models Forum", :description => "http://groups.google.com/magicmodels")
-membership = Membership.create(:person => person, :group => group)
-person.memberships.length
-=> 1
-membership.person
-=> "Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>
-group.memberships
-=> ["1", "id"=>"1", "person_id"=>"1"}>]
-
- - -That final association trick is a ripper. Automatic generation of has_many :through associations... - -
->> person.groups
-=> ["Magic Models Forum", "id"=>"1", "description"=>nil}>]
->> group.people
-=> ["Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>]
-
- -h3. Drum roll... - -Ladies and gentlemen. For my final feat of magical mastery, I'll ask you to do -something you've never done before. This illusion is akin to the "floating lady":http://www.toytent.com/Posters/985.html -illusion that has been passed down through generations of magicians. - -Exit your console session. - -DELETE your three model classes: person.rb, group.rb, and membership.rb from the -app/models folder. (You can always get them back via the model generator... be fearless!) - -
rm app/models/*.rb
- -Re-launch your console. - -*drums are still rolling...* - -Be prepared to applaud loudly... - -
->> Person
-=> Person
-
- -You applaud loudly, but watch for more... - -
->> Person.new.valid?
-=> false
->> person = Person.find(1)
-=> "Williams", "firstname"=>"Nic", 
-"id"=>"1", "email"=>"drnicwilliams@gmail.com"}>
->> person.valid?
-=> true
->> person.memberships
-=> ["1", "id"=>"1", "person_id"=>"1"}>]
->> person.groups
-=> ["Magic Models Forum", "id"=>"1", "description"=>nil}>]
-
- -h3. Tada! - -The end. - -h3. Use modules to scope your magic - -Only want to pick up tables starting with blog_? - -
module Blog
-  magic_module :table_name_prefix => 'blog_'
-end
-
-Blog::Post.table_name #	=> 'blog_posts'
-
- -h2. Dr Nic's Blog - -"http://www.drnicwilliams.com":http://www.drnicwilliams.com - for future announcements and -other stories and things. - -h2. Articles about Magic Models - -* "Announcement":http://drnicwilliams.com/2006/08/07/ann-dr-nics-magic-models/ -* "BTS - Class creation":http://drnicwilliams.com/2006/08/10/bts-magic-models-class-creation/ - - -h2. Forum - -"http://groups.google.com/group/magicmodels":http://groups.google.com/group/magicmodels - -h2. Licence - -This code is free to use under the terms of the MIT licence. - -h2. Contact - -Comments are welcome. Send an email to "Dr Nic Williams":mailto:drnicwilliams@gmail.com -or via his blog at "http://www.drnicwilliams.com":http://www.drnicwilliams.com - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/javascripts/rounded_corners_lite.inc.js b/vendor/gems/dr_nic_magic_models-0.9.2/website/javascripts/rounded_corners_lite.inc.js deleted file mode 100644 index afc3ea3..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/javascripts/rounded_corners_lite.inc.js +++ /dev/null @@ -1,285 +0,0 @@ - - /**************************************************************** - * * - * curvyCorners * - * ------------ * - * * - * This script generates rounded corners for your divs. * - * * - * Version 1.2.9 * - * Copyright (c) 2006 Cameron Cooke * - * By: Cameron Cooke and Tim Hutchison. * - * * - * * - * Website: http://www.curvycorners.net * - * Email: info@totalinfinity.com * - * Forum: http://www.curvycorners.net/forum/ * - * * - * * - * This library is free software; you can redistribute * - * it and/or modify it under the terms of the GNU * - * Lesser General Public License as published by the * - * Free Software Foundation; either version 2.1 of the * - * License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will * - * be useful, but WITHOUT ANY WARRANTY; without even the * - * implied warranty of MERCHANTABILITY or FITNESS FOR A * - * PARTICULAR PURPOSE. See the GNU Lesser General Public * - * License for more details. * - * * - * You should have received a copy of the GNU Lesser * - * General Public License along with this library; * - * Inc., 59 Temple Place, Suite 330, Boston, * - * MA 02111-1307 USA * - * * - ****************************************************************/ - -var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1; var isMoz = document.implementation && document.implementation.createDocument; var isSafari = ((navigator.userAgent.toLowerCase().indexOf('safari')!=-1)&&(navigator.userAgent.toLowerCase().indexOf('mac')!=-1))?true:false; function curvyCorners() -{ if(typeof(arguments[0]) != "object") throw newCurvyError("First parameter of curvyCorners() must be an object."); if(typeof(arguments[1]) != "object" && typeof(arguments[1]) != "string") throw newCurvyError("Second parameter of curvyCorners() must be an object or a class name."); if(typeof(arguments[1]) == "string") -{ var startIndex = 0; var boxCol = getElementsByClass(arguments[1]);} -else -{ var startIndex = 1; var boxCol = arguments;} -var curvyCornersCol = new Array(); if(arguments[0].validTags) -var validElements = arguments[0].validTags; else -var validElements = ["div"]; for(var i = startIndex, j = boxCol.length; i < j; i++) -{ var currentTag = boxCol[i].tagName.toLowerCase(); if(inArray(validElements, currentTag) !== false) -{ curvyCornersCol[curvyCornersCol.length] = new curvyObject(arguments[0], boxCol[i]);} -} -this.objects = curvyCornersCol; this.applyCornersToAll = function() -{ for(var x = 0, k = this.objects.length; x < k; x++) -{ this.objects[x].applyCorners();} -} -} -function curvyObject() -{ this.box = arguments[1]; this.settings = arguments[0]; this.topContainer = null; this.bottomContainer = null; this.masterCorners = new Array(); this.contentDIV = null; var boxHeight = get_style(this.box, "height", "height"); var boxWidth = get_style(this.box, "width", "width"); var borderWidth = get_style(this.box, "borderTopWidth", "border-top-width"); var borderColour = get_style(this.box, "borderTopColor", "border-top-color"); var boxColour = get_style(this.box, "backgroundColor", "background-color"); var backgroundImage = get_style(this.box, "backgroundImage", "background-image"); var boxPosition = get_style(this.box, "position", "position"); var boxPadding = get_style(this.box, "paddingTop", "padding-top"); this.boxHeight = parseInt(((boxHeight != "" && boxHeight != "auto" && boxHeight.indexOf("%") == -1)? boxHeight.substring(0, boxHeight.indexOf("px")) : this.box.scrollHeight)); this.boxWidth = parseInt(((boxWidth != "" && boxWidth != "auto" && boxWidth.indexOf("%") == -1)? boxWidth.substring(0, boxWidth.indexOf("px")) : this.box.scrollWidth)); this.borderWidth = parseInt(((borderWidth != "" && borderWidth.indexOf("px") !== -1)? borderWidth.slice(0, borderWidth.indexOf("px")) : 0)); this.boxColour = format_colour(boxColour); this.boxPadding = parseInt(((boxPadding != "" && boxPadding.indexOf("px") !== -1)? boxPadding.slice(0, boxPadding.indexOf("px")) : 0)); this.borderColour = format_colour(borderColour); this.borderString = this.borderWidth + "px" + " solid " + this.borderColour; this.backgroundImage = ((backgroundImage != "none")? backgroundImage : ""); this.boxContent = this.box.innerHTML; if(boxPosition != "absolute") this.box.style.position = "relative"; this.box.style.padding = "0px"; if(isIE && boxWidth == "auto" && boxHeight == "auto") this.box.style.width = "100%"; if(this.settings.autoPad == true && this.boxPadding > 0) -this.box.innerHTML = ""; this.applyCorners = function() -{ for(var t = 0; t < 2; t++) -{ switch(t) -{ case 0: -if(this.settings.tl || this.settings.tr) -{ var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var topMaxRadius = Math.max(this.settings.tl ? this.settings.tl.radius : 0, this.settings.tr ? this.settings.tr.radius : 0); newMainContainer.style.height = topMaxRadius + "px"; newMainContainer.style.top = 0 - topMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.topContainer = this.box.appendChild(newMainContainer);} -break; case 1: -if(this.settings.bl || this.settings.br) -{ var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var botMaxRadius = Math.max(this.settings.bl ? this.settings.bl.radius : 0, this.settings.br ? this.settings.br.radius : 0); newMainContainer.style.height = botMaxRadius + "px"; newMainContainer.style.bottom = 0 - botMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.bottomContainer = this.box.appendChild(newMainContainer);} -break;} -} -if(this.topContainer) this.box.style.borderTopWidth = "0px"; if(this.bottomContainer) this.box.style.borderBottomWidth = "0px"; var corners = ["tr", "tl", "br", "bl"]; for(var i in corners) -{ if(i > -1 < 4) -{ var cc = corners[i]; if(!this.settings[cc]) -{ if(((cc == "tr" || cc == "tl") && this.topContainer != null) || ((cc == "br" || cc == "bl") && this.bottomContainer != null)) -{ var newCorner = document.createElement("DIV"); newCorner.style.position = "relative"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; if(this.backgroundImage == "") -newCorner.style.backgroundColor = this.boxColour; else -newCorner.style.backgroundImage = this.backgroundImage; switch(cc) -{ case "tl": -newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.tr.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.left = -this.borderWidth + "px"; break; case "tr": -newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.tl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; newCorner.style.left = this.borderWidth + "px"; break; case "bl": -newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.br.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = -this.borderWidth + "px"; newCorner.style.backgroundPosition = "-" + (this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break; case "br": -newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.bl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = this.borderWidth + "px" -newCorner.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break;} -} -} -else -{ if(this.masterCorners[this.settings[cc].radius]) -{ var newCorner = this.masterCorners[this.settings[cc].radius].cloneNode(true);} -else -{ var newCorner = document.createElement("DIV"); newCorner.style.height = this.settings[cc].radius + "px"; newCorner.style.width = this.settings[cc].radius + "px"; newCorner.style.position = "absolute"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; var borderRadius = parseInt(this.settings[cc].radius - this.borderWidth); for(var intx = 0, j = this.settings[cc].radius; intx < j; intx++) -{ if((intx +1) >= borderRadius) -var y1 = -1; else -var y1 = (Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow((intx+1), 2))) - 1); if(borderRadius != j) -{ if((intx) >= borderRadius) -var y2 = -1; else -var y2 = Math.ceil(Math.sqrt(Math.pow(borderRadius,2) - Math.pow(intx, 2))); if((intx+1) >= j) -var y3 = -1; else -var y3 = (Math.floor(Math.sqrt(Math.pow(j ,2) - Math.pow((intx+1), 2))) - 1);} -if((intx) >= j) -var y4 = -1; else -var y4 = Math.ceil(Math.sqrt(Math.pow(j ,2) - Math.pow(intx, 2))); if(y1 > -1) this.drawPixel(intx, 0, this.boxColour, 100, (y1+1), newCorner, -1, this.settings[cc].radius); if(borderRadius != j) -{ for(var inty = (y1 + 1); inty < y2; inty++) -{ if(this.settings.antiAlias) -{ if(this.backgroundImage != "") -{ var borderFract = (pixelFraction(intx, inty, borderRadius) * 100); if(borderFract < 30) -{ this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, 0, this.settings[cc].radius);} -else -{ this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, -1, this.settings[cc].radius);} -} -else -{ var pixelcolour = BlendColour(this.boxColour, this.borderColour, pixelFraction(intx, inty, borderRadius)); this.drawPixel(intx, inty, pixelcolour, 100, 1, newCorner, 0, this.settings[cc].radius, cc);} -} -} -if(this.settings.antiAlias) -{ if(y3 >= y2) -{ if (y2 == -1) y2 = 0; this.drawPixel(intx, y2, this.borderColour, 100, (y3 - y2 + 1), newCorner, 0, 0);} -} -else -{ if(y3 >= y1) -{ this.drawPixel(intx, (y1 + 1), this.borderColour, 100, (y3 - y1), newCorner, 0, 0);} -} -var outsideColour = this.borderColour;} -else -{ var outsideColour = this.boxColour; var y3 = y1;} -if(this.settings.antiAlias) -{ for(var inty = (y3 + 1); inty < y4; inty++) -{ this.drawPixel(intx, inty, outsideColour, (pixelFraction(intx, inty , j) * 100), 1, newCorner, ((this.borderWidth > 0)? 0 : -1), this.settings[cc].radius);} -} -} -this.masterCorners[this.settings[cc].radius] = newCorner.cloneNode(true);} -if(cc != "br") -{ for(var t = 0, k = newCorner.childNodes.length; t < k; t++) -{ var pixelBar = newCorner.childNodes[t]; var pixelBarTop = parseInt(pixelBar.style.top.substring(0, pixelBar.style.top.indexOf("px"))); var pixelBarLeft = parseInt(pixelBar.style.left.substring(0, pixelBar.style.left.indexOf("px"))); var pixelBarHeight = parseInt(pixelBar.style.height.substring(0, pixelBar.style.height.indexOf("px"))); if(cc == "tl" || cc == "bl"){ pixelBar.style.left = this.settings[cc].radius -pixelBarLeft -1 + "px";} -if(cc == "tr" || cc == "tl"){ pixelBar.style.top = this.settings[cc].radius -pixelBarHeight -pixelBarTop + "px";} -switch(cc) -{ case "tr": -pixelBar.style.backgroundPosition = "-" + Math.abs((this.boxWidth - this.settings[cc].radius + this.borderWidth) + pixelBarLeft) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "tl": -pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "bl": -pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs((this.boxHeight + this.settings[cc].radius + pixelBarTop) -this.borderWidth) + "px"; break;} -} -} -} -if(newCorner) -{ switch(cc) -{ case "tl": -if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "tr": -if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "bl": -if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break; case "br": -if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break;} -} -} -} -var radiusDiff = new Array(); radiusDiff["t"] = Math.abs(this.settings.tl.radius - this.settings.tr.radius) -radiusDiff["b"] = Math.abs(this.settings.bl.radius - this.settings.br.radius); for(z in radiusDiff) -{ if(z == "t" || z == "b") -{ if(radiusDiff[z]) -{ var smallerCornerType = ((this.settings[z + "l"].radius < this.settings[z + "r"].radius)? z +"l" : z +"r"); var newFiller = document.createElement("DIV"); newFiller.style.height = radiusDiff[z] + "px"; newFiller.style.width = this.settings[smallerCornerType].radius+ "px" -newFiller.style.position = "absolute"; newFiller.style.fontSize = "1px"; newFiller.style.overflow = "hidden"; newFiller.style.backgroundColor = this.boxColour; switch(smallerCornerType) -{ case "tl": -newFiller.style.bottom = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.topContainer.appendChild(newFiller); break; case "tr": -newFiller.style.bottom = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.topContainer.appendChild(newFiller); break; case "bl": -newFiller.style.top = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.bottomContainer.appendChild(newFiller); break; case "br": -newFiller.style.top = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.bottomContainer.appendChild(newFiller); break;} -} -var newFillerBar = document.createElement("DIV"); newFillerBar.style.position = "relative"; newFillerBar.style.fontSize = "1px"; newFillerBar.style.overflow = "hidden"; newFillerBar.style.backgroundColor = this.boxColour; newFillerBar.style.backgroundImage = this.backgroundImage; switch(z) -{ case "t": -if(this.topContainer) -{ if(this.settings.tl.radius && this.settings.tr.radius) -{ newFillerBar.style.height = topMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.tl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.tr.radius - this.borderWidth + "px"; newFillerBar.style.borderTop = this.borderString; if(this.backgroundImage != "") -newFillerBar.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; this.topContainer.appendChild(newFillerBar);} -this.box.style.backgroundPosition = "0px -" + (topMaxRadius - this.borderWidth) + "px";} -break; case "b": -if(this.bottomContainer) -{ if(this.settings.bl.radius && this.settings.br.radius) -{ newFillerBar.style.height = botMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.bl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.br.radius - this.borderWidth + "px"; newFillerBar.style.borderBottom = this.borderString; if(this.backgroundImage != "") -newFillerBar.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (topMaxRadius + this.borderWidth)) + "px"; this.bottomContainer.appendChild(newFillerBar);} -} -break;} -} -} -if(this.settings.autoPad == true && this.boxPadding > 0) -{ var contentContainer = document.createElement("DIV"); contentContainer.style.position = "relative"; contentContainer.innerHTML = this.boxContent; contentContainer.className = "autoPadDiv"; var topPadding = Math.abs(topMaxRadius - this.boxPadding); var botPadding = Math.abs(botMaxRadius - this.boxPadding); if(topMaxRadius < this.boxPadding) -contentContainer.style.paddingTop = topPadding + "px"; if(botMaxRadius < this.boxPadding) -contentContainer.style.paddingBottom = botMaxRadius + "px"; contentContainer.style.paddingLeft = this.boxPadding + "px"; contentContainer.style.paddingRight = this.boxPadding + "px"; this.contentDIV = this.box.appendChild(contentContainer);} -} -this.drawPixel = function(intx, inty, colour, transAmount, height, newCorner, image, cornerRadius) -{ var pixel = document.createElement("DIV"); pixel.style.height = height + "px"; pixel.style.width = "1px"; pixel.style.position = "absolute"; pixel.style.fontSize = "1px"; pixel.style.overflow = "hidden"; var topMaxRadius = Math.max(this.settings["tr"].radius, this.settings["tl"].radius); if(image == -1 && this.backgroundImage != "") -{ pixel.style.backgroundImage = this.backgroundImage; pixel.style.backgroundPosition = "-" + (this.boxWidth - (cornerRadius - intx) + this.borderWidth) + "px -" + ((this.boxHeight + topMaxRadius + inty) -this.borderWidth) + "px";} -else -{ pixel.style.backgroundColor = colour;} -if (transAmount != 100) -setOpacity(pixel, transAmount); pixel.style.top = inty + "px"; pixel.style.left = intx + "px"; newCorner.appendChild(pixel);} -} -function insertAfter(parent, node, referenceNode) -{ parent.insertBefore(node, referenceNode.nextSibling);} -function BlendColour(Col1, Col2, Col1Fraction) -{ var red1 = parseInt(Col1.substr(1,2),16); var green1 = parseInt(Col1.substr(3,2),16); var blue1 = parseInt(Col1.substr(5,2),16); var red2 = parseInt(Col2.substr(1,2),16); var green2 = parseInt(Col2.substr(3,2),16); var blue2 = parseInt(Col2.substr(5,2),16); if(Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1; var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction))); if(endRed > 255) endRed = 255; if(endRed < 0) endRed = 0; var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction))); if(endGreen > 255) endGreen = 255; if(endGreen < 0) endGreen = 0; var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction))); if(endBlue > 255) endBlue = 255; if(endBlue < 0) endBlue = 0; return "#" + IntToHex(endRed)+ IntToHex(endGreen)+ IntToHex(endBlue);} -function IntToHex(strNum) -{ base = strNum / 16; rem = strNum % 16; base = base - (rem / 16); baseS = MakeHex(base); remS = MakeHex(rem); return baseS + '' + remS;} -function MakeHex(x) -{ if((x >= 0) && (x <= 9)) -{ return x;} -else -{ switch(x) -{ case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F";} -} -} -function pixelFraction(x, y, r) -{ var pixelfraction = 0; var xvalues = new Array(1); var yvalues = new Array(1); var point = 0; var whatsides = ""; var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x,2))); if ((intersect >= y) && (intersect < (y+1))) -{ whatsides = "Left"; xvalues[point] = 0; yvalues[point] = intersect - y; point = point + 1;} -var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y+1,2))); if ((intersect >= x) && (intersect < (x+1))) -{ whatsides = whatsides + "Top"; xvalues[point] = intersect - x; yvalues[point] = 1; point = point + 1;} -var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x+1,2))); if ((intersect >= y) && (intersect < (y+1))) -{ whatsides = whatsides + "Right"; xvalues[point] = 1; yvalues[point] = intersect - y; point = point + 1;} -var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y,2))); if ((intersect >= x) && (intersect < (x+1))) -{ whatsides = whatsides + "Bottom"; xvalues[point] = intersect - x; yvalues[point] = 0;} -switch (whatsides) -{ case "LeftRight": -pixelfraction = Math.min(yvalues[0],yvalues[1]) + ((Math.max(yvalues[0],yvalues[1]) - Math.min(yvalues[0],yvalues[1]))/2); break; case "TopRight": -pixelfraction = 1-(((1-xvalues[0])*(1-yvalues[1]))/2); break; case "TopBottom": -pixelfraction = Math.min(xvalues[0],xvalues[1]) + ((Math.max(xvalues[0],xvalues[1]) - Math.min(xvalues[0],xvalues[1]))/2); break; case "LeftBottom": -pixelfraction = (yvalues[0]*xvalues[1])/2; break; default: -pixelfraction = 1;} -return pixelfraction;} -function rgb2Hex(rgbColour) -{ try{ var rgbArray = rgb2Array(rgbColour); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); var hexColour = "#" + IntToHex(red) + IntToHex(green) + IntToHex(blue);} -catch(e){ alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex");} -return hexColour;} -function rgb2Array(rgbColour) -{ var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")")); var rgbArray = rgbValues.split(", "); return rgbArray;} -function setOpacity(obj, opacity) -{ opacity = (opacity == 100)?99.999:opacity; if(isSafari && obj.tagName != "IFRAME") -{ var rgbArray = rgb2Array(obj.style.backgroundColor); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); obj.style.backgroundColor = "rgba(" + red + ", " + green + ", " + blue + ", " + opacity/100 + ")";} -else if(typeof(obj.style.opacity) != "undefined") -{ obj.style.opacity = opacity/100;} -else if(typeof(obj.style.MozOpacity) != "undefined") -{ obj.style.MozOpacity = opacity/100;} -else if(typeof(obj.style.filter) != "undefined") -{ obj.style.filter = "alpha(opacity:" + opacity + ")";} -else if(typeof(obj.style.KHTMLOpacity) != "undefined") -{ obj.style.KHTMLOpacity = opacity/100;} -} -function inArray(array, value) -{ for(var i = 0; i < array.length; i++){ if (array[i] === value) return i;} -return false;} -function inArrayKey(array, value) -{ for(key in array){ if(key === value) return true;} -return false;} -function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(evType, fn, useCapture); return true;} -else if (elm.attachEvent) { var r = elm.attachEvent('on' + evType, fn); return r;} -else { elm['on' + evType] = fn;} -} -function removeEvent(obj, evType, fn, useCapture){ if (obj.removeEventListener){ obj.removeEventListener(evType, fn, useCapture); return true;} else if (obj.detachEvent){ var r = obj.detachEvent("on"+evType, fn); return r;} else { alert("Handler could not be removed");} -} -function format_colour(colour) -{ var returnColour = "#ffffff"; if(colour != "" && colour != "transparent") -{ if(colour.substr(0, 3) == "rgb") -{ returnColour = rgb2Hex(colour);} -else if(colour.length == 4) -{ returnColour = "#" + colour.substring(1, 2) + colour.substring(1, 2) + colour.substring(2, 3) + colour.substring(2, 3) + colour.substring(3, 4) + colour.substring(3, 4);} -else -{ returnColour = colour;} -} -return returnColour;} -function get_style(obj, property, propertyNS) -{ try -{ if(obj.currentStyle) -{ var returnVal = eval("obj.currentStyle." + property);} -else -{ if(isSafari && obj.style.display == "none") -{ obj.style.display = ""; var wasHidden = true;} -var returnVal = document.defaultView.getComputedStyle(obj, '').getPropertyValue(propertyNS); if(isSafari && wasHidden) -{ obj.style.display = "none";} -} -} -catch(e) -{ } -return returnVal;} -function getElementsByClass(searchClass, node, tag) -{ var classElements = new Array(); if(node == null) -node = document; if(tag == null) -tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)"); for (i = 0, j = 0; i < elsLen; i++) -{ if(pattern.test(els[i].className)) -{ classElements[j] = els[i]; j++;} -} -return classElements;} -function newCurvyError(errorMessage) -{ return new Error("curvyCorners Error:\n" + errorMessage) -} diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/stylesheets/screen.css b/vendor/gems/dr_nic_magic_models-0.9.2/website/stylesheets/screen.css deleted file mode 100644 index 60dfc52..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/stylesheets/screen.css +++ /dev/null @@ -1,96 +0,0 @@ -body { - background-color: #115; - font-family: "Georgia", sans-serif; - font-size: 16px; - line-height: 1.6em; - padding: 1.6em 0 0 0; - color: #eee; -} -h1, h2, h3, h4, h5, h6 { - color: #77f; -} -h1 { - font-family: sans-serif; - font-weight: normal; - font-size: 4em; - line-height: 0.8em; - letter-spacing: -0.1ex; -} -li { - padding: 0; - margin: 0; - list-style-type: square; -} -a { - color: #99f; - font-weight: normal; - text-decoration: underline; -} -blockquote { - font-size: 90%; - font-style: italic; - border-left: 1px solid #eee; - padding-left: 1em; -} -.caps { - font-size: 80%; -} - -#main { - width: 55em; - padding: 0; - margin: 0 auto; -} -.coda { - text-align: right; - color: #77f; - font-size: smaller; -} - -pre, code { - font-family: monospace; - font-size: 90%; - line-height: 1.4em; - color: #ff8; - background-color: #111; - padding: 2px 10px 2px 10px; -} -.comment { color: #aaa; font-style: italic; } -.keyword { color: #eff; font-weight: bold; } -.punct { color: #eee; font-weight: bold; } -.symbol { color: #0bb; } -.string { color: #6b4; } -.ident { color: #ff8; } -.constant { color: #66f; } -.regex { color: #ec6; } -.number { color: #F99; } -.expr { color: #227; } - -#version { - float: right; - text-align: right; - font-family: sans-serif; - font-weight: normal; - background-color: #ff8; - color: #66f; - padding: 15px 20px 10px 20px; - margin: 0 auto; - border: 3px solid #66f; -} - -#version .numbers { - display: block; - font-size: 4em; - line-height: 0.8em; - letter-spacing: -0.1ex; -} - -#version a { - text-decoration: none; -} - -.clickable { - cursor: pointer; - cursor: hand; -} - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/template.js b/vendor/gems/dr_nic_magic_models-0.9.2/website/template.js deleted file mode 100644 index 465c080..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/template.js +++ /dev/null @@ -1,3 +0,0 @@ -// <%= title %> -var version = <%= version.to_json %>; -<%= body %> diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/template.rhtml b/vendor/gems/dr_nic_magic_models-0.9.2/website/template.rhtml deleted file mode 100644 index a1b9acd..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/template.rhtml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - <%= title %> - - - - - - - -
-

↩ More Magic

- -
- Get Version - -
-

<%= title %>

- <%= body %> -

- Dr Nic, <%= modified.pretty %>
- Theme extended from Paul Battley -

-
- - - - diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.js b/vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.js deleted file mode 100644 index 16f2b04..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.js +++ /dev/null @@ -1,3 +0,0 @@ -// Version JS file -var version = "0.9.2"; -MagicAnnouncement.show('magicmodels', version); diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.txt b/vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.txt deleted file mode 100644 index 52c602d..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/version-raw.txt +++ /dev/null @@ -1,2 +0,0 @@ -h1. Version JS file -MagicAnnouncement.show('magicmodels', version); \ No newline at end of file diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/version.js b/vendor/gems/dr_nic_magic_models-0.9.2/website/version.js deleted file mode 100644 index f7348f6..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/version.js +++ /dev/null @@ -1,4 +0,0 @@ -// Version JS file -var version = "0.9.2"; - -document.write(" - " + version); diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/website/version.txt b/vendor/gems/dr_nic_magic_models-0.9.2/website/version.txt deleted file mode 100644 index d0ac6a7..0000000 --- a/vendor/gems/dr_nic_magic_models-0.9.2/website/version.txt +++ /dev/null @@ -1,3 +0,0 @@ -h1. Version JS file - -document.write(" - " + version); \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/.specification b/vendor/gems/thoughtbot-shoulda-2.10.1/.specification deleted file mode 100644 index c6247c0..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/.specification +++ /dev/null @@ -1,258 +0,0 @@ ---- !ruby/object:Gem::Specification -name: thoughtbot-shoulda -version: !ruby/object:Gem::Version - version: 2.10.1 -platform: ruby -authors: -- Tammer Saleh -autorequire: -bindir: bin -cert_chain: [] - -date: 2009-03-05 00:00:00 -03:00 -default_executable: convert_to_should_syntax -dependencies: [] - -description: -email: tsaleh@thoughtbot.com -executables: -- convert_to_should_syntax -extensions: [] - -extra_rdoc_files: -- README.rdoc -- CONTRIBUTION_GUIDELINES.rdoc -files: -- CONTRIBUTION_GUIDELINES.rdoc -- MIT-LICENSE -- Rakefile -- README.rdoc -- bin/convert_to_should_syntax -- lib/shoulda -- lib/shoulda/action_controller -- lib/shoulda/action_controller/helpers.rb -- lib/shoulda/action_controller/macros.rb -- lib/shoulda/action_controller/matchers -- lib/shoulda/action_controller/matchers/assign_to_matcher.rb -- lib/shoulda/action_controller/matchers/filter_param_matcher.rb -- lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb -- lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb -- lib/shoulda/action_controller/matchers/respond_with_matcher.rb -- lib/shoulda/action_controller/matchers/route_matcher.rb -- lib/shoulda/action_controller/matchers/set_session_matcher.rb -- lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb -- lib/shoulda/action_controller/matchers.rb -- lib/shoulda/action_controller.rb -- lib/shoulda/action_mailer -- lib/shoulda/action_mailer/assertions.rb -- lib/shoulda/action_mailer.rb -- lib/shoulda/action_view -- lib/shoulda/action_view/macros.rb -- lib/shoulda/action_view.rb -- lib/shoulda/active_record -- lib/shoulda/active_record/assertions.rb -- lib/shoulda/active_record/helpers.rb -- lib/shoulda/active_record/macros.rb -- lib/shoulda/active_record/matchers -- lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb -- lib/shoulda/active_record/matchers/allow_value_matcher.rb -- lib/shoulda/active_record/matchers/association_matcher.rb -- lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb -- lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb -- lib/shoulda/active_record/matchers/have_db_column_matcher.rb -- lib/shoulda/active_record/matchers/have_index_matcher.rb -- lib/shoulda/active_record/matchers/have_named_scope_matcher.rb -- lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb -- lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb -- lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb -- lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb -- lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb -- lib/shoulda/active_record/matchers/validation_matcher.rb -- lib/shoulda/active_record/matchers.rb -- lib/shoulda/active_record.rb -- lib/shoulda/assertions.rb -- lib/shoulda/autoload_macros.rb -- lib/shoulda/context.rb -- lib/shoulda/helpers.rb -- lib/shoulda/macros.rb -- lib/shoulda/private_helpers.rb -- lib/shoulda/proc_extensions.rb -- lib/shoulda/rails.rb -- lib/shoulda/rspec.rb -- lib/shoulda/tasks -- lib/shoulda/tasks/list_tests.rake -- lib/shoulda/tasks/yaml_to_shoulda.rake -- lib/shoulda/tasks.rb -- lib/shoulda/test_unit.rb -- lib/shoulda.rb -- rails/init.rb -- test/fail_macros.rb -- test/fixtures -- test/fixtures/addresses.yml -- test/fixtures/friendships.yml -- test/fixtures/posts.yml -- test/fixtures/products.yml -- test/fixtures/taggings.yml -- test/fixtures/tags.yml -- test/fixtures/users.yml -- test/functional -- test/functional/posts_controller_test.rb -- test/functional/users_controller_test.rb -- test/matchers -- test/matchers/active_record -- test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb -- test/matchers/active_record/allow_value_matcher_test.rb -- test/matchers/active_record/association_matcher_test.rb -- test/matchers/active_record/ensure_inclusion_of_matcher_test.rb -- test/matchers/active_record/ensure_length_of_matcher_test.rb -- test/matchers/active_record/have_db_column_matcher_test.rb -- test/matchers/active_record/have_index_matcher_test.rb -- test/matchers/active_record/have_named_scope_matcher_test.rb -- test/matchers/active_record/have_readonly_attributes_matcher_test.rb -- test/matchers/active_record/validate_acceptance_of_matcher_test.rb -- test/matchers/active_record/validate_numericality_of_matcher_test.rb -- test/matchers/active_record/validate_presence_of_matcher_test.rb -- test/matchers/active_record/validate_uniqueness_of_matcher_test.rb -- test/matchers/controller -- test/matchers/controller/assign_to_matcher_test.rb -- test/matchers/controller/filter_param_matcher_test.rb -- test/matchers/controller/render_with_layout_matcher_test.rb -- test/matchers/controller/respond_with_content_type_matcher_test.rb -- test/matchers/controller/respond_with_matcher_test.rb -- test/matchers/controller/route_matcher_test.rb -- test/matchers/controller/set_session_matcher_test.rb -- test/matchers/controller/set_the_flash_matcher.rb -- test/model_builder.rb -- test/other -- test/other/autoload_macro_test.rb -- test/other/context_test.rb -- test/other/convert_to_should_syntax_test.rb -- test/other/helpers_test.rb -- test/other/private_helpers_test.rb -- test/other/should_test.rb -- test/rails_root -- test/rails_root/app -- test/rails_root/app/controllers -- test/rails_root/app/controllers/application.rb -- test/rails_root/app/controllers/posts_controller.rb -- test/rails_root/app/controllers/users_controller.rb -- test/rails_root/app/helpers -- test/rails_root/app/helpers/application_helper.rb -- test/rails_root/app/helpers/posts_helper.rb -- test/rails_root/app/helpers/users_helper.rb -- test/rails_root/app/models -- test/rails_root/app/models/address.rb -- test/rails_root/app/models/flea.rb -- test/rails_root/app/models/friendship.rb -- test/rails_root/app/models/pets -- test/rails_root/app/models/pets/dog.rb -- test/rails_root/app/models/post.rb -- test/rails_root/app/models/product.rb -- test/rails_root/app/models/tag.rb -- test/rails_root/app/models/tagging.rb -- test/rails_root/app/models/treat.rb -- test/rails_root/app/models/user.rb -- test/rails_root/app/views -- test/rails_root/app/views/layouts -- test/rails_root/app/views/layouts/posts.rhtml -- test/rails_root/app/views/layouts/users.rhtml -- test/rails_root/app/views/layouts/wide.html.erb -- test/rails_root/app/views/posts -- test/rails_root/app/views/posts/edit.rhtml -- test/rails_root/app/views/posts/index.rhtml -- test/rails_root/app/views/posts/new.rhtml -- test/rails_root/app/views/posts/show.rhtml -- test/rails_root/app/views/users -- test/rails_root/app/views/users/edit.rhtml -- test/rails_root/app/views/users/index.rhtml -- test/rails_root/app/views/users/new.rhtml -- test/rails_root/app/views/users/show.rhtml -- test/rails_root/config -- test/rails_root/config/boot.rb -- test/rails_root/config/database.yml -- test/rails_root/config/environment.rb -- test/rails_root/config/environments -- test/rails_root/config/environments/test.rb -- test/rails_root/config/initializers -- test/rails_root/config/initializers/new_rails_defaults.rb -- test/rails_root/config/initializers/shoulda.rb -- test/rails_root/config/routes.rb -- test/rails_root/db -- test/rails_root/db/migrate -- test/rails_root/db/migrate/001_create_users.rb -- test/rails_root/db/migrate/002_create_posts.rb -- test/rails_root/db/migrate/003_create_taggings.rb -- test/rails_root/db/migrate/004_create_tags.rb -- test/rails_root/db/migrate/005_create_dogs.rb -- test/rails_root/db/migrate/006_create_addresses.rb -- test/rails_root/db/migrate/007_create_fleas.rb -- test/rails_root/db/migrate/008_create_dogs_fleas.rb -- test/rails_root/db/migrate/009_create_products.rb -- test/rails_root/db/migrate/010_create_friendships.rb -- test/rails_root/db/migrate/011_create_treats.rb -- test/rails_root/db/schema.rb -- test/rails_root/log -- test/rails_root/log/sqlite3.log -- test/rails_root/log/test.log -- test/rails_root/public -- test/rails_root/public/404.html -- test/rails_root/public/422.html -- test/rails_root/public/500.html -- test/rails_root/script -- test/rails_root/script/console -- test/rails_root/script/generate -- test/rails_root/test -- test/rails_root/test/shoulda_macros -- test/rails_root/test/shoulda_macros/custom_macro.rb -- test/rails_root/vendor -- test/rails_root/vendor/gems -- test/rails_root/vendor/gems/gem_with_macro-0.0.1 -- test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros -- test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb -- test/rails_root/vendor/plugins -- test/rails_root/vendor/plugins/plugin_with_macro -- test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros -- test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb -- test/README -- test/rspec_test.rb -- test/test_helper.rb -- test/unit -- test/unit/address_test.rb -- test/unit/dog_test.rb -- test/unit/flea_test.rb -- test/unit/friendship_test.rb -- test/unit/post_test.rb -- test/unit/product_test.rb -- test/unit/tag_test.rb -- test/unit/tagging_test.rb -- test/unit/user_test.rb -has_rdoc: true -homepage: http://thoughtbot.com/projects/shoulda -post_install_message: -rdoc_options: -- --line-numbers -- --main -- README.rdoc -require_paths: -- lib -required_ruby_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: -required_rubygems_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: -requirements: [] - -rubyforge_project: shoulda -rubygems_version: 1.3.1 -signing_key: -specification_version: 2 -summary: Making tests easy on the fingers and eyes -test_files: [] - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/CONTRIBUTION_GUIDELINES.rdoc b/vendor/gems/thoughtbot-shoulda-2.10.1/CONTRIBUTION_GUIDELINES.rdoc deleted file mode 100644 index ac1794f..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/CONTRIBUTION_GUIDELINES.rdoc +++ /dev/null @@ -1,12 +0,0 @@ -We're using GitHub[http://github.com/thoughtbot/shoulda/tree/master] and Lighthouse[http://thoughtbot.lighthouseapp.com/projects/5807], and we've been getting any combination of github pull requests, Lighthouse tickets, patches, emails, etc. We need to normalize this workflow to make sure we don't miss any fixes. - -* Make sure you're accessing the source from the {official repository}[http://github.com/thoughtbot/shoulda/tree/master]. -* We prefer git branches over patches, but we can take either. -* If you're using git, please make a branch for each separate contribution. We can cherry pick your commits, but pulling from a branch is easier. -* If you're submitting patches, please cut each fix or feature into a separate patch. -* There should be a Lighthouse[http://thoughtbot.lighthouseapp.com/projects/5807] ticket for any submission. If you've found a bug and want to fix it, open a new ticket at the same time. -* We've got github/lighthouse integration going, so you can update tickets when you commit. {This blog post}[http://hoth.entp.com/2008/4/11/github-and-lighthouse-sitting-in-a-tree] explains the commit options pretty well. -* Please don't send pull requests Just update the lighthouse ticket with the url for your fix (or attach the patch) when it's ready. The github pull requests pretty much get dropped on the floor until someone with commit rights notices them in the mailbox. -* Contributions without tests won't be accepted. The file /test/README explains the testing system pretty thoroughly. - - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/MIT-LICENSE b/vendor/gems/thoughtbot-shoulda-2.10.1/MIT-LICENSE deleted file mode 100644 index f8e9154..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/MIT-LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/README.rdoc b/vendor/gems/thoughtbot-shoulda-2.10.1/README.rdoc deleted file mode 100644 index 4c61ad4..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/README.rdoc +++ /dev/null @@ -1,169 +0,0 @@ -= Shoulda - Making tests easy on the fingers and eyes - -Shoulda makes it easy to write elegant, understandable, and maintainable tests. Shoulda consists of test macros, assertions, and helpers added on to the Test::Unit framework. It's fully compatible with your existing tests, and requires no retooling to use. - -Helpers:: #context and #should give you RSpec like test blocks. - In addition, you get nested contexts and a much more readable syntax. -Macros:: Generate hundreds of lines of Controller and ActiveRecord tests with these powerful macros. - They get you started quickly, and can help you ensure that your application is conforming to best practices. -Assertions:: Many common rails testing idioms have been distilled into a set of useful assertions. -Matchers:: Rspec-compatible matchers providing the same tests as Shoulda macros. - -= Usage - -=== Context Helpers (Shoulda::Context) - -Stop killing your fingers with all of those underscores... Name your tests with plain sentences! - - class UserTest < Test::Unit::TestCase - context "A User instance" do - setup do - @user = User.find(:first) - end - - should "return its full name" do - assert_equal 'John Doe', @user.full_name - end - - context "with a profile" do - setup do - @user.profile = Profile.find(:first) - end - - should "return true when sent #has_profile?" do - assert @user.has_profile? - end - end - end - end - -Produces the following test methods: - - "test: A User instance should return its full name." - "test: A User instance with a profile should return true when sent #has_profile?." - -So readable! - -=== ActiveRecord Tests (Shoulda::ActiveRecord::Macros) - -Quick macro tests for your ActiveRecord associations and validations: - - class PostTest < Test::Unit::TestCase - fixtures :all - - should_belong_to :user - should_have_many :tags, :through => :taggings - - should_validate_uniqueness_of :title - should_validate_presence_of :body, :message => /wtf/ - should_validate_presence_of :title - should_validate_numericality_of :user_id - end - - class UserTest < Test::Unit::TestCase - should_have_many :posts - - should_not_allow_values_for :email, "blah", "b lah" - should_allow_values_for :email, "a@b.com", "asdf@asdf.com" - should_ensure_length_in_range :email, 1..100 - should_ensure_value_in_range :age, 1..100 - should_not_allow_mass_assignment_of :password - end - -Makes TDD so much easier. - -=== Controller Tests (Shoulda::Controller::Macros) - -Macros to test the most common controller patterns... - - context "on GET to :show for first record" do - setup do - get :show, :id => 1 - end - - should_assign_to :user - should_respond_with :success - should_render_template :show - should_not_set_the_flash - - should "do something else really cool" do - assert_equal 1, assigns(:user).id - end - end - -=== Helpful Assertions (Shoulda::Assertions) - -More to come here, but have fun with what's there. - - assert_same_elements([:a, :b, :c], [:c, :a, :b]) - assert_contains(['a', '1'], /\d/) - assert_contains(['a', '1'], 'a') - -=== 3rd Party and Application Specific Macros - -Any *.rb file under RAILS_ROOT/test/shoulda_macros/ or vendor/(plugins|gems)/gem_name/shoulda_macros/ will be automatically required when you run your tests. This allows you to distribute macros with your plugins, or to organize the macros inside your application. Remember to add your macro to Test::Unit::TestCase in the macro file: - - # test/shoulda_macros/security.rb - class Test::Unit::TestCase - def self.should_be_denied(opts = {}) - should_set_the_flash_to(opts[:flash] || /Please log in/i) - should_redirect_to(opts[:redirect] || 'login_url') - end - end - -= Rails Installation (Test::Unit) - -=== As a Gem - -Use this if you prefer to use versioned releases of shoulda. Specify the gem dependency in your config/environment.rb file: - - Rails::Initializer.run do |config| - config.gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com" - end - -Then: - - $ rake gems:install - $ rake gems:unpack - -=== As a Plugin - -Use this if you prefer to use the edge version of shoulda: - - $ script/plugin install git://github.com/thoughtbot/shoulda.git - -=== As a Plugin (using git submodules) - -Use this if you prefer the idea of being able to easily switch between using edge or a tagged version of shoulda: - - $ git submodule add git://github.com/thoughtbot/shoulda.git vendor/plugins/shoulda - -= Rails Installation (RSpec) - -If you're using Shoulda with RSpec, we recommend that you add config.gem lines -for RSpec and Shoulda in your config/environment/test.rb file, but do not ask -Rails to load the RSpec and Shoulda libraries: - - config.gem 'rspec', :lib => false - config.gem 'rspec-rails', :lib => false - config.gem 'thoughtbot-shoulda', - :lib => false, - :source => 'http://gems.github.com' - -Then require shoulda from your spec/spec_helper.rb file, before Spec::Runner is -configured: - - # requires for RSpec - require 'shoulda' - Spec::Runner.configure do |config| - # ... - -You should not need to require anything besides the top-level shoulda library. - -= Credits - -Shoulda is maintained by {Tammer Saleh}[mailto:tsaleh@thoughtbot.com], and is funded by Thoughtbot[http://www.thoughtbot.com], inc. - -= License - -Shoulda is Copyright © 2006-2008 Tammer Saleh, Thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file. diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/Rakefile b/vendor/gems/thoughtbot-shoulda-2.10.1/Rakefile deleted file mode 100644 index 7c04641..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/Rakefile +++ /dev/null @@ -1,72 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' -require 'rake/gempackagetask' - -$LOAD_PATH.unshift("lib") -require 'shoulda' -load 'tasks/shoulda.rake' - -# Test::Unit::UI::VERBOSE -test_files_pattern = 'test/{unit,functional,other,matchers}/**/*_test.rb' -Rake::TestTask.new do |t| - t.libs << 'lib' - t.pattern = test_files_pattern - t.verbose = false -end - -Rake::RDocTask.new { |rdoc| - rdoc.rdoc_dir = 'doc' - rdoc.title = "Shoulda -- Making tests easy on the fingers and eyes" - rdoc.options << '--line-numbers' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] - rdoc.rdoc_files.include('README.rdoc', 'CONTRIBUTION_GUIDELINES.rdoc', 'lib/**/*.rb') -} - -desc "Run code-coverage analysis using rcov" -task :coverage do - rm_rf "coverage" - files = Dir[test_files_pattern] - system "rcov --rails --sort coverage -Ilib #{files.join(' ')}" -end - -desc 'Update documentation on website' -task :sync_docs => 'rdoc' do - `rsync -ave ssh doc/ dev@dev.thoughtbot.com:/home/dev/www/dev.thoughtbot.com/shoulda` -end - -desc 'Default: run tests.' -task :default => ['test'] - -spec = Gem::Specification.new do |s| - s.name = "shoulda" - s.version = Shoulda::VERSION - s.summary = "Making tests easy on the fingers and eyes" - s.homepage = "http://thoughtbot.com/projects/shoulda" - s.rubyforge_project = "shoulda" - - s.files = FileList["[A-Z]*", "{bin,lib,rails,test}/**/*"] - s.executables = s.files.grep(/^bin/) { |f| File.basename(f) } - - s.has_rdoc = true - s.extra_rdoc_files = ["README.rdoc", "CONTRIBUTION_GUIDELINES.rdoc"] - s.rdoc_options = ["--line-numbers", "--main", "README.rdoc"] - - s.authors = ["Tammer Saleh"] - s.email = "tsaleh@thoughtbot.com" -end - -Rake::GemPackageTask.new spec do |pkg| - pkg.need_tar = true - pkg.need_zip = true -end - -desc "Clean files generated by rake tasks" -task :clobber => [:clobber_rdoc, :clobber_package] - -desc "Generate a gemspec file for GitHub" -task :gemspec do - File.open("#{spec.name}.gemspec", 'w') do |f| - f.write spec.to_ruby - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/bin/convert_to_should_syntax b/vendor/gems/thoughtbot-shoulda-2.10.1/bin/convert_to_should_syntax deleted file mode 100755 index d1264d0..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/bin/convert_to_should_syntax +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env ruby -require 'fileutils' -require 'tmpdir' - -TMP = Dir::tmpdir - -def usage(msg = nil) - puts "Error: #{msg}" if msg - puts if msg - puts "Usage: #{File.basename(__FILE__)} normal_test_file.rb" - puts - puts "Will convert an existing test file with names like " - puts - puts " def test_should_do_stuff" - puts " ..." - puts " end" - puts - puts "to one using the new syntax: " - puts - puts " should \"be super cool\" do" - puts " ..." - puts " end" - puts - puts "A copy of the old file will be left under #{TMP} in case\nthis script just seriously screws up" - puts - exit (msg ? 2 : 0) -end - -usage("Wrong number of arguments.") unless ARGV.size == 1 -usage("Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to a writeable directory.") unless File.directory?(TMP) && File.writable?(TMP) - -file = ARGV.shift -tmpfile = File.join(TMP, File.basename(file)) -usage("File '#{file}' doesn't exist") unless File.exists?(file) - -FileUtils.cp(file, tmpfile) -contents = File.read(tmpfile) -contents.gsub!(/def test_should_(\S+)/) {|line| "should \"#{$1.tr('_', ' ')}\" do"} -contents.gsub!(/def test_(\S+)/) {|line| "should \"RENAME ME: test #{$1.tr('_', ' ')}\" do"} -File.open(file, 'w') { |f| f.write(contents) } - -puts "File '#{file}' has been converted to 'should' syntax. Old version has been stored in '#{tmpfile}'" diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda.rb deleted file mode 100644 index 4b46206..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Shoulda - VERSION = "2.10.1" -end - -if defined? Spec - require 'shoulda/rspec' -else - require 'shoulda/test_unit' -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller.rb deleted file mode 100644 index 9e33356..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'shoulda' -require 'shoulda/action_controller/helpers' -require 'shoulda/action_controller/matchers' -require 'shoulda/action_controller/macros' -require 'shoulda/action_controller/resource_options' - -module Test # :nodoc: all - module Unit - class TestCase - include Shoulda::ActionController::Matchers - include Shoulda::ActionController::Helpers - extend Shoulda::ActionController::Macros - Shoulda::ActionController::VALID_FORMATS.each do |format| - include "Shoulda::ActionController::#{format.to_s.upcase}".constantize - end - end - end -end - -require 'shoulda/active_record/assertions' -require 'shoulda/action_mailer/assertions' - -module ActionController #:nodoc: all - module Integration - class Session - include Shoulda::Assertions - include Shoulda::Helpers - include Shoulda::ActiveRecord::Assertions - include Shoulda::ActionMailer::Assertions - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/html.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/html.rb deleted file mode 100644 index e3f67df..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/html.rb +++ /dev/null @@ -1,199 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module HTML # :nodoc: all - def self.included(other) - other.class_eval do - extend Shoulda::ActionController::HTML::ClassMethods - end - end - - module ClassMethods - def controller_name_from_class - self.name.gsub(/Test/, '') - end - - def make_show_html_tests(res) - context "on GET to #{controller_name_from_class}#show" do - setup do - record = get_existing_record(res) - parent_params = make_parent_params(res, record) - get :show, parent_params.merge({ res.identifier => record.to_param }) - end - - if res.denied.actions.include?(:show) - should_not_assign_to res.object - should_redirect_to res.denied.redirect - should_set_the_flash_to res.denied.flash - else - should_assign_to res.object - should_respond_with :success - should_render_template :show - should_not_set_the_flash - end - end - end - - def make_edit_html_tests(res) - context "on GET to #{controller_name_from_class}#edit" do - setup do - @record = get_existing_record(res) - parent_params = make_parent_params(res, @record) - get :edit, parent_params.merge({ res.identifier => @record.to_param }) - end - - if res.denied.actions.include?(:edit) - should_not_assign_to res.object - should_redirect_to res.denied.redirect - should_set_the_flash_to res.denied.flash - else - should_assign_to res.object - should_respond_with :success - should_render_template :edit - should_not_set_the_flash - should_render_a_form - should "set @#{res.object} to requested instance" do - assert_equal @record, assigns(res.object) - end - end - end - end - - def make_index_html_tests(res) - context "on GET to #{controller_name_from_class}#index" do - setup do - record = get_existing_record(res) rescue nil - parent_params = make_parent_params(res, record) - get(:index, parent_params) - end - - if res.denied.actions.include?(:index) - should_not_assign_to res.object.to_s.pluralize - should_redirect_to res.denied.redirect - should_set_the_flash_to res.denied.flash - else - should_respond_with :success - should_assign_to res.object.to_s.pluralize - should_render_template :index - should_not_set_the_flash - end - end - end - - def make_new_html_tests(res) - context "on GET to #{controller_name_from_class}#new" do - setup do - record = get_existing_record(res) rescue nil - parent_params = make_parent_params(res, record) - get(:new, parent_params) - end - - if res.denied.actions.include?(:new) - should_not_assign_to res.object - should_redirect_to res.denied.redirect - should_set_the_flash_to res.denied.flash - else - should_respond_with :success - should_assign_to res.object - should_not_set_the_flash - should_render_template :new - should_render_a_form - end - end - end - - def make_destroy_html_tests(res) - context "on DELETE to #{controller_name_from_class}#destroy" do - setup do - @record = get_existing_record(res) - parent_params = make_parent_params(res, @record) - delete :destroy, parent_params.merge({ res.identifier => @record.to_param }) - end - - if res.denied.actions.include?(:destroy) - should_redirect_to res.denied.redirect - should_set_the_flash_to res.denied.flash - - should "not destroy record" do - assert_nothing_raised { assert @record.reload } - end - else - should_set_the_flash_to res.destroy.flash - if res.destroy.redirect.is_a? Symbol - should_respond_with res.destroy.redirect - else - should_redirect_to res.destroy.redirect - end - - should "destroy record" do - assert_raises(::ActiveRecord::RecordNotFound, "@#{res.object} was not destroyed.") do - @record.reload - end - end - end - end - end - - def make_create_html_tests(res) - context "on POST to #{controller_name_from_class}#create with #{res.create.params.inspect}" do - setup do - record = get_existing_record(res) rescue nil - parent_params = make_parent_params(res, record) - @count = res.klass.count - post :create, parent_params.merge(res.object => res.create.params) - end - - if res.denied.actions.include?(:create) - should_redirect_to res.denied.redirect - should_set_the_flash_to res.denied.flash - should_not_assign_to res.object - - should "not create new record" do - assert_equal @count, res.klass.count - end - else - should_assign_to res.object - should_set_the_flash_to res.create.flash - if res.create.redirect.is_a? Symbol - should_respond_with res.create.redirect - else - should_redirect_to res.create.redirect - end - - should "not have errors on @#{res.object}" do - assert_equal [], pretty_error_messages(assigns(res.object)), "@#{res.object} has errors:" - end - end - end - end - - def make_update_html_tests(res) - context "on PUT to #{controller_name_from_class}#update with #{res.create.params.inspect}" do - setup do - @record = get_existing_record(res) - parent_params = make_parent_params(res, @record) - put :update, parent_params.merge(res.identifier => @record.to_param, res.object => res.update.params) - end - - if res.denied.actions.include?(:update) - should_not_assign_to res.object - should_redirect_to res.denied.redirect - should_set_the_flash_to res.denied.flash - else - should_assign_to res.object - should_set_the_flash_to(res.update.flash) - if res.update.redirect.is_a? Symbol - should_respond_with res.update.redirect - else - should_redirect_to res.update.redirect - end - - should "not have errors on @#{res.object}" do - assert_equal [], pretty_error_messages(assigns(res.object)), "@#{res.object} has errors:" - end - end - end - end - end - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/xml.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/xml.rb deleted file mode 100644 index 25b45ca..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/xml.rb +++ /dev/null @@ -1,168 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module XML - def self.included(other) #:nodoc: - other.class_eval do - extend Shoulda::ActionController::XML::ClassMethods - end - end - - module ClassMethods - # Macro that creates a test asserting that the controller responded with an XML content-type - # and that the XML contains ++ as the root element. - def should_respond_with_xml_for(name = nil) - should "have ContentType set to 'application/xml'" do - assert_xml_response - end - - if name - should "return <#{name}/> as the root element" do - body = @response.body.first(100).map {|l| " #{l}"} - assert_select name.to_s.dasherize, 1, "Body:\n#{body}...\nDoes not have <#{name}/> as the root element." - end - end - end - alias should_respond_with_xml should_respond_with_xml_for - - protected - - def make_show_xml_tests(res) # :nodoc: - context "on GET to #{controller_name_from_class}#show as xml" do - setup do - request_xml - record = get_existing_record(res) - parent_params = make_parent_params(res, record) - get :show, parent_params.merge({ res.identifier => record.to_param }) - end - - if res.denied.actions.include?(:show) - should_not_assign_to res.object - should_respond_with 401 - else - should_assign_to res.object - should_respond_with :success - should_respond_with_xml_for res.object - end - end - end - - def make_edit_xml_tests(res) # :nodoc: - # XML doesn't need an :edit action - end - - def make_new_xml_tests(res) # :nodoc: - # XML doesn't need a :new action - end - - def make_index_xml_tests(res) # :nodoc: - context "on GET to #{controller_name_from_class}#index as xml" do - setup do - request_xml - parent_params = make_parent_params(res) - get(:index, parent_params) - end - - if res.denied.actions.include?(:index) - should_not_assign_to res.object.to_s.pluralize - should_respond_with 401 - else - should_respond_with :success - should_respond_with_xml_for res.object.to_s.pluralize - should_assign_to res.object.to_s.pluralize - end - end - end - - def make_destroy_xml_tests(res) # :nodoc: - context "on DELETE to #{controller_name_from_class}#destroy as xml" do - setup do - request_xml - @record = get_existing_record(res) - parent_params = make_parent_params(res, @record) - delete :destroy, parent_params.merge({ res.identifier => @record.to_param }) - end - - if res.denied.actions.include?(:destroy) - should_respond_with 401 - - should "not destroy record" do - assert @record.reload - end - else - should "destroy record" do - assert_raises(::ActiveRecord::RecordNotFound, "@#{res.object} was not destroyed.") do - @record.reload - end - end - end - end - end - - def make_create_xml_tests(res) # :nodoc: - context "on POST to #{controller_name_from_class}#create as xml" do - setup do - request_xml - parent_params = make_parent_params(res) - @count = res.klass.count - post :create, parent_params.merge(res.object => res.create.params) - end - - if res.denied.actions.include?(:create) - should_respond_with 401 - should_not_assign_to res.object - - should "not create new record" do - assert_equal @count, res.klass.count - end - else - should_assign_to res.object - - should "not have errors on @#{res.object}" do - assert_equal [], pretty_error_messages(assigns(res.object)), "@#{res.object} has errors:" - end - end - end - end - - def make_update_xml_tests(res) # :nodoc: - context "on PUT to #{controller_name_from_class}#update as xml" do - setup do - request_xml - @record = get_existing_record(res) - parent_params = make_parent_params(res, @record) - put :update, parent_params.merge(res.identifier => @record.to_param, res.object => res.update.params) - end - - if res.denied.actions.include?(:update) - should_not_assign_to res.object - should_respond_with 401 - else - should_assign_to res.object - - should "not have errors on @#{res.object}" do - assert_equal [], assigns(res.object).errors.full_messages, "@#{res.object} has errors:" - end - end - end - end - end - - # Sets the next request's format to 'application/xml' - def request_xml - @request.accept = "application/xml" - end - - # Asserts that the controller's response was 'application/xml' - def assert_xml_response - content_type = (@response.headers["Content-Type"] || @response.headers["type"]).to_s - regex = %r{\bapplication/xml\b} - - msg = "Content Type '#{content_type.inspect}' doesn't match '#{regex.inspect}'\n" - msg += "Body: #{@response.body.first(100).chomp} ..." - - assert_match regex, content_type, msg - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/helpers.rb deleted file mode 100644 index 4b0b341..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/helpers.rb +++ /dev/null @@ -1,64 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Helpers # :nodoc: - private # :enddoc: - - SPECIAL_INSTANCE_VARIABLES = %w{ - _cookies - _flash - _headers - _params - _request - _response - _session - action_name - before_filter_chain_aborted - cookies - flash - headers - ignore_missing_templates - logger - params - request - request_origin - response - session - template - template_class - template_root - url - variables_added - }.map(&:to_s) - - def instantiate_variables_from_assigns(*names, &blk) - old = {} - names = (@response.template.assigns.keys - SPECIAL_INSTANCE_VARIABLES) if names.empty? - names.each do |name| - old[name] = instance_variable_get("@#{name}") - instance_variable_set("@#{name}", assigns(name.to_sym)) - end - blk.call - names.each do |name| - instance_variable_set("@#{name}", old[name]) - end - end - - def get_existing_record(res) # :nodoc: - returning(instance_variable_get("@#{res.object}")) do |record| - assert(record, "This test requires you to set @#{res.object} in your setup block") - end - end - - def make_parent_params(resource, record = nil, parent_names = nil) # :nodoc: - parent_names ||= resource.parents.reverse - return {} if parent_names == [] # Base case - parent_name = parent_names.shift - parent = record ? record.send(parent_name) : parent_name.to_s.classify.constantize.find(:first) - - { :"#{parent_name}_id" => parent.to_param }.merge(make_parent_params(resource, parent, parent_names)) - end - - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/macros.rb deleted file mode 100644 index 9c02694..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/macros.rb +++ /dev/null @@ -1,296 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - # = Macro test helpers for your controllers - # - # By using the macro helpers you can quickly and easily create concise and easy to read test suites. - # - # This code segment: - # context "on GET to :show for first record" do - # setup do - # get :show, :id => 1 - # end - # - # should_assign_to :user - # should_respond_with :success - # should_render_template :show - # should_not_set_the_flash - # - # should "do something else really cool" do - # assert_equal 1, assigns(:user).id - # end - # end - # - # Would produce 5 tests for the +show+ action - module Macros - include Matchers - - def should_be_restful(&blk) # :yields: resource - resource = ResourceOptions.new - blk.call(resource) - resource.normalize!(self) - - resource.formats.each do |format| - resource.actions.each do |action| - if self.respond_to? :"make_#{action}_#{format}_tests" - self.send(:"make_#{action}_#{format}_tests", resource) - else - should "test #{action} #{format}" do - flunk "Test for #{action} as #{format} not implemented" - end - end - end - end - end - - # Macro that creates a test asserting that the flash contains the given value. - # val can be a String, a Regex, or nil (indicating that the flash should not be set) - # - # Example: - # - # should_set_the_flash_to "Thank you for placing this order." - # should_set_the_flash_to /created/i - # should_set_the_flash_to nil - def should_set_the_flash_to(val) - matcher = set_the_flash.to(val) - if val - should matcher.description do - assert_accepts matcher, @controller - end - else - should "not #{matcher.description}" do - assert_rejects matcher, @controller - end - end - end - - # Macro that creates a test asserting that the flash is empty. Same as - # @should_set_the_flash_to nil@ - def should_not_set_the_flash - should_set_the_flash_to nil - end - - # Macro that creates a test asserting that filter_parameter_logging - # - # is set for the specified keys - # - # Example: - # - # should_filter_params :password, :ssn - def should_filter_params(*keys) - keys.each do |key| - matcher = filter_param(key) - should matcher.description do - assert_accepts matcher, @controller - end - end - end - - # Macro that creates a test asserting that the controller assigned to - # each of the named instance variable(s). - # - # Options: - # * :class - The expected class of the instance variable being checked. - # * :equals - A string which is evaluated and compared for equality with - # the instance variable being checked. - # - # Example: - # - # should_assign_to :user, :posts - # should_assign_to :user, :class => User - # should_assign_to(:user) { @user } - def should_assign_to(*names, &block) - opts = names.extract_options! - if opts[:equals] - warn "[DEPRECATION] should_assign_to :var, :equals => 'val' " << - "is deprecated. Use should_assign_to(:var) { 'val' } instead." - end - names.each do |name| - matcher = assign_to(name).with_kind_of(opts[:class]) - test_name = matcher.description - test_name << " which is equal to #{opts[:equals]}" if opts[:equals] - should test_name do - if opts[:equals] - instantiate_variables_from_assigns do - expected_value = eval(opts[:equals], - self.send(:binding), - __FILE__, - __LINE__) - matcher = matcher.with(expected_value) - end - elsif block - expected_value = instance_eval(&block) - matcher = matcher.with(expected_value) - end - - assert_accepts matcher, @controller - end - end - end - - # Macro that creates a test asserting that the controller did not assign to - # any of the named instance variable(s). - # - # Example: - # - # should_not_assign_to :user, :posts - def should_not_assign_to(*names) - names.each do |name| - matcher = assign_to(name) - should "not #{matcher.description}" do - assert_rejects matcher, @controller - end - end - end - - # Macro that creates a test asserting that the controller responded with a 'response' status code. - # Example: - # - # should_respond_with :success - def should_respond_with(response) - should "respond with #{response}" do - matcher = respond_with(response) - assert_accepts matcher, @controller - end - end - - # Macro that creates a test asserting that the response content type was 'content_type'. - # Example: - # - # should_respond_with_content_type 'application/rss+xml' - # should_respond_with_content_type :rss - # should_respond_with_content_type /rss/ - def should_respond_with_content_type(content_type) - should "respond with content type of #{content_type}" do - matcher = respond_with_content_type(content_type) - assert_accepts matcher, @controller - end - end - - # Macro that creates a test asserting that a value returned from the session is correct. - # The given string is evaled to produce the resulting redirect path. All of the instance variables - # set by the controller are available to the evaled string. - # Example: - # - # should_set_session(:user_id) { '@user.id' } - # should_set_session(:message) { "Free stuff" } - def should_set_session(key, expected = nil, &block) - matcher = set_session(key) - if expected - warn "[DEPRECATION] should_set_session :key, 'val' is deprecated. " << - "Use should_set_session(:key) { 'val' } instead." - end - should matcher.description do - if expected - instantiate_variables_from_assigns do - expected_value = eval(expected, - self.send(:binding), - __FILE__, - __LINE__) - matcher = matcher.to(expected_value) - end - else - expected_value = instance_eval(&block) - matcher = matcher.to(expected_value) - end - assert_accepts matcher, @controller - end - end - - # Deprecated. See should_set_session - def should_return_from_session(key, expected) - warn "[DEPRECATION] should_require_attributes is deprecated. " << - "Use should_set_session instead." - should_set_session(key, expected) - end - - # Macro that creates a test asserting that the controller rendered the given template. - # Example: - # - # should_render_template :new - def should_render_template(template) - should "render template #{template.inspect}" do - assert_template template.to_s - end - end - - # Macro that creates a test asserting that the controller rendered with the given layout. - # Example: - # - # should_render_with_layout 'special' - def should_render_with_layout(expected_layout = 'application') - matcher = render_with_layout(expected_layout) - if expected_layout - should matcher.description do - assert_accepts matcher, @controller - end - else - should "render without layout" do - assert_rejects matcher, @controller - end - end - end - - # Macro that creates a test asserting that the controller rendered without a layout. - # Same as @should_render_with_layout false@ - def should_render_without_layout - should_render_with_layout nil - end - - # Macro that creates a test asserting that the controller returned a redirect to the given path. - # The given string is evaled to produce the resulting redirect path. All of the instance variables - # set by the controller are available to the evaled string. - # Example: - # - # should_redirect_to("the user's profile") { user_url(@user) } - def should_redirect_to(description, &block) - unless block - warn "[DEPRECATION] should_redirect_to without a block is " << - "deprecated. Use should_redirect_to('somewhere') { } instead." - end - should "redirect to #{description}" do - if block - url = instance_eval(&block) - else - instantiate_variables_from_assigns do - url = eval(description, self.send(:binding), __FILE__, __LINE__) - end - end - assert_redirected_to url - end - end - - # Macro that creates a routing test. It tries to use the given HTTP - # +method+ on the given +path+, and asserts that it routes to the - # given +options+. - # - # If you don't specify a :controller, it will try to guess the controller - # based on the current test. - # - # +to_param+ is called on the +options+ given. - # - # Examples: - # - # should_route :get, "/posts", :controller => :posts, :action => :index - # should_route :get, "/posts/new", :action => :new - # should_route :post, "/posts", :action => :create - # should_route :get, "/posts/1", :action => :show, :id => 1 - # should_route :edit, "/posts/1", :action => :show, :id => 1 - # should_route :put, "/posts/1", :action => :update, :id => 1 - # should_route :delete, "/posts/1", :action => :destroy, :id => 1 - # should_route :get, "/users/1/posts/1", - # :action => :show, :id => 1, :user_id => 1 - # - def should_route(method, path, options) - unless options[:controller] - options[:controller] = self.name.gsub(/ControllerTest$/, '').tableize - end - - matcher = route(method, path).to(options) - - should matcher.description do - assert_accepts matcher.in_context(self), self - end - end - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers.rb deleted file mode 100644 index c12f729..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'shoulda/action_controller/matchers/assign_to_matcher' -require 'shoulda/action_controller/matchers/filter_param_matcher' -require 'shoulda/action_controller/matchers/set_the_flash_matcher' -require 'shoulda/action_controller/matchers/render_with_layout_matcher' -require 'shoulda/action_controller/matchers/respond_with_matcher' -require 'shoulda/action_controller/matchers/respond_with_content_type_matcher' -require 'shoulda/action_controller/matchers/set_session_matcher' -require 'shoulda/action_controller/matchers/route_matcher' - -module Shoulda # :nodoc: - module ActionController # :nodoc: - - # By using the macro helpers you can quickly and easily create concise and - # easy to read test suites. - # - # This code segment: - # - # describe UsersController, "on GET to show with a valid id" do - # before(:each) do - # get :show, :id => User.first.to_param - # end - # - # it { should assign_to(:user) } - # it { should respond_with(:success) } - # it { should render_template(:show) } - # it { should not_set_the_flash) } - # - # it "should do something else really cool" do - # assigns[:user].id.should == 1 - # end - # end - # - # Would produce 5 tests for the show action - module Matchers - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/assign_to_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/assign_to_matcher.rb deleted file mode 100644 index dde864b..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/assign_to_matcher.rb +++ /dev/null @@ -1,109 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures that the controller assigned to the named instance variable. - # - # Options: - # * with_kind_of - The expected class of the instance variable - # being checked. - # * with - The value that should be assigned. - # - # Example: - # - # it { should assign_to(:user) } - # it { should_not assign_to(:user) } - # it { should assign_to(:user).with_kind_of(User) } - # it { should assign_to(:user).with(@user) } - def assign_to(variable) - AssignToMatcher.new(variable) - end - - class AssignToMatcher # :nodoc: - - def initialize(variable) - @variable = variable.to_s - end - - def with_kind_of(expected_class) - @expected_class = expected_class - self - end - - def with(expected_value) - @expected_value = expected_value - self - end - - def matches?(controller) - @controller = controller - assigned_value? && kind_of_expected_class? && equal_to_expected_value? - end - - attr_reader :failure_message, :negative_failure_message - - def description - description = "assign @#{@variable}" - description << " with a kind of #{@expected_class}" if @expected_class - description - end - - private - - def assigned_value? - if assigned_value.nil? - @failure_message = - "Expected action to assign a value for @#{@variable}" - false - else - @negative_failure_message = - "Didn't expect action to assign a value for @#{@variable}, " << - "but it was assigned to #{assigned_value.inspect}" - true - end - end - - def kind_of_expected_class? - return true unless @expected_class - if assigned_value.kind_of?(@expected_class) - @negative_failure_message = - "Didn't expect action to assign a kind of #{@expected_class} " << - "for #{@variable}, but got one anyway" - true - else - @failure_message = - "Expected action to assign a kind of #{@expected_class} " << - "for #{@variable}, but got #{@variable.inspect} " << - "(#{@variable.class.name})" - false - end - end - - def equal_to_expected_value? - return true unless @expected_value - if @expected_value == assigned_value - @negative_failure_message = - "Didn't expect action to assign #{@expected_value.inspect} " << - "for #{@variable}, but got it anyway" - true - else - @failure_message = - "Expected action to assign #{@expected_value.inspect} " << - "for #{@variable}, but got #{assigned_value.inspect}" - false - end - end - - def assigned_value - assigns[@variable] - end - - def assigns - @controller.response.template.assigns - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/filter_param_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/filter_param_matcher.rb deleted file mode 100644 index 1e46896..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/filter_param_matcher.rb +++ /dev/null @@ -1,57 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures that filter_parameter_logging is set for the specified key. - # - # Example: - # - # it { should filter_param(:password) } - def filter_param(key) - FilterParamMatcher.new(key) - end - - class FilterParamMatcher # :nodoc: - - def initialize(key) - @key = key.to_s - end - - def matches?(controller) - @controller = controller - filters_params? && filters_key? - end - - def failure_message - "Expected #{@key} to be filtered" - end - - def negative_failure_message - "Did not expect #{@key} to be filtered" - end - - def description - "filter #{@key}" - end - - private - - def filters_params? - @controller.respond_to?(:filter_parameters) - end - - def filters_key? - filtered_value == '[FILTERED]' - end - - def filtered_value - filtered = @controller.send(:filter_parameters, - @key.to_s => @key.to_s) - filtered[@key.to_s] - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb deleted file mode 100644 index 9ceb4e8..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb +++ /dev/null @@ -1,81 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures that the controller rendered with the given layout. - # - # Example: - # - # it { should render_with_layout } - # it { should render_with_layout(:special) } - # it { should_not render_with_layout } - def render_with_layout(layout = nil) - RenderWithLayout.new(layout) - end - - class RenderWithLayout # :nodoc: - - def initialize(layout) - @layout = layout.to_s unless layout.nil? - end - - def matches?(controller) - @controller = controller - rendered_with_layout? && rendered_with_expected_layout? - end - - def failure_message - "Expected #{expectation}, but #{result}" - end - - def negative_failure_message - "Did not expect #{expectation}, but #{result}" - end - - def description - description = "render with " - if @layout.nil? - description << "a layout" - else - description << "the #{@layout.inspect} layout" - end - description - end - - private - - def rendered_with_layout? - !layout.blank? - end - - def rendered_with_expected_layout? - return true if @layout.nil? - layout == @layout - end - - def layout - layout = @controller.response.layout - if layout.nil? - nil - else - layout.split('/').last - end - end - - def expectation - "to #{description}" - end - - def result - if rendered_with_layout? - "rendered with the #{layout.inspect} layout" - else - "rendered without a layout" - end - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb deleted file mode 100644 index c47dba3..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb +++ /dev/null @@ -1,70 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures a controller responded with expected 'response' content type. - # - # You can pass an explicit content type such as 'application/rss+xml' - # or its symbolic equivalent :rss - # or a regular expression such as /rss/ - # - # Example: - # - # it { should respond_with_content_type(:xml) } - # it { should respond_with_content_type(:csv) } - # it { should respond_with_content_type(:atom) } - # it { should respond_with_content_type(:yaml) } - # it { should respond_with_content_type(:text) } - # it { should respond_with_content_type('application/rss+xml') } - # it { should respond_with_content_type(/json/) } - def respond_with_content_type(content_type) - RespondWithContentTypeMatcher.new(content_type) - end - - class RespondWithContentTypeMatcher # :nodoc: - - def initialize(content_type) - @content_type = if content_type.is_a?(Symbol) - lookup_by_extension(content_type) - else - content_type - end - end - - def matches?(controller) - @controller = controller - if @content_type.is_a?(Regexp) - response_content_type =~ @content_type - else - response_content_type == @content_type - end - end - - def failure_message - "Expected #{expectation}" - end - - def negative_failure_message - "Did not expect #{expectation}" - end - - protected - - def response_content_type - @controller.response.content_type - end - - def lookup_by_extension(extension) - Mime::Type.lookup_by_extension(extension.to_s).to_s - end - - def expectation - "content type to be #{@content_type}, " << - "but was #{response_content_type}" - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_matcher.rb deleted file mode 100644 index 8c61384..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_matcher.rb +++ /dev/null @@ -1,81 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures a controller responded with expected 'response' status code. - # - # You can pass an explicit status number like 200, 301, 404, 500 - # or its symbolic equivalent :success, :redirect, :missing, :error. - # See ActionController::StatusCodes for a full list. - # - # Example: - # - # it { should respond_with(:success) } - # it { should respond_with(:redirect) } - # it { should respond_with(:missing) } - # it { should respond_with(:error) } - # it { should respond_with(501) } - def respond_with(status) - RespondWithMatcher.new(status) - end - - class RespondWithMatcher # :nodoc: - - def initialize(status) - @status = symbol_to_status_code(status) - end - - def matches?(controller) - @controller = controller - correct_status_code? || correct_status_code_range? - end - - def failure_message - "Expected #{expectation}" - end - - def negative_failure_message - "Did not expect #{expectation}" - end - - def description - "respond with #{@status}" - end - - protected - - def correct_status_code? - response_code == @status - end - - def correct_status_code_range? - @status.is_a?(Range) && - @status.include?(response_code) - end - - def response_code - @controller.response.response_code - end - - def symbol_to_status_code(potential_symbol) - case potential_symbol - when :success then 200 - when :redirect then 300..399 - when :missing then 404 - when :error then 500..599 - when Symbol - ::ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE[potential_symbol] - else - potential_symbol - end - end - - def expectation - "response to be a #{@status}, but was #{response_code}" - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/route_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/route_matcher.rb deleted file mode 100644 index fe8e2b6..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/route_matcher.rb +++ /dev/null @@ -1,93 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures that requesting +path+ using +method+ routes to +options+. - # - # If you don't specify a controller, it will use the controller from the - # example group. - # - # +to_param+ is called on the +options+ given. - # - # Examples: - # - # it { should route(:get, "/posts"). - # to(:controller => :posts, :action => :index) } - # it { should route(:get, "/posts/new").to(:action => :new) } - # it { should route(:post, "/posts").to(:action => :create) } - # it { should route(:get, "/posts/1").to(:action => :show, :id => 1) } - # it { should route(:edit, "/posts/1").to(:action => :show, :id => 1) } - # it { should route(:put, "/posts/1").to(:action => :update, :id => 1) } - # it { should route(:delete, "/posts/1"). - # to(:action => :destroy, :id => 1) } - # it { should route(:get, "/users/1/posts/1"). - # to(:action => :show, :id => 1, :user_id => 1) } - def route(method, path) - RouteMatcher.new(method, path, self) - end - - class RouteMatcher # :nodoc: - - def initialize(method, path, context) - @method = method - @path = path - @context = context - end - - def to(params) - @params = params - self - end - - def in_context(context) - @context = context - self - end - - def matches?(controller) - @controller = controller - guess_controller! - stringify_params! - route_recognized? - end - - attr_reader :failure_message, :negative_failure_message - - def description - "route #{@method.to_s.upcase} #{@path} to/from #{@params.inspect}" - end - - private - - def guess_controller! - @params[:controller] ||= @controller.controller_path - end - - def stringify_params! - @params.each do |key, value| - @params[key] = value.to_param - end - end - - def route_recognized? - begin - @context.send(:assert_routing, - { :method => @method, :path => @path }, - @params) - - @negative_failure_message = "Didn't expect to #{description}" - true - rescue ::ActionController::RoutingError => error - @failure_message = error.message - false - rescue Test::Unit::AssertionFailedError => error - @failure_message = error.message - false - end - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_session_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_session_matcher.rb deleted file mode 100644 index c1a823b..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_session_matcher.rb +++ /dev/null @@ -1,87 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures that a session key was set to the expected value. - # - # Example: - # - # it { should set_session(:message) } - # it { should set_session(:user_id).to(@user.id) } - # it { should_not set_session(:user_id) } - def set_session(key) - SetSessionMatcher.new(key) - end - - class SetSessionMatcher # :nodoc: - - def initialize(key) - @key = key.to_s - end - - def to(value) - @value = value - self - end - - def matches?(controller) - @controller = controller - (assigned_value? && assigned_correct_value?) || cleared_value? - end - - def failure_message - "Expected #{expectation}, but #{result}" - end - - def negative_failure_message - "Didn't expect #{expectation}, but #{result}" - end - - def description - description = "set session variable #{@key.inspect}" - description << " to #{@value.inspect}" if defined?(@value) - description - end - - private - - def assigned_value? - !assigned_value.blank? - end - - def cleared_value? - defined?(@value) && @value.nil? && assigned_value.nil? - end - - def assigned_correct_value? - return true if @value.nil? - assigned_value == @value - end - - def assigned_value - session[@key] - end - - def session - @controller.response.session.data - end - - def expectation - expectation = "session variable #{@key} to be set" - expectation << " to #{@value.inspect}" if @value - expectation - end - - def result - if session.empty? - "no session variables were set" - else - "the session was #{session.inspect}" - end - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb deleted file mode 100644 index 0964cc7..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb +++ /dev/null @@ -1,85 +0,0 @@ -module Shoulda # :nodoc: - module ActionController # :nodoc: - module Matchers - - # Ensures that the flash contains the given value. Can be a String, a - # Regexp, or nil (indicating that the flash should not be set). - # - # Example: - # - # it { should set_the_flash } - # it { should set_the_flash.to("Thank you for placing this order.") } - # it { should set_the_flash.to(/created/i) } - # it { should_not set_the_flash } - def set_the_flash - SetTheFlashMatcher.new - end - - class SetTheFlashMatcher # :nodoc: - - def to(value) - @value = value - self - end - - def matches?(controller) - @controller = controller - sets_the_flash? && string_value_matches? && regexp_value_matches? - end - - attr_reader :failure_message, :negative_failure_message - - def description - description = "set the flash" - description << " to #{@value.inspect}" unless @value.nil? - description - end - - def failure_message - "Expected #{expectation}" - end - - def negative_failure_message - "Did not expect #{expectation}" - end - - private - - def sets_the_flash? - !flash.blank? - end - - def string_value_matches? - return true unless String === @value - flash.values.any? {|value| value == @value } - end - - def regexp_value_matches? - return true unless Regexp === @value - flash.values.any? {|value| value =~ @value } - end - - def flash - @controller.response.session['flash'] - end - - def expectation - expectation = "the flash to be set" - expectation << " to #{@value.inspect}" unless @value.nil? - expectation << ", but #{flash_description}" - expectation - end - - def flash_description - if flash.blank? - "no flash was set" - else - "was #{flash.inspect}" - end - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/resource_options.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/resource_options.rb deleted file mode 100644 index aca8b17..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/resource_options.rb +++ /dev/null @@ -1,233 +0,0 @@ -module Shoulda # :nodoc: - module ActionController - # Formats tested by #should_be_restful. Defaults to [:html, :xml] - VALID_FORMATS = Dir.glob(File.join(File.dirname(__FILE__), 'formats', '*.rb')).map { |f| File.basename(f, '.rb') }.map(&:to_sym) # :doc: - VALID_FORMATS.each {|f| require "shoulda/action_controller/formats/#{f}"} - - # Actions tested by #should_be_restful - VALID_ACTIONS = [:index, :show, :new, :edit, :create, :update, :destroy] # :doc: - - # A ResourceOptions object is passed into should_be_restful in order to configure the tests for your controller. - # - # Example: - # class UsersControllerTest < Test::Unit::TestCase - # fixtures :all - # - # def setup - # ...normal setup code... - # @user = User.find(:first) - # end - # - # should_be_restful do |resource| - # resource.identifier = :id - # resource.klass = User - # resource.object = :user - # resource.parent = [] - # resource.actions = [:index, :show, :new, :edit, :update, :create, :destroy] - # resource.formats = [:html, :xml] - # - # resource.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13} - # resource.update.params = { :name => "sue" } - # - # resource.create.redirect = "user_url(@user)" - # resource.update.redirect = "user_url(@user)" - # resource.destroy.redirect = "users_url" - # - # resource.create.flash = /created/i - # resource.update.flash = /updated/i - # resource.destroy.flash = /removed/i - # end - # end - # - # Whenever possible, the resource attributes will be set to sensible defaults. - # - class ResourceOptions - # Configuration options for the create, update, destroy actions under should_be_restful - class ActionOptions - # String evaled to get the target of the redirection. - # All of the instance variables set by the controller will be available to the - # evaled code. - # - # Example: - # resource.create.redirect = "user_url(@user.company, @user)" - # - # Defaults to a generated url based on the name of the controller, the action, and the resource.parents list. - attr_accessor :redirect - - # String or Regexp describing a value expected in the flash. Will match against any flash key. - # - # Defaults: - # destroy:: /removed/ - # create:: /created/ - # update:: /updated/ - attr_accessor :flash - - # Hash describing the params that should be sent in with this action. - attr_accessor :params - end - - # Configuration options for the denied actions under should_be_restful - # - # Example: - # context "The public" do - # setup do - # @request.session[:logged_in] = false - # end - # - # should_be_restful do |resource| - # resource.parent = :user - # - # resource.denied.actions = [:index, :show, :edit, :new, :create, :update, :destroy] - # resource.denied.flash = /get outta here/i - # resource.denied.redirect = 'new_session_url' - # end - # end - # - class DeniedOptions - # String evaled to get the target of the redirection. - # All of the instance variables set by the controller will be available to the - # evaled code. - # - # Example: - # resource.create.redirect = "user_url(@user.company, @user)" - attr_accessor :redirect - - # String or Regexp describing a value expected in the flash. Will match against any flash key. - # - # Example: - # resource.create.flash = /created/ - attr_accessor :flash - - # Actions that should be denied (only used by resource.denied). Note that these actions will - # only be tested if they are also listed in +resource.actions+ - # The special value of :all will deny all of the REST actions. - attr_accessor :actions - end - - # Name of key in params that references the primary key. - # Will almost always be :id (default), unless you are using a plugin or have patched rails. - attr_accessor :identifier - - # Name of the ActiveRecord class this resource is responsible for. Automatically determined from - # test class if not explicitly set. UserTest => "User" - attr_accessor :klass - - # Name of the instantiated ActiveRecord object that should be used by some of the tests. - # Defaults to the underscored name of the AR class. CompanyManager => :company_manager - attr_accessor :object - - # Name of the parent AR objects. Can be set as parent= or parents=, and can take either - # the name of the parent resource (if there's only one), or an array of names (if there's - # more than one). - # - # Example: - # # in the routes... - # map.resources :companies do - # map.resources :people do - # map.resources :limbs - # end - # end - # - # # in the tests... - # class PeopleControllerTest < Test::Unit::TestCase - # should_be_restful do |resource| - # resource.parent = :companies - # end - # end - # - # class LimbsControllerTest < Test::Unit::TestCase - # should_be_restful do |resource| - # resource.parents = [:companies, :people] - # end - # end - attr_accessor :parent - alias parents parent - alias parents= parent= - - # Actions that should be tested. Must be a subset of VALID_ACTIONS (default). - # Tests for each actionw will only be generated if the action is listed here. - # The special value of :all will test all of the REST actions. - # - # Example (for a read-only controller): - # resource.actions = [:show, :index] - attr_accessor :actions - - # Formats that should be tested. Must be a subset of VALID_FORMATS (default). - # Each action will be tested against the formats listed here. The special value - # of :all will test all of the supported formats. - # - # Example: - # resource.actions = [:html, :xml] - attr_accessor :formats - - # ActionOptions object specifying options for the create action. - attr_accessor :create - - # ActionOptions object specifying options for the update action. - attr_accessor :update - - # ActionOptions object specifying options for the desrtoy action. - attr_accessor :destroy - - # DeniedOptions object specifying which actions should return deny a request, and what should happen in that case. - attr_accessor :denied - - def initialize # :nodoc: - @create = ActionOptions.new - @update = ActionOptions.new - @destroy = ActionOptions.new - @denied = DeniedOptions.new - - @create.flash ||= /created/i - @update.flash ||= /updated/i - @destroy.flash ||= /removed/i - @denied.flash ||= /denied/i - - @create.params ||= {} - @update.params ||= {} - - @actions = VALID_ACTIONS - @formats = VALID_FORMATS - @denied.actions = [] - end - - def normalize!(target) # :nodoc: - @denied.actions = VALID_ACTIONS if @denied.actions == :all - @actions = VALID_ACTIONS if @actions == :all - @formats = VALID_FORMATS if @formats == :all - - @denied.actions = @denied.actions.map(&:to_sym) - @actions = @actions.map(&:to_sym) - @formats = @formats.map(&:to_sym) - - ensure_valid_members(@actions, VALID_ACTIONS, 'actions') - ensure_valid_members(@denied.actions, VALID_ACTIONS, 'denied.actions') - ensure_valid_members(@formats, VALID_FORMATS, 'formats') - - @identifier ||= :id - @klass ||= target.name.gsub(/ControllerTest$/, '').singularize.constantize - @object ||= @klass.name.tableize.singularize - @parent ||= [] - @parent = [@parent] unless @parent.is_a? Array - - collection_helper = [@parent, @object.to_s.pluralize, 'url'].flatten.join('_') - collection_args = @parent.map {|n| "@#{object}.#{n}"}.join(', ') - @destroy.redirect ||= "#{collection_helper}(#{collection_args})" - - member_helper = [@parent, @object, 'url'].flatten.join('_') - member_args = [@parent.map {|n| "@#{object}.#{n}"}, "@#{object}"].flatten.join(', ') - @create.redirect ||= "#{member_helper}(#{member_args})" - @update.redirect ||= "#{member_helper}(#{member_args})" - @denied.redirect ||= "new_session_url" - end - - private - - def ensure_valid_members(ary, valid_members, name) # :nodoc: - invalid = ary - valid_members - raise ArgumentError, "Unsupported #{name}: #{invalid.inspect}" unless invalid.empty? - end - end - end -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer.rb deleted file mode 100644 index f6195f2..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'shoulda' -require 'shoulda/action_mailer/assertions' - -module Test # :nodoc: all - module Unit - class TestCase - include Shoulda::ActionMailer::Assertions - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer/assertions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer/assertions.rb deleted file mode 100644 index 153d079..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer/assertions.rb +++ /dev/null @@ -1,38 +0,0 @@ -module Shoulda # :nodoc: - module ActionMailer # :nodoc: - module Assertions - # Asserts that an email was delivered. Can take a block that can further - # narrow down the types of emails you're expecting. - # - # assert_sent_email - # - # Passes if ActionMailer::Base.deliveries has an email - # - # assert_sent_email do |email| - # email.subject =~ /hi there/ && email.to.include?('none@none.com') - # end - # - # Passes if there is an email with subject containing 'hi there' and - # 'none@none.com' as one of the recipients. - # - def assert_sent_email - emails = ::ActionMailer::Base.deliveries - assert !emails.empty?, "No emails were sent" - if block_given? - matching_emails = emails.select {|email| yield email } - assert !matching_emails.empty?, "None of the emails matched." - end - end - - # Asserts that no ActionMailer mails were delivered - # - # assert_did_not_send_email - def assert_did_not_send_email - msg = "Sent #{::ActionMailer::Base.deliveries.size} emails.\n" - ::ActionMailer::Base.deliveries.each { |m| msg << " '#{m.subject}' sent to #{m.to.to_sentence}\n" } - assert ::ActionMailer::Base.deliveries.empty?, msg - end - end - end -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view.rb deleted file mode 100644 index 2615b63..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'shoulda' -require 'shoulda/action_view/macros' - -module Test # :nodoc: all - module Unit - class TestCase - extend Shoulda::ActionView::Macros - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view/macros.rb deleted file mode 100644 index 7157bd0..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view/macros.rb +++ /dev/null @@ -1,56 +0,0 @@ -module Shoulda # :nodoc: - module ActionView # :nodoc: - # = Macro test helpers for your view - # - # By using the macro helpers you can quickly and easily create concise and - # easy to read test suites. - # - # This code segment: - # context "on GET to :new" do - # setup do - # get :new - # end - # - # should_render_a_form - # should_render_page_with_metadata :title => /index/ - # - # should "do something else really cool" do - # assert_select '#really_cool' - # end - # end - # - # Would produce 3 tests for the +show+ action - module Macros - - # Macro that creates a test asserting that the rendered view contains a
element. - def should_render_a_form - should "display a form" do - assert_select "form", true, "The template doesn't contain a element" - end - end - - # Macro that creates a test asserting that the rendered view contains the selected metatags. - # Values can be string or Regexps. - # Example: - # - # should_render_page_with_metadata :description => "Description of this page", :keywords => /post/ - # - # You can also use this method to test the rendered views title. - # - # Example: - # should_render_page_with_metadata :title => /index/ - def should_render_page_with_metadata(options) - options.each do |key, value| - should "have metatag #{key}" do - if key.to_sym == :title - assert_select "title", value - else - assert_select "meta[name=?][content#{"*" if value.is_a?(Regexp)}=?]", key, value - end - end - end - end - end - end -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record.rb deleted file mode 100644 index c379282..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'shoulda' -require 'shoulda/active_record/helpers' -require 'shoulda/active_record/matchers' -require 'shoulda/active_record/assertions' -require 'shoulda/active_record/macros' - -module Test # :nodoc: all - module Unit - class TestCase - include Shoulda::ActiveRecord::Helpers - include Shoulda::ActiveRecord::Matchers - include Shoulda::ActiveRecord::Assertions - extend Shoulda::ActiveRecord::Macros - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/assertions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/assertions.rb deleted file mode 100644 index 9730fe1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/assertions.rb +++ /dev/null @@ -1,69 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Assertions - # Asserts that the given object can be saved - # - # assert_save User.new(params) - def assert_save(obj) - assert obj.save, "Errors: #{pretty_error_messages obj}" - obj.reload - end - - # Asserts that the given object is valid - # - # assert_valid User.new(params) - def assert_valid(obj) - assert obj.valid?, "Errors: #{pretty_error_messages obj}" - end - - # Asserts that an Active Record model validates with the passed - # value by making sure the error_message_to_avoid is not - # contained within the list of errors for that attribute. - # - # assert_good_value(User.new, :email, "user@example.com") - # assert_good_value(User.new, :ssn, "123456789", /length/) - # - # If a class is passed as the first argument, a new object will be - # instantiated before the assertion. If an instance variable exists with - # the same name as the class (underscored), that object will be used - # instead. - # - # assert_good_value(User, :email, "user@example.com") - # - # @product = Product.new(:tangible => false) - # assert_good_value(Product, :price, "0") - def assert_good_value(object_or_klass, attribute, value, error_message_to_avoid = nil) - object = get_instance_of(object_or_klass) - matcher = allow_value(value). - for(attribute). - with_message(error_message_to_avoid) - assert_accepts(matcher, object) - end - - # Asserts that an Active Record model invalidates the passed - # value by making sure the error_message_to_expect is - # contained within the list of errors for that attribute. - # - # assert_bad_value(User.new, :email, "invalid") - # assert_bad_value(User.new, :ssn, "123", /length/) - # - # If a class is passed as the first argument, a new object will be - # instantiated before the assertion. If an instance variable exists with - # the same name as the class (underscored), that object will be used - # instead. - # - # assert_bad_value(User, :email, "invalid") - # - # @product = Product.new(:tangible => true) - # assert_bad_value(Product, :price, "0") - def assert_bad_value(object_or_klass, attribute, value, - error_message_to_expect = nil) - object = get_instance_of(object_or_klass) - matcher = allow_value(value). - for(attribute). - with_message(error_message_to_expect) - assert_rejects(matcher, object) - end - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/helpers.rb deleted file mode 100644 index 26799c1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/helpers.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Helpers - def pretty_error_messages(obj) # :nodoc: - obj.errors.map do |a, m| - msg = "#{a} #{m}" - msg << " (#{obj.send(a).inspect})" unless a.to_sym == :base - end - end - - def get_instance_of(object_or_klass) - if object_or_klass.is_a?(Class) - klass = object_or_klass - instance_variable_get("@#{instance_variable_name_for(klass)}") || klass.new - else - object_or_klass - end - end - - def instance_variable_name_for(klass) - klass.to_s.split('::').last.underscore - end - - # Helper method that determines the default error message used by Active - # Record. Works for both existing Rails 2.1 and Rails 2.2 with the newly - # introduced I18n module used for localization. - # - # default_error_message(:blank) - # default_error_message(:too_short, :count => 5) - # default_error_message(:too_long, :count => 60) - def default_error_message(key, values = {}) - if Object.const_defined?(:I18n) # Rails >= 2.2 - I18n.translate("activerecord.errors.messages.#{key}", values) - else # Rails <= 2.1.x - ::ActiveRecord::Errors.default_error_messages[key] % values[:count] - end - end - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb deleted file mode 100644 index 231ca20..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb +++ /dev/null @@ -1,589 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - # = Macro test helpers for your active record models - # - # These helpers will test most of the validations and associations for your ActiveRecord models. - # - # class UserTest < Test::Unit::TestCase - # should_validate_presence_of :name, :phone_number - # should_not_allow_values_for :phone_number, "abcd", "1234" - # should_allow_values_for :phone_number, "(123) 456-7890" - # - # should_not_allow_mass_assignment_of :password - # - # should_have_one :profile - # should_have_many :dogs - # should_have_many :messes, :through => :dogs - # should_belong_to :lover - # end - # - # For all of these helpers, the last parameter may be a hash of options. - # - module Macros - include Helpers - include Matchers - - # Ensures that the model cannot be saved if one of the attributes listed is not present. - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.blank') - # - # Example: - # should_validate_presence_of :name, :phone_number - # - def should_validate_presence_of(*attributes) - message = get_options!(attributes, :message) - klass = model_class - - attributes.each do |attribute| - matcher = validate_presence_of(attribute).with_message(message) - should matcher.description do - assert_accepts(matcher, get_instance_of(klass)) - end - end - end - - # Deprecated. See should_validate_presence_of - def should_require_attributes(*attributes) - warn "[DEPRECATION] should_require_attributes is deprecated. " << - "Use should_validate_presence_of instead." - should_validate_presence_of(*attributes) - end - - # Ensures that the model cannot be saved if one of the attributes listed is not unique. - # Requires an existing record - # - # Options: - - # * :message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.taken') - # * :scoped_to - field(s) to scope the uniqueness to. - # * :case_sensitive - whether or not uniqueness is defined by an - # exact match. Ignored by non-text attributes. Default = true - # - # Examples: - # should_validate_uniqueness_of :keyword, :username - # should_validate_uniqueness_of :name, :message => "O NOES! SOMEONE STOELED YER NAME!" - # should_validate_uniqueness_of :email, :scoped_to => :name - # should_validate_uniqueness_of :address, :scoped_to => [:first_name, :last_name] - # should_validate_uniqueness_of :email, :case_sensitive => false - # - def should_validate_uniqueness_of(*attributes) - message, scope, case_sensitive = get_options!(attributes, :message, :scoped_to, :case_sensitive) - scope = [*scope].compact - case_sensitive = true if case_sensitive.nil? - - klass = model_class - - attributes.each do |attribute| - matcher = validate_uniqueness_of(attribute). - with_message(message).scoped_to(scope) - matcher = matcher.case_insensitive unless case_sensitive - should matcher.description do - assert_accepts(matcher, get_instance_of(klass)) - end - end - end - - # Deprecated. See should_validate_uniqueness_of - def should_require_unique_attributes(*attributes) - warn "[DEPRECATION] should_require_unique_attributes is deprecated. " << - "Use should_validate_uniqueness_of instead." - should_validate_uniqueness_of(*attributes) - end - - # Ensures that the attribute can be set on mass update. - # - # should_allow_mass_assignment_of :first_name, :last_name - # - def should_allow_mass_assignment_of(*attributes) - get_options!(attributes) - klass = model_class - - attributes.each do |attribute| - matcher = allow_mass_assignment_of(attribute) - should matcher.description do - assert_accepts matcher, klass.new - end - end - end - - # Ensures that the attribute cannot be set on mass update. - # - # should_not_allow_mass_assignment_of :password, :admin_flag - # - def should_not_allow_mass_assignment_of(*attributes) - get_options!(attributes) - klass = model_class - - attributes.each do |attribute| - matcher = allow_mass_assignment_of(attribute) - should "not #{matcher.description}" do - assert_rejects matcher, klass.new - end - end - end - - # Deprecated. See should_not_allow_mass_assignment_of - def should_protect_attributes(*attributes) - warn "[DEPRECATION] should_protect_attributes is deprecated. " << - "Use should_not_allow_mass_assignment_of instead." - should_not_allow_mass_assignment_of(*attributes) - end - - # Ensures that the attribute cannot be changed once the record has been created. - # - # should_have_readonly_attributes :password, :admin_flag - # - def should_have_readonly_attributes(*attributes) - get_options!(attributes) - klass = model_class - - attributes.each do |attribute| - matcher = have_readonly_attribute(attribute) - should matcher.description do - assert_accepts matcher, klass.new - end - end - end - - # Ensures that the attribute cannot be set to the given values - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.invalid') - # - # Example: - # should_not_allow_values_for :isbn, "bad 1", "bad 2" - # - def should_not_allow_values_for(attribute, *bad_values) - message = get_options!(bad_values, :message) - klass = model_class - bad_values.each do |value| - matcher = allow_value(value).for(attribute).with_message(message) - should "not #{matcher.description}" do - assert_rejects matcher, get_instance_of(klass) - end - end - end - - # Ensures that the attribute can be set to the given values. - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Example: - # should_allow_values_for :isbn, "isbn 1 2345 6789 0", "ISBN 1-2345-6789-0" - # - def should_allow_values_for(attribute, *good_values) - get_options!(good_values) - klass = model_class - klass = model_class - good_values.each do |value| - matcher = allow_value(value).for(attribute) - should matcher.description do - assert_accepts matcher, get_instance_of(klass) - end - end - end - - # Ensures that the length of the attribute is in the given range - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :short_message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.too_short') % range.first - # * :long_message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.too_long') % range.last - # - # Example: - # should_ensure_length_in_range :password, (6..20) - # - def should_ensure_length_in_range(attribute, range, opts = {}) - short_message, long_message = get_options!([opts], - :short_message, - :long_message) - klass = model_class - - matcher = ensure_length_of(attribute). - is_at_least(range.first). - with_short_message(short_message). - is_at_most(range.last). - with_long_message(long_message) - - should matcher.description do - assert_accepts matcher, get_instance_of(klass) - end - end - - # Ensures that the length of the attribute is at least a certain length - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :short_message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.too_short') % min_length - # - # Example: - # should_ensure_length_at_least :name, 3 - # - def should_ensure_length_at_least(attribute, min_length, opts = {}) - short_message = get_options!([opts], :short_message) - klass = model_class - - matcher = ensure_length_of(attribute). - is_at_least(min_length). - with_short_message(short_message) - - should matcher.description do - assert_accepts matcher, get_instance_of(klass) - end - end - - # Ensures that the length of the attribute is exactly a certain length - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.wrong_length') % length - # - # Example: - # should_ensure_length_is :ssn, 9 - # - def should_ensure_length_is(attribute, length, opts = {}) - message = get_options!([opts], :message) - klass = model_class - matcher = ensure_length_of(attribute). - is_equal_to(length). - with_message(message) - - should matcher.description do - assert_accepts matcher, get_instance_of(klass) - end - end - - # Ensure that the attribute is in the range specified - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :low_message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.inclusion') - # * :high_message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.inclusion') - # - # Example: - # should_ensure_value_in_range :age, (0..100) - # - def should_ensure_value_in_range(attribute, range, opts = {}) - message, low_message, high_message = get_options!([opts], - :message, - :low_message, - :high_message) - klass = model_class - matcher = ensure_inclusion_of(attribute). - in_range(range). - with_message(message). - with_low_message(low_message). - with_high_message(high_message) - should matcher.description do - assert_accepts matcher, get_instance_of(klass) - end - end - - # Ensure that the attribute is numeric - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.not_a_number') - # - # Example: - # should_validate_numericality_of :age - # - def should_validate_numericality_of(*attributes) - message = get_options!(attributes, :message) - klass = model_class - attributes.each do |attribute| - matcher = validate_numericality_of(attribute). - with_message(message) - should matcher.description do - assert_accepts matcher, get_instance_of(klass) - end - end - end - - # Deprecated. See should_validate_numericality_of - def should_only_allow_numeric_values_for(*attributes) - warn "[DEPRECATION] should_only_allow_numeric_values_for is " << - "deprecated. Use should_validate_numericality_of instead." - should_validate_numericality_of(*attributes) - end - - # Ensures that the has_many relationship exists. Will also test that the - # associated table has the required columns. Works with polymorphic - # associations. - # - # Options: - # * :through - association name for has_many :through - # * :dependent - tests that the association makes use of the dependent option. - # - # Example: - # should_have_many :friends - # should_have_many :enemies, :through => :friends - # should_have_many :enemies, :dependent => :destroy - # - def should_have_many(*associations) - through, dependent = get_options!(associations, :through, :dependent) - klass = model_class - associations.each do |association| - matcher = have_many(association).through(through).dependent(dependent) - should matcher.description do - assert_accepts(matcher, klass.new) - end - end - end - - # Ensure that the has_one relationship exists. Will also test that the - # associated table has the required columns. Works with polymorphic - # associations. - # - # Options: - # * :dependent - tests that the association makes use of the dependent option. - # - # Example: - # should_have_one :god # unless hindu - # - def should_have_one(*associations) - dependent = get_options!(associations, :dependent) - klass = model_class - associations.each do |association| - matcher = have_one(association).dependent(dependent) - should matcher.description do - assert_accepts(matcher, klass.new) - end - end - end - - # Ensures that the has_and_belongs_to_many relationship exists, and that the join - # table is in place. - # - # should_have_and_belong_to_many :posts, :cars - # - def should_have_and_belong_to_many(*associations) - get_options!(associations) - klass = model_class - - associations.each do |association| - matcher = have_and_belong_to_many(association) - should matcher.description do - assert_accepts(matcher, klass.new) - end - end - end - - # Ensure that the belongs_to relationship exists. - # - # should_belong_to :parent - # - def should_belong_to(*associations) - dependent = get_options!(associations, :dependent) - klass = model_class - associations.each do |association| - matcher = belong_to(association).dependent(dependent) - should matcher.description do - assert_accepts(matcher, klass.new) - end - end - end - - # Ensure that the given class methods are defined on the model. - # - # should_have_class_methods :find, :destroy - # - def should_have_class_methods(*methods) - get_options!(methods) - klass = model_class - methods.each do |method| - should "respond to class method ##{method}" do - assert_respond_to klass, method, "#{klass.name} does not have class method #{method}" - end - end - end - - # Ensure that the given instance methods are defined on the model. - # - # should_have_instance_methods :email, :name, :name= - # - def should_have_instance_methods(*methods) - get_options!(methods) - klass = model_class - methods.each do |method| - should "respond to instance method ##{method}" do - assert_respond_to klass.new, method, "#{klass.name} does not have instance method #{method}" - end - end - end - - # Ensure that the given columns are defined on the models backing SQL table. - # Also aliased to should_have_index for readability. - # Takes the same options available in migrations: - # :type, :precision, :limit, :default, :null, and :scale - # - # Examples: - # - # should_have_db_columns :id, :email, :name, :created_at - # - # should_have_db_column :email, :type => "string", :limit => 255 - # should_have_db_column :salary, :decimal, :precision => 15, :scale => 2 - # should_have_db_column :admin, :default => false, :null => false - # - def should_have_db_columns(*columns) - column_type, precision, limit, default, null, scale, sql_type = - get_options!(columns, :type, :precision, :limit, - :default, :null, :scale, :sql_type) - klass = model_class - columns.each do |name| - matcher = have_db_column(name). - of_type(column_type). - with_options(:precision => precision, :limit => limit, - :default => default, :null => null, - :scale => scale, :sql_type => sql_type) - should matcher.description do - assert_accepts(matcher, klass.new) - end - end - end - - alias_method :should_have_db_column, :should_have_db_columns - - # Ensures that there are DB indices on the given columns or tuples of columns. - # Also aliased to should_have_index for readability - # - # Options: - # * :unique - whether or not the index has a unique - # constraint. Use true to explicitly test for a unique - # constraint. Use false to explicitly test for a non-unique - # constraint. Use nil if you don't care whether the index is - # unique or not. Default = nil - # - # Examples: - # - # should_have_indices :email, :name, [:commentable_type, :commentable_id] - # should_have_index :age - # should_have_index :ssn, :unique => true - # - def should_have_indices(*columns) - unique = get_options!(columns, :unique) - klass = model_class - - columns.each do |column| - matcher = have_index(column).unique(unique) - should matcher.description do - assert_accepts(matcher, klass.new) - end - end - end - - alias_method :should_have_index, :should_have_indices - - # Ensures that the model cannot be saved if one of the attributes listed is not accepted. - # - # If an instance variable has been created in the setup named after the - # model being tested, then this method will use that. Otherwise, it will - # create a new instance to test against. - # - # Options: - # * :message - value the test expects to find in errors.on(:attribute). - # Regexp or string. Default = I18n.translate('activerecord.errors.messages.accepted') - # - # Example: - # should_validate_acceptance_of :eula - # - def should_validate_acceptance_of(*attributes) - message = get_options!(attributes, :message) - klass = model_class - - attributes.each do |attribute| - matcher = validate_acceptance_of(attribute).with_message(message) - should matcher.description do - assert_accepts matcher, get_instance_of(klass) - end - end - end - - # Deprecated. See should_validate_uniqueness_of - def should_require_acceptance_of(*attributes) - warn "[DEPRECATION] should_require_acceptance_of is deprecated. " << - "Use should_validate_acceptance_of instead." - should_validate_acceptance_of(*attributes) - end - - # Ensures that the model has a method named scope_name that returns a NamedScope object with the - # proxy options set to the options you supply. scope_name can be either a symbol, or a method - # call which will be evaled against the model. The eval'd method call has access to all the same - # instance variables that a should statement would. - # - # Options: Any of the options that the named scope would pass on to find. - # - # Example: - # - # should_have_named_scope :visible, :conditions => {:visible => true} - # - # Passes for - # - # named_scope :visible, :conditions => {:visible => true} - # - # Or for - # - # def self.visible - # scoped(:conditions => {:visible => true}) - # end - # - # You can test lambdas or methods that return ActiveRecord#scoped calls: - # - # should_have_named_scope 'recent(5)', :limit => 5 - # should_have_named_scope 'recent(1)', :limit => 1 - # - # Passes for - # named_scope :recent, lambda {|c| {:limit => c}} - # - # Or for - # - # def self.recent(c) - # scoped(:limit => c) - # end - # - def should_have_named_scope(scope_call, find_options = nil) - klass = model_class - matcher = have_named_scope(scope_call).finding(find_options) - should matcher.description do - assert_accepts matcher.in_context(self), klass.new - end - end - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers.rb deleted file mode 100644 index 69b35ba..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers.rb +++ /dev/null @@ -1,42 +0,0 @@ -require 'shoulda/active_record/helpers' -require 'shoulda/active_record/matchers/validation_matcher' -require 'shoulda/active_record/matchers/allow_value_matcher' -require 'shoulda/active_record/matchers/ensure_length_of_matcher' -require 'shoulda/active_record/matchers/ensure_inclusion_of_matcher' -require 'shoulda/active_record/matchers/validate_presence_of_matcher' -require 'shoulda/active_record/matchers/validate_uniqueness_of_matcher' -require 'shoulda/active_record/matchers/validate_acceptance_of_matcher' -require 'shoulda/active_record/matchers/validate_numericality_of_matcher' -require 'shoulda/active_record/matchers/association_matcher' -require 'shoulda/active_record/matchers/have_db_column_matcher' -require 'shoulda/active_record/matchers/have_index_matcher' -require 'shoulda/active_record/matchers/have_readonly_attribute_matcher' -require 'shoulda/active_record/matchers/allow_mass_assignment_of_matcher' -require 'shoulda/active_record/matchers/have_named_scope_matcher' - - -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - # = Matchers for your active record models - # - # These matchers will test most of the validations and associations for your - # ActiveRecord models. - # - # describe User do - # it { should validate_presence_of(:name) } - # it { should validate_presence_of(:phone_number) } - # %w(abcd 1234).each do |value| - # it { should_not allow_value(value).for(:phone_number) } - # end - # it { should allow_value("(123) 456-7890").for(:phone_number) } - # it { should_not allow_mass_assignment_of(:password) } - # it { should have_one(:profile) } - # it { should have_many(:dogs) } - # it { should have_many(:messes).through(:dogs) } - # it { should belong_to(:lover) } - # end - # - module Matchers - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb deleted file mode 100644 index fab6b64..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb +++ /dev/null @@ -1,83 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the attribute can be set on mass update. - # - # it { should_not allow_mass_assignment_of(:password) } - # it { should allow_mass_assignment_of(:first_name) } - # - def allow_mass_assignment_of(value) - AllowMassAssignmentOfMatcher.new(value) - end - - class AllowMassAssignmentOfMatcher # :nodoc: - - def initialize(attribute) - @attribute = attribute.to_s - end - - def matches?(subject) - @subject = subject - if attr_mass_assignable? - if whitelisting? - @failure_message = "#{@attribute} was made accessible" - else - if protected_attributes.empty? - @failure_message = "no attributes were protected" - else - @failure_message = "#{class_name} is protecting " << - "#{protected_attributes.to_a.to_sentence}, " << - "but not #{@attribute}." - end - end - true - else - if whitelisting? - @negative_failure_message = - "Expected #{@attribute} to be accessible" - else - @negative_failure_message = - "Did not expect #{@attribute} to be protected" - end - false - end - end - - attr_reader :failure_message, :negative_failure_message - - def description - "protect #{@attribute} from mass updates" - end - - private - - def protected_attributes - @protected_attributes ||= (@subject.class.protected_attributes || []) - end - - def accessible_attributes - @accessible_attributes ||= (@subject.class.accessible_attributes || []) - end - - def whitelisting? - !accessible_attributes.empty? - end - - def attr_mass_assignable? - if whitelisting? - accessible_attributes.include?(@attribute) - else - !protected_attributes.include?(@attribute) - end - end - - def class_name - @subject.class.name - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_value_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_value_matcher.rb deleted file mode 100644 index 3402602..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_value_matcher.rb +++ /dev/null @@ -1,102 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the attribute can be set to the given value. - # - # Options: - # * with_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :invalid. - # - # Example: - # it { should_not allow_value('bad').for(:isbn) } - # it { should allow_value("isbn 1 2345 6789 0").for(:isbn) } - # - def allow_value(value) - AllowValueMatcher.new(value) - end - - class AllowValueMatcher # :nodoc: - include Helpers - - def initialize(value) - @value = value - end - - def for(attribute) - @attribute = attribute - self - end - - def with_message(message) - @expected_message = message if message - self - end - - def matches?(instance) - @instance = instance - @expected_message ||= :invalid - if Symbol === @expected_message - @expected_message = default_error_message(@expected_message) - end - @instance.send("#{@attribute}=", @value) - !errors_match? - end - - def failure_message - "Did not expect #{expectation}, got error: #{@matched_error}" - end - - def negative_failure_message - "Expected #{expectation}, got #{error_description}" - end - - def description - "allow #{@attribute} to be set to #{@value.inspect}" - end - - private - - def errors_match? - @instance.valid? - @errors = @instance.errors.on(@attribute) - @errors = [@errors] unless @errors.is_a?(Array) - errors_match_regexp? || errors_match_string? - end - - def errors_match_regexp? - if Regexp === @expected_message - @matched_error = @errors.detect { |e| e =~ @expected_message } - !@matched_error.nil? - else - false - end - end - - def errors_match_string? - if @errors.include?(@expected_message) - @matched_error = @expected_message - true - else - false - end - end - - def expectation - "errors to include #{@expected_message.inspect} " << - "when #{@attribute} is set to #{@value.inspect}" - end - - def error_description - if @instance.errors.empty? - "no errors" - else - "errors: #{pretty_error_messages(@instance)}" - end - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/association_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/association_matcher.rb deleted file mode 100644 index 87e0176..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/association_matcher.rb +++ /dev/null @@ -1,226 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensure that the belongs_to relationship exists. - # - # it { should belong_to(:parent) } - # - def belong_to(name) - AssociationMatcher.new(:belongs_to, name) - end - - # Ensures that the has_many relationship exists. Will also test that the - # associated table has the required columns. Works with polymorphic - # associations. - # - # Options: - # * through - association name for has_many :through - # * dependent - tests that the association makes use of the - # dependent option. - # - # Example: - # it { should_have_many(:friends) } - # it { should_have_many(:enemies).through(:friends) } - # it { should_have_many(:enemies).dependent(:destroy) } - # - def have_many(name) - AssociationMatcher.new(:has_many, name) - end - - # Ensure that the has_one relationship exists. Will also test that the - # associated table has the required columns. Works with polymorphic - # associations. - # - # Options: - # * :dependent - tests that the association makes use of the - # dependent option. - # - # Example: - # it { should have_one(:god) } # unless hindu - # - def have_one(name) - AssociationMatcher.new(:has_one, name) - end - - # Ensures that the has_and_belongs_to_many relationship exists, and that - # the join table is in place. - # - # it { should have_and_belong_to_many(:posts) } - # - def have_and_belong_to_many(name) - AssociationMatcher.new(:has_and_belongs_to_many, name) - end - - class AssociationMatcher # :nodoc: - def initialize(macro, name) - @macro = macro - @name = name - end - - def through(through) - @through = through - self - end - - def dependent(dependent) - @dependent = dependent - self - end - - def matches?(subject) - @subject = subject - association_exists? && - macro_correct? && - foreign_key_exists? && - through_association_valid? && - dependent_correct? && - join_table_exists? - end - - def failure_message - "Expected #{expectation} (#{@missing})" - end - - def negative_failure_message - "Did not expect #{expectation}" - end - - def description - description = "#{macro_description} #{@name}" - description += " through #{@through}" if @through - description += " dependent => #{@dependent}" if @dependent - description - end - - protected - - def association_exists? - if reflection.nil? - @missing = "no association called #{@name}" - false - else - true - end - end - - def macro_correct? - if reflection.macro == @macro - true - else - @missing = "actual association type was #{reflection.macro}" - false - end - end - - def foreign_key_exists? - !(belongs_foreign_key_missing? || has_foreign_key_missing?) - end - - def belongs_foreign_key_missing? - @macro == :belongs_to && !class_has_foreign_key?(model_class) - end - - def has_foreign_key_missing? - [:has_many, :has_one].include?(@macro) && - !through? && - !class_has_foreign_key?(associated_class) - end - - def through_association_valid? - @through.nil? || (through_association_exists? && through_association_correct?) - end - - def through_association_exists? - if through_reflection.nil? - "#{model_class.name} does not have any relationship to #{@through}" - false - else - true - end - end - - def through_association_correct? - if @through == reflection.options[:through] - "Expected #{model_class.name} to have #{@name} through #{@through}, " << - " but got it through #{reflection.options[:through]}" - true - else - false - end - end - - def dependent_correct? - if @dependent.nil? || @dependent.to_s == reflection.options[:dependent].to_s - true - else - @missing = "#{@name} should have #{@dependent} dependency" - false - end - end - - def join_table_exists? - if @macro != :has_and_belongs_to_many || - ::ActiveRecord::Base.connection.tables.include?(join_table.to_s) - true - else - @missing = "join table #{join_table} doesn't exist" - false - end - end - - def class_has_foreign_key?(klass) - if klass.column_names.include?(foreign_key.to_s) - true - else - @missing = "#{klass} does not have a #{foreign_key} foreign key." - false - end - end - - def model_class - @subject.class - end - - def join_table - reflection.options[:join_table] - end - - def associated_class - reflection.klass - end - - def foreign_key - reflection.primary_key_name - end - - def through? - reflection.options[:through] - end - - def reflection - @reflection ||= model_class.reflect_on_association(@name) - end - - def through_reflection - @through_reflection ||= model_class.reflect_on_association(@through) - end - - def expectation - "#{model_class.name} to have a #{@macro} association called #{@name}" - end - - def macro_description - case @macro.to_s - when 'belongs_to' then 'belong to' - when 'has_many' then 'have many' - when 'has_one' then 'have one' - when 'has_and_belongs_to_many' then - 'have and belong to many' - end - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb deleted file mode 100644 index a20095a..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb +++ /dev/null @@ -1,87 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensure that the attribute's value is in the range specified - # - # Options: - # * in_range - the range of allowed values for this attribute - # * with_low_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :inclusion. - # * with_high_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :inclusion. - # - # Example: - # it { should ensure_inclusion_of(:age).in_range(0..100) } - # - def ensure_inclusion_of(attr) - EnsureInclusionOfMatcher.new(attr) - end - - class EnsureInclusionOfMatcher < ValidationMatcher # :nodoc: - - def in_range(range) - @range = range - @minimum = range.first - @maximum = range.last - self - end - - def with_message(message) - if message - @low_message = message - @high_message = message - end - self - end - - def with_low_message(message) - @low_message = message if message - self - end - - def with_high_message(message) - @high_message = message if message - self - end - - def description - "ensure inclusion of #{@attribute} in #{@range.inspect}" - end - - def matches?(subject) - super(subject) - - @low_message ||= :inclusion - @high_message ||= :inclusion - - disallows_lower_value && - allows_minimum_value && - disallows_higher_value && - allows_maximum_value - end - - private - - def disallows_lower_value - @minimum == 0 || disallows_value_of(@minimum - 1, @low_message) - end - - def disallows_higher_value - disallows_value_of(@maximum + 1, @high_message) - end - - def allows_minimum_value - allows_value_of(@minimum, @low_message) - end - - def allows_maximum_value - allows_value_of(@maximum, @high_message) - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb deleted file mode 100644 index 9c5cde1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb +++ /dev/null @@ -1,141 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the length of the attribute is validated. - # - # Options: - # * is_at_least - minimum length of this attribute - # * is_at_most - maximum length of this attribute - # * is_equal_to - exact requred length of this attribute - # * with_short_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :too_short. - # * with_long_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :too_long. - # * with_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :wrong_length. Used in conjunction with - # is_equal_to. - # - # Examples: - # it { should ensure_length_of(:password). - # is_at_least(6). - # is_at_most(20) } - # it { should ensure_length_of(:name). - # is_at_least(3). - # with_short_message(/not long enough/) } - # it { should ensure_length_of(:ssn). - # is_equal_to(9). - # with_message(/is invalid/) } - def ensure_length_of(attr) - EnsureLengthOfMatcher.new(attr) - end - - class EnsureLengthOfMatcher < ValidationMatcher # :nodoc: - include Helpers - - def is_at_least(length) - @minimum = length - @short_message ||= :too_short - self - end - - def is_at_most(length) - @maximum = length - @long_message ||= :too_long - self - end - - def is_equal_to(length) - @minimum = length - @maximum = length - @short_message ||= :wrong_length - self - end - - def with_short_message(message) - @short_message = message if message - self - end - alias_method :with_message, :with_short_message - - def with_long_message(message) - @long_message = message if message - self - end - - def description - description = "ensure #{@attribute} has a length " - if @minimum && @maximum - if @minimum == @maximum - description << "of exactly #{@minimum}" - else - description << "between #{@minimum} and #{@maximum}" - end - else - description << "of at least #{@minimum}" if @minimum - description << "of at most #{@maximum}" if @maximum - end - description - end - - def matches?(subject) - super(subject) - translate_messages! - disallows_lower_length && - allows_minimum_length && - ((@minimum == @maximum) || - (disallows_higher_length && - allows_maximum_length)) - end - - private - - def translate_messages! - if Symbol === @short_message - @short_message = default_error_message(@short_message, - :count => @minimum) - end - - if Symbol === @long_message - @long_message = default_error_message(@long_message, - :count => @maximum) - end - end - - def disallows_lower_length - @minimum == 0 || - @minimum.nil? || - disallows_length_of(@minimum - 1, @short_message) - end - - def disallows_higher_length - @maximum.nil? || disallows_length_of(@maximum + 1, @long_message) - end - - def allows_minimum_length - allows_length_of(@minimum, @short_message) - end - - def allows_maximum_length - allows_length_of(@maximum, @long_message) - end - - def allows_length_of(length, message) - length.nil? || allows_value_of(string_of_length(length), message) - end - - def disallows_length_of(length, message) - length.nil? || disallows_value_of(string_of_length(length), message) - end - - def string_of_length(length) - 'x' * length - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_db_column_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_db_column_matcher.rb deleted file mode 100644 index 86f5212..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_db_column_matcher.rb +++ /dev/null @@ -1,169 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures the database column exists. - # - # Options: - # * of_type - db column type (:integer, :string, etc.) - # * with_options - same options available in migrations - # (:default, :null, :limit, :precision, :scale) - # - # Examples: - # it { should_not have_db_column(:admin).of_type(:boolean) } - # it { should have_db_column(:salary). - # of_type(:decimal). - # with_options(:precision => 10, :scale => 2) } - # - def have_db_column(column) - HaveDbColumnMatcher.new(:have_db_column, column) - end - - class HaveDbColumnMatcher # :nodoc: - def initialize(macro, column) - @macro = macro - @column = column - end - - def of_type(column_type) - @column_type = column_type - self - end - - def with_options(opts = {}) - @precision = opts[:precision] - @limit = opts[:limit] - @default = opts[:default] - @null = opts[:null] - @scale = opts[:scale] - self - end - - def matches?(subject) - @subject = subject - column_exists? && - correct_column_type? && - correct_precision? && - correct_limit? && - correct_default? && - correct_null? && - correct_scale? - end - - def failure_message - "Expected #{expectation} (#{@missing})" - end - - def negative_failure_message - "Did not expect #{expectation}" - end - - def description - desc = "have db column named #{@column}" - desc << " of type #{@column_type}" unless @column_type.nil? - desc << " of precision #{@precision}" unless @precision.nil? - desc << " of limit #{@limit}" unless @limit.nil? - desc << " of default #{@default}" unless @default.nil? - desc << " of null #{@null}" unless @null.nil? - desc << " of primary #{@primary}" unless @primary.nil? - desc << " of scale #{@scale}" unless @scale.nil? - desc - end - - protected - - def column_exists? - if model_class.column_names.include?(@column.to_s) - true - else - @missing = "#{model_class} does not have a db column named #{@column}." - false - end - end - - def correct_column_type? - return true if @column_type.nil? - if matched_column.type.to_s == @column_type.to_s - true - else - @missing = "#{model_class} has a db column named #{@column} " << - "of type #{matched_column.type}, not #{@column_type}." - false - end - end - - def correct_precision? - return true if @precision.nil? - if matched_column.precision.to_s == @precision.to_s - true - else - @missing = "#{model_class} has a db column named #{@column} " << - "of precision #{matched_column.precision}, " << - "not #{@precision}." - false - end - end - - def correct_limit? - return true if @limit.nil? - if matched_column.limit.to_s == @limit.to_s - true - else - @missing = "#{model_class} has a db column named #{@column} " << - "of limit #{matched_column.limit}, " << - "not #{@limit}." - false - end - end - - def correct_default? - return true if @default.nil? - if matched_column.default.to_s == @default.to_s - true - else - @missing = "#{model_class} has a db column named #{@column} " << - "of default #{matched_column.default}, " << - "not #{@default}." - false - end - end - - def correct_null? - return true if @null.nil? - if matched_column.null.to_s == @null.to_s - true - else - @missing = "#{model_class} has a db column named #{@column} " << - "of null #{matched_column.null}, " << - "not #{@null}." - false - end - end - - def correct_scale? - return true if @scale.nil? - if matched_column.scale.to_s == @scale.to_s - true - else - @missing = "#{model_class} has a db column named #{@column} " << - "of scale #{matched_column.scale}, not #{@scale}." - false - end - end - - def matched_column - model_class.columns.detect { |each| each.name == @column.to_s } - end - - def model_class - @subject.class - end - - def expectation - expected = "#{model_class.name} to #{description}" - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_index_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_index_matcher.rb deleted file mode 100644 index be4a8c4..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_index_matcher.rb +++ /dev/null @@ -1,105 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that there are DB indices on the given columns or tuples of - # columns. - # - # Options: - # * unique - whether or not the index has a unique - # constraint. Use true to explicitly test for a unique - # constraint. Use false to explicitly test for a non-unique - # constraint. Use nil if you don't care whether the index is - # unique or not. Default = nil - # - # Examples: - # - # it { should have_index(:age) } - # it { should have_index([:commentable_type, :commentable_id]) } - # it { should have_index(:ssn).unique(true) } - # - def have_index(columns) - HaveIndexMatcher.new(:have_index, columns) - end - - class HaveIndexMatcher # :nodoc: - def initialize(macro, columns) - @macro = macro - @columns = normalize_columns_to_array(columns) - end - - def unique(unique) - @unique = unique - self - end - - def matches?(subject) - @subject = subject - index_exists? && correct_unique? - end - - def failure_message - "Expected #{expectation} (#{@missing})" - end - - def negative_failure_message - "Did not expect #{expectation}" - end - - def description - "have a #{index_type} index on columns #{@columns}" - end - - protected - - def index_exists? - ! matched_index.nil? - end - - def correct_unique? - return true if @unique.nil? - if matched_index.unique == @unique - true - else - @missing = "#{table_name} has an index named #{matched_index.name} " << - "of unique #{matched_index.unique}, not #{@unique}." - false - end - end - - def matched_index - indexes.detect { |each| each.columns == @columns } - end - - def model_class - @subject.class - end - - def table_name - model_class.table_name - end - - def indexes - ::ActiveRecord::Base.connection.indexes(table_name) - end - - def expectation - expected = "#{model_class.name} to #{description}" - end - - def index_type - @unique ? "unique" : "non-unique" - end - - def normalize_columns_to_array(columns) - if columns.class == Array - columns.collect { |each| each.to_s } - else - [columns.to_s] - end - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb deleted file mode 100644 index 576e8ce..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb +++ /dev/null @@ -1,125 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the model has a method named scope_call that returns a - # NamedScope object with the proxy options set to the options you supply. - # scope_call can be either a symbol, or a Ruby expression in a String - # which will be evaled. The eval'd method call has access to all the same - # instance variables that an example would. - # - # Options: - # - # * in_context - Any of the options that the named scope would - # pass on to find. - # - # Example: - # - # it { should have_named_scope(:visible). - # finding(:conditions => {:visible => true}) } - # - # Passes for - # - # named_scope :visible, :conditions => {:visible => true} - # - # Or for - # - # def self.visible - # scoped(:conditions => {:visible => true}) - # end - # - # You can test lambdas or methods that return ActiveRecord#scoped calls: - # - # it { should have_named_scope('recent(5)').finding(:limit => 5) } - # it { should have_named_scope('recent(1)').finding(:limit => 1) } - # - # Passes for - # named_scope :recent, lambda {|c| {:limit => c}} - # - # Or for - # - # def self.recent(c) - # scoped(:limit => c) - # end - # - def have_named_scope(scope_call) - HaveNamedScopeMatcher.new(scope_call).in_context(self) - end - - class HaveNamedScopeMatcher # :nodoc: - - def initialize(scope_call) - @scope_call = scope_call.to_s - end - - def finding(finding) - @finding = finding - self - end - - def in_context(context) - @context = context - self - end - - def matches?(subject) - @subject = subject - call_succeeds? && returns_scope? && finds_correct_scope? - end - - def failure_message - "Expected #{@missing_expectation}" - end - - def negative_failure_message - "Didn't expect a named scope for #{@scope_call}" - end - - def description - result = "have a named scope for #{@scope_call}" - result << " finding #{@finding.inspect}" unless @finding.nil? - result - end - - private - - def call_succeeds? - scope - true - rescue Exception => exception - @missing_expectation = "#{@subject.class.name} " << - "to respond to #{@scope_call} " << - "but raised error: #{exception.inspect}" - false - end - - def scope - @scope ||= @context.instance_eval("#{@subject.class.name}.#{@scope_call}") - end - - def returns_scope? - if ::ActiveRecord::NamedScope::Scope === scope - true - else - @missing_expectation = "#{@scope_call} to return a scope" - false - end - end - - def finds_correct_scope? - return true if @finding.nil? - if @finding == scope.proxy_options - true - else - @missing_expectation = "#{@scope_call} to return results scoped to " - @missing_expectation << "#{@finding.inspect} but was scoped to " - @missing_expectation << scope.proxy_options.inspect - false - end - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb deleted file mode 100644 index de9a2c8..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb +++ /dev/null @@ -1,59 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the attribute cannot be changed once the record has been - # created. - # - # it { should have_readonly_attributes(:password) } - # - def have_readonly_attribute(value) - HaveReadonlyAttributeMatcher.new(value) - end - - class HaveReadonlyAttributeMatcher # :nodoc: - - def initialize(attribute) - @attribute = attribute.to_s - end - - def matches?(subject) - @subject = subject - if readonly_attributes.include?(@attribute) - @negative_failure_message = - "Did not expect #{@attribute} to be read-only" - true - else - if readonly_attributes.empty? - @failure_message = "#{class_name} attribute #{@attribute} " << - "is not read-only" - else - @failure_message = "#{class_name} is making " << - "#{readonly_attributes.to_sentence} " << - "read-only, but not #{@attribute}." - end - false - end - end - - attr_reader :failure_message, :negative_failure_message - - def description - "make #{@attribute} read-only" - end - - private - - def readonly_attributes - @readonly_attributes ||= (@subject.class.readonly_attributes || []) - end - - def class_name - @subject.class.name - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb deleted file mode 100644 index f77da83..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb +++ /dev/null @@ -1,41 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the model cannot be saved the given attribute is not - # accepted. - # - # Options: - # * with_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :accepted. - # - # Example: - # it { should validate_acceptance_of(:eula) } - # - def validate_acceptance_of(attr) - ValidateAcceptanceOfMatcher.new(attr) - end - - class ValidateAcceptanceOfMatcher < ValidationMatcher # :nodoc: - - def with_message(message) - @expected_message = message if message - self - end - - def matches?(subject) - super(subject) - @expected_message ||= :accepted - disallows_value_of(false, @expected_message) - end - - def description - "require #{@attribute} to be accepted" - end - - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb deleted file mode 100644 index 0f6857c..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb +++ /dev/null @@ -1,39 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensure that the attribute is numeric - # - # Options: - # * with_message - value the test expects to find in - # errors.on(:attribute). Regexp or string. Defaults to the - # translation for :not_a_number. - # - # Example: - # it { should validate_numericality_of(:age) } - # - def validate_numericality_of(attr) - ValidateNumericalityOfMatcher.new(attr) - end - - class ValidateNumericalityOfMatcher < ValidationMatcher # :nodoc: - - def with_message(message) - @expected_message = message if message - self - end - - def matches?(subject) - super(subject) - @expected_message ||= :not_a_number - disallows_value_of('abcd', @expected_message) - end - - def description - "only allow numeric values for #{@attribute}" - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb deleted file mode 100644 index ed460c4..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb +++ /dev/null @@ -1,60 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the model is not valid if the given attribute is not - # present. - # - # Options: - # * with_message - value the test expects to find in - # errors.on(:attribute). Regexp or String. - # Defaults to the translation for :blank. - # - # Examples: - # it { should validate_presence_of(:name) } - # it { should validate_presence_of(:name). - # with_message(/is not optional/) } - # - def validate_presence_of(attr) - ValidatePresenceOfMatcher.new(attr) - end - - class ValidatePresenceOfMatcher < ValidationMatcher # :nodoc: - - def with_message(message) - @expected_message = message if message - self - end - - def matches?(subject) - super(subject) - @expected_message ||= :blank - disallows_value_of(blank_value, @expected_message) - end - - def description - "require #{@attribute} to be set" - end - - private - - def blank_value - if collection? - [] - else - nil - end - end - - def collection? - if reflection = @subject.class.reflect_on_association(@attribute) - [:has_many, :has_and_belongs_to_many].include?(reflection.macro) - else - false - end - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb deleted file mode 100644 index 322c77c..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb +++ /dev/null @@ -1,148 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - # Ensures that the model is invalid if the given attribute is not unique. - # - # Internally, this uses values from existing records to test validations, - # so this will always fail if you have not saved at least one record for - # the model being tested, like so: - # - # describe User do - # before(:each) { User.create!(:email => 'address@example.com') } - # it { should validate_uniqueness_of(:email) } - # end - # - # Options: - # - # * with_message - value the test expects to find in - # errors.on(:attribute). Regexp or String. - # Defaults to the translation for :taken. - # * scoped_to - field(s) to scope the uniqueness to. - # * case_insensitive - ensures that the validation does not - # check case. Off by default. Ignored by non-text attributes. - # - # Examples: - # it { should validate_uniqueness_of(:keyword) } - # it { should validate_uniqueness_of(:keyword).with_message(/dup/) } - # it { should validate_uniqueness_of(:email).scoped_to(:name) } - # it { should validate_uniqueness_of(:email). - # scoped_to(:first_name, :last_name) } - # it { should validate_uniqueness_of(:keyword).case_insensitive } - # - def validate_uniqueness_of(attr) - ValidateUniquenessOfMatcher.new(attr) - end - - class ValidateUniquenessOfMatcher < ValidationMatcher # :nodoc: - include Helpers - - def initialize(attribute) - @attribute = attribute - end - - def scoped_to(*scopes) - @scopes = [*scopes].flatten - self - end - - def with_message(message) - @expected_message = message - self - end - - def case_insensitive - @case_insensitive = true - self - end - - def description - result = "require " - result << "case sensitive " unless @case_insensitive - result << "unique value for #{@attribute}" - result << " scoped to #{@scopes.join(', ')}" unless @scopes.blank? - result - end - - def matches?(subject) - @subject = subject.class.new - @expected_message ||= :taken - find_existing && - set_scoped_attributes && - validate_attribute && - validate_after_scope_change - end - - private - - def find_existing - if @existing = @subject.class.find(:first) - true - else - @failure_message = "Can't find first #{class_name}" - false - end - end - - def set_scoped_attributes - unless @scopes.blank? - @scopes.each do |scope| - setter = :"#{scope}=" - unless @subject.respond_to?(setter) - @failure_message = - "#{class_name} doesn't seem to have a #{scope} attribute." - return false - end - @subject.send("#{scope}=", @existing.send(scope)) - end - end - true - end - - def validate_attribute - disallows_value_of(existing_value, @expected_message) - end - - # TODO: There is a chance that we could change the scoped field - # to a value that's already taken. An alternative implementation - # could actually find all values for scope and create a unique - def validate_after_scope_change - if @scopes.blank? - true - else - @scopes.all? do |scope| - previous_value = @existing.send(scope) - - # Assume the scope is a foreign key if the field is nil - previous_value ||= 0 - - next_value = previous_value.next - - @subject.send("#{scope}=", next_value) - - if allows_value_of(existing_value, @expected_message) - @negative_failure_message << - " (with different value of #{scope})" - true - else - @failure_message << " (with different value of #{scope})" - false - end - end - end - end - - def class_name - @subject.class.name - end - - def existing_value - value = @existing.send(@attribute) - value.swapcase! if @case_insensitive && value.respond_to?(:swapcase!) - value - end - end - - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validation_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validation_matcher.rb deleted file mode 100644 index 7faf50c..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validation_matcher.rb +++ /dev/null @@ -1,56 +0,0 @@ -module Shoulda # :nodoc: - module ActiveRecord # :nodoc: - module Matchers - - class ValidationMatcher # :nodoc: - - attr_reader :failure_message - - def initialize(attribute) - @attribute = attribute - end - - def negative_failure_message - @negative_failure_message || @failure_message - end - - def matches?(subject) - @subject = subject - false - end - - private - - def allows_value_of(value, message = nil) - allow = AllowValueMatcher. - new(value). - for(@attribute). - with_message(message) - if allow.matches?(@subject) - @negative_failure_message = allow.failure_message - true - else - @failure_message = allow.negative_failure_message - false - end - end - - def disallows_value_of(value, message = nil) - disallow = AllowValueMatcher. - new(value). - for(@attribute). - with_message(message) - if disallow.matches?(@subject) - @failure_message = disallow.negative_failure_message - false - else - @negative_failure_message = disallow.failure_message - true - end - end - end - - end - end -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb deleted file mode 100644 index 73f31ec..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb +++ /dev/null @@ -1,59 +0,0 @@ -module Shoulda # :nodoc: - module Assertions - # Asserts that two arrays contain the same elements, the same number of times. Essentially ==, but unordered. - # - # assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes - def assert_same_elements(a1, a2, msg = nil) - [:select, :inject, :size].each do |m| - [a1, a2].each {|a| assert_respond_to(a, m, "Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.") } - end - - assert a1h = a1.inject({}) { |h,e| h[e] = a1.select { |i| i == e }.size; h } - assert a2h = a2.inject({}) { |h,e| h[e] = a2.select { |i| i == e }.size; h } - - assert_equal(a1h, a2h, msg) - end - - # Asserts that the given collection contains item x. If x is a regular expression, ensure that - # at least one element from the collection matches x. +extra_msg+ is appended to the error message if the assertion fails. - # - # assert_contains(['a', '1'], /\d/) => passes - # assert_contains(['a', '1'], 'a') => passes - # assert_contains(['a', '1'], /not there/) => fails - def assert_contains(collection, x, extra_msg = "") - collection = [collection] unless collection.is_a?(Array) - msg = "#{x.inspect} not found in #{collection.to_a.inspect} #{extra_msg}" - case x - when Regexp - assert(collection.detect { |e| e =~ x }, msg) - else - assert(collection.include?(x), msg) - end - end - - # Asserts that the given collection does not contain item x. If x is a regular expression, ensure that - # none of the elements from the collection match x. - def assert_does_not_contain(collection, x, extra_msg = "") - collection = [collection] unless collection.is_a?(Array) - msg = "#{x.inspect} found in #{collection.to_a.inspect} " + extra_msg - case x - when Regexp - assert(!collection.detect { |e| e =~ x }, msg) - else - assert(!collection.include?(x), msg) - end - end - - # Asserts that the given matcher returns true when +target+ is passed to #matches? - def assert_accepts(matcher, target) - success = matcher.matches?(target) - assert_block(matcher.failure_message) { success } - end - - # Asserts that the given matcher returns false when +target+ is passed to #matches? - def assert_rejects(matcher, target) - success = !matcher.matches?(target) - assert_block(matcher.negative_failure_message) { success } - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/autoload_macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/autoload_macros.rb deleted file mode 100644 index d815ee3..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/autoload_macros.rb +++ /dev/null @@ -1,46 +0,0 @@ -module Shoulda # :nodoc: - # Call autoload_macros when you want to load test macros automatically in a non-Rails - # project (it's done automatically for Rails projects). - # You don't need to specify ROOT/test/shoulda_macros explicitly. Your custom macros - # are loaded automatically when you call autoload_macros. - # - # The first argument is the path to you application's root directory. - # All following arguments are directories relative to your root, which contain - # shoulda_macros subdirectories. These directories support the same kinds of globs as the - # Dir class. - # - # Basic usage (from a test_helper): - # Shoulda.autoload_macros(File.dirname(__FILE__) + '/..') - # will load everything in - # - your_app/test/shoulda_macros - # - # To load vendored macros as well: - # Shoulda.autoload_macros(APP_ROOT, 'vendor/*') - # will load everything in - # - APP_ROOT/vendor/*/shoulda_macros - # - APP_ROOT/test/shoulda_macros - # - # To load macros in an app with a vendor directory laid out like Rails': - # Shoulda.autoload_macros(APP_ROOT, 'vendor/{plugins,gems}/*') - # or - # Shoulda.autoload_macros(APP_ROOT, 'vendor/plugins/*', 'vendor/gems/*') - # will load everything in - # - APP_ROOT/vendor/plugins/*/shoulda_macros - # - APP_ROOT/vendor/gems/*/shoulda_macros - # - APP_ROOT/test/shoulda_macros - # - # If you prefer to stick testing dependencies away from your production dependencies: - # Shoulda.autoload_macros(APP_ROOT, 'vendor/*', 'test/vendor/*') - # will load everything in - # - APP_ROOT/vendor/*/shoulda_macros - # - APP_ROOT/test/vendor/*/shoulda_macros - # - APP_ROOT/test/shoulda_macros - def self.autoload_macros(root, *dirs) - dirs << File.join('test') - complete_dirs = dirs.map{|d| File.join(root, d, 'shoulda_macros')} - all_files = complete_dirs.inject([]){ |files, dir| files + Dir[File.join(dir, '*.rb')] } - all_files.each do |file| - require file - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb deleted file mode 100644 index 2ee79b9..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb +++ /dev/null @@ -1,304 +0,0 @@ -module Shoulda - class << self - attr_accessor :contexts - def contexts # :nodoc: - @contexts ||= [] - end - - def current_context # :nodoc: - self.contexts.last - end - - def add_context(context) # :nodoc: - self.contexts.push(context) - end - - def remove_context # :nodoc: - self.contexts.pop - end - end - - module ClassMethods - # == Should statements - # - # Should statements are just syntactic sugar over normal Test::Unit test methods. A should block - # contains all the normal code and assertions you're used to seeing, with the added benefit that - # they can be wrapped inside context blocks (see below). - # - # === Example: - # - # class UserTest < Test::Unit::TestCase - # - # def setup - # @user = User.new("John", "Doe") - # end - # - # should "return its full name" - # assert_equal 'John Doe', @user.full_name - # end - # - # end - # - # ...will produce the following test: - # * "test: User should return its full name. " - # - # Note: The part before should in the test name is gleamed from the name of the Test::Unit class. - # - # Should statements can also take a Proc as a :before option. This proc runs after any - # parent context's setups but before the current context's setup. - # - # === Example: - # - # context "Some context" do - # setup { puts("I run after the :before proc") } - # - # should "run a :before proc", :before => lambda { puts("I run before the setup") } do - # assert true - # end - # end - - def should(name, options = {}, &blk) - if Shoulda.current_context - block_given? ? Shoulda.current_context.should(name, options, &blk) : Should.current_context.should_eventually(name) - else - context_name = self.name.gsub(/Test/, "") - context = Shoulda::Context.new(context_name, self) do - block_given? ? should(name, options, &blk) : should_eventually(name) - end - context.build - end - end - - # == Before statements - # - # Before statements are should statements that run before the current - # context's setup. These are especially useful when setting expectations. - # - # === Example: - # - # class UserControllerTest < Test::Unit::TestCase - # context "the index action" do - # setup do - # @users = [Factory(:user)] - # User.stubs(:find).returns(@users) - # end - # - # context "on GET" do - # setup { get :index } - # - # should_respond_with :success - # - # # runs before "get :index" - # before_should "find all users" do - # User.expects(:find).with(:all).returns(@users) - # end - # end - # end - # end - def before_should(name, &blk) - should(name, :before => blk) { assert true } - end - - # Just like should, but never runs, and instead prints an 'X' in the Test::Unit output. - def should_eventually(name, options = {}, &blk) - context_name = self.name.gsub(/Test/, "") - context = Shoulda::Context.new(context_name, self) do - should_eventually(name, &blk) - end - context.build - end - - # == Contexts - # - # A context block groups should statements under a common set of setup/teardown methods. - # Context blocks can be arbitrarily nested, and can do wonders for improving the maintainability - # and readability of your test code. - # - # A context block can contain setup, should, should_eventually, and teardown blocks. - # - # class UserTest < Test::Unit::TestCase - # context "A User instance" do - # setup do - # @user = User.find(:first) - # end - # - # should "return its full name" - # assert_equal 'John Doe', @user.full_name - # end - # end - # end - # - # This code will produce the method "test: A User instance should return its full name. ". - # - # Contexts may be nested. Nested contexts run their setup blocks from out to in before each - # should statement. They then run their teardown blocks from in to out after each should statement. - # - # class UserTest < Test::Unit::TestCase - # context "A User instance" do - # setup do - # @user = User.find(:first) - # end - # - # should "return its full name" - # assert_equal 'John Doe', @user.full_name - # end - # - # context "with a profile" do - # setup do - # @user.profile = Profile.find(:first) - # end - # - # should "return true when sent :has_profile?" - # assert @user.has_profile? - # end - # end - # end - # end - # - # This code will produce the following methods - # * "test: A User instance should return its full name. " - # * "test: A User instance with a profile should return true when sent :has_profile?. " - # - # Just like should statements, a context block can exist next to normal def test_the_old_way; end - # tests. This means you do not have to fully commit to the context/should syntax in a test file. - - def context(name, &blk) - if Shoulda.current_context - Shoulda.current_context.context(name, &blk) - else - context = Shoulda::Context.new(name, self, &blk) - context.build - end - end - end - - class Context # :nodoc: - - attr_accessor :name # my name - attr_accessor :parent # may be another context, or the original test::unit class. - attr_accessor :subcontexts # array of contexts nested under myself - attr_accessor :setup_blocks # blocks given via setup methods - attr_accessor :teardown_blocks # blocks given via teardown methods - attr_accessor :shoulds # array of hashes representing the should statements - attr_accessor :should_eventuallys # array of hashes representing the should eventually statements - - def initialize(name, parent, &blk) - Shoulda.add_context(self) - self.name = name - self.parent = parent - self.setup_blocks = [] - self.teardown_blocks = [] - self.shoulds = [] - self.should_eventuallys = [] - self.subcontexts = [] - - merge_block(&blk) - Shoulda.remove_context - end - - def merge_block(&blk) - blk.bind(self).call - end - - def context(name, &blk) - self.subcontexts << Context.new(name, self, &blk) - end - - def setup(&blk) - self.setup_blocks << blk - end - - def teardown(&blk) - self.teardown_blocks << blk - end - - def should(name, options = {}, &blk) - if block_given? - self.shoulds << { :name => name, :before => options[:before], :block => blk } - else - self.should_eventuallys << { :name => name } - end - end - - def should_eventually(name, &blk) - self.should_eventuallys << { :name => name, :block => blk } - end - - def full_name - parent_name = parent.full_name if am_subcontext? - return [parent_name, name].join(" ").strip - end - - def am_subcontext? - parent.is_a?(self.class) # my parent is the same class as myself. - end - - def test_unit_class - am_subcontext? ? parent.test_unit_class : parent - end - - def create_test_from_should_hash(should) - test_name = ["test:", full_name, "should", "#{should[:name]}. "].flatten.join(' ').to_sym - - if test_unit_class.instance_methods.include?(test_name.to_s) - warn " * WARNING: '#{test_name}' is already defined" - end - - context = self - test_unit_class.send(:define_method, test_name) do - begin - context.run_parent_setup_blocks(self) - should[:before].bind(self).call if should[:before] - context.run_current_setup_blocks(self) - should[:block].bind(self).call - ensure - context.run_all_teardown_blocks(self) - end - end - end - - def run_all_setup_blocks(binding) - run_parent_setup_blocks(binding) - run_current_setup_blocks(binding) - end - - def run_parent_setup_blocks(binding) - self.parent.run_all_setup_blocks(binding) if am_subcontext? - end - - def run_current_setup_blocks(binding) - setup_blocks.each do |setup_block| - setup_block.bind(binding).call - end - end - - def run_all_teardown_blocks(binding) - teardown_blocks.reverse.each do |teardown_block| - teardown_block.bind(binding).call - end - self.parent.run_all_teardown_blocks(binding) if am_subcontext? - end - - def print_should_eventuallys - should_eventuallys.each do |should| - test_name = [full_name, "should", "#{should[:name]}. "].flatten.join(' ') - puts " * DEFERRED: " + test_name - end - end - - def build - shoulds.each do |should| - create_test_from_should_hash(should) - end - - subcontexts.each { |context| context.build } - - print_should_eventuallys - end - - def method_missing(method, *args, &blk) - test_unit_class.send(method, *args, &blk) - end - - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/helpers.rb deleted file mode 100644 index 873e7c7..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/helpers.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Shoulda # :nodoc: - module Helpers - # Prints a message to stdout, tagged with the name of the calling method. - def report!(msg = "") - puts("#{caller.first}: #{msg}") - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/macros.rb deleted file mode 100644 index 7eefb13..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/macros.rb +++ /dev/null @@ -1,73 +0,0 @@ -require 'shoulda/private_helpers' - -module Shoulda # :nodoc: - module Macros - # Macro that creates a test asserting a change between the return value - # of an expression that is run before and after the current setup block - # is run. This is similar to Active Support's assert_difference - # assertion, but supports more than just numeric values. See also - # should_not_change. - # - # Example: - # - # context "Creating a post" do - # setup { Post.create } - # should_change "Post.count", :by => 1 - # end - # - # As shown in this example, the :by option expects a numeric - # difference between the before and after values of the expression. You - # may also specify :from and :to options: - # - # should_change "Post.count", :from => 0, :to => 1 - # should_change "@post.title", :from => "old", :to => "new" - # - # Combinations of :by, :from, and :to are allowed: - # - # should_change "@post.title" # => assert the value changed in some way - # should_change "@post.title", :from => "old" # => assert the value changed to anything other than "old" - # should_change "@post.title", :to => "new" # => assert the value changed from anything other than "new" - def should_change(expression, options = {}) - by, from, to = get_options!([options], :by, :from, :to) - stmt = "change #{expression.inspect}" - stmt << " from #{from.inspect}" if from - stmt << " to #{to.inspect}" if to - stmt << " by #{by.inspect}" if by - - expression_eval = lambda { eval(expression) } - before = lambda { @_before_should_change = expression_eval.bind(self).call } - should stmt, :before => before do - old_value = @_before_should_change - new_value = expression_eval.bind(self).call - assert_operator from, :===, old_value, "#{expression.inspect} did not originally match #{from.inspect}" if from - assert_not_equal old_value, new_value, "#{expression.inspect} did not change" unless by == 0 - assert_operator to, :===, new_value, "#{expression.inspect} was not changed to match #{to.inspect}" if to - assert_equal old_value + by, new_value if by - end - end - - # Macro that creates a test asserting no change between the return value - # of an expression that is run before and after the current setup block - # is run. This is the logical opposite of should_change. - # - # Example: - # - # context "Updating a post" do - # setup { @post.update_attributes(:title => "new") } - # should_not_change "Post.count" - # end - def should_not_change(expression) - expression_eval = lambda { eval(expression) } - before = lambda { @_before_should_not_change = expression_eval.bind(self).call } - should "not change #{expression.inspect}", :before => before do - new_value = expression_eval.bind(self).call - assert_equal @_before_should_not_change, new_value, "#{expression.inspect} changed" - end - end - - private - - include Shoulda::Private - end -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/private_helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/private_helpers.rb deleted file mode 100644 index e579957..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/private_helpers.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Shoulda # :nodoc: - module Private # :nodoc: - # Returns the values for the entries in the args hash who's keys are listed in the wanted array. - # Will raise if there are keys in the args hash that aren't listed. - def get_options!(args, *wanted) - ret = [] - opts = (args.last.is_a?(Hash) ? args.pop : {}) - wanted.each {|w| ret << opts.delete(w)} - raise ArgumentError, "Unsupported options given: #{opts.keys.join(', ')}" unless opts.keys.empty? - return *ret - end - - # Returns the model class constant, as determined by the test class name. - # - # class TestUser; model_class; end => User - def model_class - self.name.gsub(/Test$/, '').constantize - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/proc_extensions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/proc_extensions.rb deleted file mode 100644 index 0d577df..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/proc_extensions.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Stolen straight from ActiveSupport - -class Proc #:nodoc: - def bind(object) - block, time = self, Time.now - (class << object; self end).class_eval do - method_name = "__bind_#{time.to_i}_#{time.usec}" - define_method(method_name, &block) - method = instance_method(method_name) - remove_method(method_name) - method - end.bind(object) - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rails.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rails.rb deleted file mode 100644 index ddb2fcc..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rails.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'rubygems' -require 'active_support' -require 'shoulda' - -require 'shoulda/active_record' if defined? ActiveRecord::Base -require 'shoulda/action_controller' if defined? ActionController::Base -require 'shoulda/action_view' if defined? ActionView::Base -require 'shoulda/action_mailer' if defined? ActionMailer::Base - -if defined?(RAILS_ROOT) - # load in the 3rd party macros from vendorized plugins and gems - Shoulda.autoload_macros RAILS_ROOT, File.join("vendor", "{plugins,gems}", "*") -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rspec.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rspec.rb deleted file mode 100644 index ef636ab..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rspec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'shoulda/active_record/matchers' -require 'shoulda/action_controller/matchers' -require 'active_support/test_case' - -# :enddoc: -module ActiveSupport - class TestCase - include Shoulda::ActiveRecord::Matchers - include Shoulda::ActionController::Matchers - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks.rb deleted file mode 100644 index b59c89e..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks.rb +++ /dev/null @@ -1,3 +0,0 @@ -Dir[File.join(File.dirname(__FILE__), 'tasks', '*.rake')].each do |f| - load f -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/list_tests.rake b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/list_tests.rake deleted file mode 100644 index 521daf2..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/list_tests.rake +++ /dev/null @@ -1,29 +0,0 @@ -namespace :shoulda do - desc "List the names of the test methods in a specification like format" - task :list do - $LOAD_PATH.unshift("test") - - require 'test/unit' - require 'rubygems' - require 'active_support' - - # bug in test unit. Set to true to stop from running. - Test::Unit.run = true - - test_files = Dir.glob(File.join('test', '**', '*_test.rb')) - test_files.each do |file| - load file - klass = File.basename(file, '.rb').classify - unless Object.const_defined?(klass.to_s) - puts "Skipping #{klass} because it doesn't map to a Class" - next - end - klass = klass.constantize - - puts klass.name.gsub('Test', '') - - test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort - test_methods.each {|m| puts " " + m } - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/yaml_to_shoulda.rake b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/yaml_to_shoulda.rake deleted file mode 100644 index 8303011..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/yaml_to_shoulda.rake +++ /dev/null @@ -1,28 +0,0 @@ -namespace :shoulda do - # From http://blog.internautdesign.com/2007/11/2/a-yaml_to_shoulda-rake-task - # David.Lowenfels@gmail.com - desc "Converts a YAML file (FILE=./path/to/yaml) into a Shoulda skeleton" - task :from_yaml do - require 'yaml' - - def yaml_to_context(hash, indent = 0) - indent1 = ' ' * indent - indent2 = ' ' * (indent + 1) - hash.each_pair do |context, shoulds| - puts indent1 + "context \"#{context}\" do" - puts - shoulds.each do |should| - yaml_to_context( should, indent + 1 ) and next if should.is_a?( Hash ) - puts indent2 + "should_eventually \"" + should.gsub(/^should +/,'') + "\" do" - puts indent2 + "end" - puts - end - puts indent1 + "end" - end - end - - puts("Please pass in a FILE argument.") and exit unless ENV['FILE'] - - yaml_to_context( YAML.load_file( ENV['FILE'] ) ) - end -end \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/test_unit.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/test_unit.rb deleted file mode 100644 index 1caa430..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/test_unit.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'shoulda/context' -require 'shoulda/proc_extensions' -require 'shoulda/assertions' -require 'shoulda/macros' -require 'shoulda/helpers' -require 'shoulda/autoload_macros' -require 'shoulda/rails' if defined? RAILS_ROOT - -module Test # :nodoc: all - module Unit - class TestCase - extend Shoulda::ClassMethods - include Shoulda::Assertions - extend Shoulda::Macros - include Shoulda::Helpers - end - end -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/rails/init.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/rails/init.rb deleted file mode 100644 index 3f683d8..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/rails/init.rb +++ /dev/null @@ -1,7 +0,0 @@ -if RAILS_ENV == 'test' - if defined? Spec - require 'shoulda/rspec' - else - require 'shoulda/rails' - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/README b/vendor/gems/thoughtbot-shoulda-2.10.1/test/README deleted file mode 100644 index 12a996c..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/README +++ /dev/null @@ -1,36 +0,0 @@ -The Shoulda test suite (in particular - the tests that test shoulda) - -Quick overview: - -The test directory contains the following files and subdirectories: - -* rails_root - contains the stripped down rails application that the tests run against. The rails root contains: -** the models, controllers, and views defined under app/ -** the test.rb environment file -** a migration file for each model -** a shoulda initializer that simulates loading the plugin but without relying on vendor/plugins -* fixtures - contain the sample DB data for each model -* functional - controller tests for each of the controllers under rails_root/app -* unit - model tests for each of the models under rails_root/app -* other - tests for the shoulda contexts, should statements, and assertions -* test_helper.rb - responsible for initializing the test environment -** sets the rails_env to test -** sets the rails_root -** runs all the migrations against the in-memory sqlite3 db -** adds some magic to load the right fixture files - -In order to add a new model (or controller) to the test suite: - -* add that model to rails_root/app/models -* add a migration for that model -* add a fixture file -* add a test for that file under test/units - -Dependencies: - -* Rails gem installed in the host system -* A working sqlite3 installation. - -If you have problems running these tests, please notify the mailing list: shoulda@googlegroups.com - -- Tammer Saleh diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fail_macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fail_macros.rb deleted file mode 100644 index 408cdf1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fail_macros.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Shoulda - class << self - attr_accessor :expected_exceptions - end - - module ClassMethods - # Enables the core shoulda test suite to test for failure scenarios. For - # example, to ensure that a set of test macros should fail, do this: - # - # should_fail do - # should_validate_presence_of :comments - # should_not_allow_mass_assignment_of :name - # end - def should_fail(&block) - context "should fail when trying to run:" do - Shoulda.expected_exceptions = [Test::Unit::AssertionFailedError] - yield block - Shoulda.expected_exceptions = nil - end - end - end - - class Context - # alias_method_chain hack to allow the should_fail macro to work - def should_with_failure_scenario(name, options = {}, &block) - if Shoulda.expected_exceptions - expected_exceptions = Shoulda.expected_exceptions - failure_block = lambda { assert_raise(*expected_exceptions, &block.bind(self)) } - end - should_without_failure_scenario(name, options, &(failure_block || block)) - end - alias_method_chain :should, :failure_scenario - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/addresses.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/addresses.yml deleted file mode 100644 index 3b468e5..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/addresses.yml +++ /dev/null @@ -1,3 +0,0 @@ -first: - title: Home - addressable: first (User) diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/friendships.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/friendships.yml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/posts.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/posts.yml deleted file mode 100644 index f5cd7b6..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/posts.yml +++ /dev/null @@ -1,5 +0,0 @@ -first: - id: 1 - title: My Cute Kitten! - body: This is totally a cute kitten - user_id: 1 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/products.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/products.yml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/taggings.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/taggings.yml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/tags.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/tags.yml deleted file mode 100644 index 3ef6292..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/tags.yml +++ /dev/null @@ -1,9 +0,0 @@ -first: - id: 1 - name: Stuff -second: - id: 2 - name: Rails -third: - id: 3 - name: Nothing \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/users.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/users.yml deleted file mode 100644 index 6242a63..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/users.yml +++ /dev/null @@ -1,6 +0,0 @@ -first: - id: 1 - name: Some dude - age: 2 - email: none@none.com - ssn: 123456789 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/posts_controller_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/posts_controller_test.rb deleted file mode 100644 index 796492b..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/posts_controller_test.rb +++ /dev/null @@ -1,125 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require 'posts_controller' - -# Re-raise errors caught by the controller. -class PostsController; def rescue_action(e) raise e end; end - -class PostsControllerTest < Test::Unit::TestCase - fixtures :all - - def setup - @controller = PostsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @post = Post.find(:first) - end - - # autodetects the :controller - should_route :get, '/posts', :action => :index - # explicitly specify :controller - should_route :post, '/posts', :controller => :posts, :action => :create - # non-string parameter - should_route :get, '/posts/1', :action => :show, :id => 1 - # string-parameter - should_route :put, '/posts/1', :action => :update, :id => "1" - should_route :delete, '/posts/1', :action => :destroy, :id => 1 - should_route :get, '/posts/new', :action => :new - - # Test the nested routes - should_route :get, '/users/5/posts', :action => :index, :user_id => 5 - should_route :post, '/users/5/posts', :action => :create, :user_id => 5 - should_route :get, '/users/5/posts/1', :action => :show, :id => 1, :user_id => 5 - should_route :delete, '/users/5/posts/1', :action => :destroy, :id => 1, :user_id => 5 - should_route :get, '/users/5/posts/new', :action => :new, :user_id => 5 - should_route :put, '/users/5/posts/1', :action => :update, :id => 1, :user_id => 5 - - context "Logged in" do - setup do - @request.session[:logged_in] = true - end - - context "viewing posts for a user" do - setup do - get :index, :user_id => users(:first) - end - should_respond_with :success - should_assign_to :user, :class => User, :equals => 'users(:first)' - should_assign_to(:user) { users(:first) } - should_fail do - should_assign_to :user, :class => Post - end - should_fail do - should_assign_to :user, :equals => 'posts(:first)' - end - should_fail do - should_assign_to(:user) { posts(:first) } - end - should_assign_to :posts - should_not_assign_to :foo, :bar - should_render_page_with_metadata :description => /Posts/, :title => /index/ - should_render_page_with_metadata :keywords => "posts" - end - - context "viewing posts for a user with rss format" do - setup do - get :index, :user_id => users(:first), :format => 'rss' - @user = users(:first) - end - should_respond_with :success - should_respond_with_content_type 'application/rss+xml' - should_respond_with_content_type :rss - should_respond_with_content_type /rss/ - context "deprecated" do # to avoid redefining a test - should_return_from_session :special, "'$2 off your next purchase'" - end - should_fail do - should_return_from_session :special, "'not special'" - end - should_set_session(:mischief) { nil } - should_return_from_session :malarky, "nil" - should_set_session :special, "'$2 off your next purchase'" - should_set_session :special_user_id, '@user.id' - context "with a block" do - should_set_session(:special_user_id) { @user.id } - end - should_fail do # to avoid redefining a test - should_set_session(:special_user_id) { 'value' } - end - should_assign_to :user, :posts - should_not_assign_to :foo, :bar - end - - context "viewing a post on GET to #show" do - setup { get :show, :user_id => users(:first), :id => posts(:first) } - should_render_with_layout 'wide' - context "with a symbol" do # to avoid redefining a test - should_render_with_layout :wide - end - should_assign_to :false_flag - end - - context "on GET to #new" do - setup { get :new, :user_id => users(:first) } - should_render_without_layout - end - - context "on POST to #create" do - setup do - post :create, :user_id => users(:first), - :post => { :title => "first post", - :body => 'blah blah blah' } - end - - should_redirect_to 'user_post_url(@post.user, @post)' - should_redirect_to('the created post') { user_post_url(users(:first), - assigns(:post)) } - should_fail do - should_redirect_to 'user_posts_url(@post.user)' - end - should_fail do - should_redirect_to('elsewhere') { user_posts_url(users(:first)) } - end - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/users_controller_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/users_controller_test.rb deleted file mode 100644 index cd0205f..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/users_controller_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require 'users_controller' - -# Re-raise errors caught by the controller. -class UsersController; def rescue_action(e) raise e end; end - -class UsersControllerTest < Test::Unit::TestCase - fixtures :all - - def setup - @controller = UsersController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @user = User.find(:first) - end - - should_filter_params :ssn - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb deleted file mode 100644 index 5b12726..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb +++ /dev/null @@ -1,68 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class AllowMassAssignmentOfMatcherTest < Test::Unit::TestCase # :nodoc: - - context "an attribute that is blacklisted from mass-assignment" do - setup do - define_model :example, :attr => :string do - attr_protected :attr - end - @model = Example.new - end - - should "reject being mass-assignable" do - assert_rejects allow_mass_assignment_of(:attr), @model - end - end - - context "an attribute that is not whitelisted for mass-assignment" do - setup do - define_model :example, :attr => :string, :other => :string do - attr_accessible :other - end - @model = Example.new - end - - should "reject being mass-assignable" do - assert_rejects allow_mass_assignment_of(:attr), @model - end - end - - context "an attribute that is whitelisted for mass-assignment" do - setup do - define_model :example, :attr => :string do - attr_accessible :attr - end - @model = Example.new - end - - should "accept being mass-assignable" do - assert_accepts allow_mass_assignment_of(:attr), @model - end - end - - context "an attribute not included in the mass-assignment blacklist" do - setup do - define_model :example, :attr => :string, :other => :string do - attr_protected :other - end - @model = Example.new - end - - should "accept being mass-assignable" do - assert_accepts allow_mass_assignment_of(:attr), @model - end - end - - context "an attribute on a class with no protected attributes" do - setup do - define_model :example, :attr => :string - @model = Example.new - end - - should "accept being mass-assignable" do - assert_accepts allow_mass_assignment_of(:attr), @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_value_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_value_matcher_test.rb deleted file mode 100644 index 11fcc56..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_value_matcher_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class AllowValueMatcherTest < Test::Unit::TestCase # :nodoc: - - context "an attribute with a format validation" do - setup do - define_model :example, :attr => :string do - validates_format_of :attr, :with => /abc/ - end - @model = Example.new - end - - should "allow a good value" do - assert_accepts allow_value("abcde").for(:attr), @model - end - - should "not allow a bad value" do - assert_rejects allow_value("xyz").for(:attr), @model - end - end - - context "an attribute with a format validation and a custom message" do - setup do - define_model :example, :attr => :string do - validates_format_of :attr, :with => /abc/, :message => 'bad value' - end - @model = Example.new - end - - should "allow a good value" do - assert_accepts allow_value('abcde').for(:attr).with_message(/bad/), - @model - end - - should "not allow a bad value" do - assert_rejects allow_value('xyz').for(:attr).with_message(/bad/), - @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/association_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/association_matcher_test.rb deleted file mode 100644 index 703537e..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/association_matcher_test.rb +++ /dev/null @@ -1,258 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class AssociationMatcherTest < Test::Unit::TestCase # :nodoc: - - context "belong_to" do - setup do - @matcher = belong_to(:parent) - end - - should "accept a good association with the default foreign key" do - define_model :parent - define_model :child, :parent_id => :integer do - belongs_to :parent - end - assert_accepts @matcher, Child.new - end - - should "reject a nonexistent association" do - define_model :child - assert_rejects @matcher, Child.new - end - - should "reject an association of the wrong type" do - define_model :parent, :child_id => :integer - child_class = define_model :child do - has_one :parent - end - assert_rejects @matcher, Child.new - end - - should "reject an association that has a nonexistent foreign key" do - define_model :parent - define_model :child do - belongs_to :parent - end - assert_rejects @matcher, Child.new - end - - should "accept an association with an existing custom foreign key" do - define_model :parent - define_model :child, :guardian_id => :integer do - belongs_to :parent, :foreign_key => 'guardian_id' - end - assert_accepts @matcher, Child.new - end - - should "accept a polymorphic association" do - define_model :child, :parent_type => :string, - :parent_id => :integer do - belongs_to :parent, :polymorphic => true - end - assert_accepts @matcher, Child.new - end - - should "accept an association with a valid :dependent option" do - define_model :parent - define_model :child, :parent_id => :integer do - belongs_to :parent, :dependent => :destroy - end - assert_accepts @matcher.dependent(:destroy), Child.new - end - - should "reject an association with a bad :dependent option" do - define_model :parent - define_model :child, :parent_id => :integer do - belongs_to :parent - end - assert_rejects @matcher.dependent(:destroy), Child.new - end - end - - context "have_many" do - setup do - @matcher = have_many(:children) - end - - should "accept a valid association without any options" do - define_model :child, :parent_id => :integer - define_model :parent do - has_many :children - end - assert_accepts @matcher, Parent.new - end - - should "accept a valid association with a :through option" do - define_model :child - define_model :conception, :child_id => :integer, - :parent_id => :integer do - belongs_to :child - end - define_model :parent do - has_many :conceptions - has_many :children, :through => :conceptions - end - assert_accepts @matcher, Parent.new - end - - should "accept a valid association with an :as option" do - define_model :child, :guardian_type => :string, - :guardian_id => :integer - define_model :parent do - has_many :children, :as => :guardian - end - assert_accepts @matcher, Parent.new - end - - should "reject an association that has a nonexistent foreign key" do - define_model :child - define_model :parent do - has_many :children - end - assert_rejects @matcher, Parent.new - end - - should "reject an association with a bad :as option" do - define_model :child, :caretaker_type => :string, - :caretaker_id => :integer - define_model :parent do - has_many :children, :as => :guardian - end - assert_rejects @matcher, Parent.new - end - - should "reject an association that has a bad :through option" do - define_model :child, :parent_id => :integer - define_model :parent do - has_many :children - end - assert_rejects @matcher.through(:conceptions), Parent.new - end - - should "reject an association that has the wrong :through option" do - define_model :child - define_model :conception, :child_id => :integer, - :parent_id => :integer do - belongs_to :child - end - define_model :parent do - has_many :conceptions - has_many :children, :through => :conceptions - end - assert_rejects @matcher.through(:relationships), Parent.new - end - - should "accept an association with a valid :dependent option" do - define_model :child, :parent_id => :integer - define_model :parent do - has_many :children, :dependent => :destroy - end - assert_accepts @matcher.dependent(:destroy), Parent.new - end - - should "reject an association with a bad :dependent option" do - define_model :child, :parent_id => :integer - define_model :parent do - has_many :children - end - assert_rejects @matcher.dependent(:destroy), Parent.new - end - end - - context "have_one" do - setup do - @matcher = have_one(:profile) - end - - should "accept a valid association without any options" do - define_model :profile, :person_id => :integer - define_model :person do - has_one :profile - end - assert_accepts @matcher, Person.new - end - - should "accept a valid association with an :as option" do - define_model :profile, :profilable_id => :integer, - :profilable_type => :string - define_model :person do - has_one :profile, :as => :profilable - end - assert_accepts @matcher, Person.new - end - - should "reject an association that has a nonexistent foreign key" do - define_model :profile - define_model :person do - has_one :profile - end - assert_rejects @matcher, Person.new - end - - should "reject an association with a bad :as option" do - define_model :profile, :profilable_id => :integer, - :profilable_type => :string - define_model :person do - has_one :profile, :as => :describable - end - assert_rejects @matcher, Person.new - end - - should "accept an association with a valid :dependent option" do - define_model :profile, :person_id => :integer - define_model :person do - has_one :profile, :dependent => :destroy - end - assert_accepts @matcher.dependent(:destroy), Person.new - end - - should "reject an association with a bad :dependent option" do - define_model :profile, :person_id => :integer - define_model :person do - has_one :profile - end - assert_rejects @matcher.dependent(:destroy), Person.new - end - end - - context "have_and_belong_to_many" do - setup do - @matcher = have_and_belong_to_many(:relatives) - end - - should "accept a valid association" do - define_model :relatives - define_model :person do - has_and_belongs_to_many :relatives - end - define_model :people_relative, :person_id => :integer, - :relative_id => :integer - assert_accepts @matcher, Person.new - end - - should "reject a nonexistent association" do - define_model :relatives - define_model :person - define_model :people_relative, :person_id => :integer, - :relative_id => :integer - assert_rejects @matcher, Person.new - end - - should "reject an association with a nonexistent join table" do - define_model :relatives - define_model :person do - has_and_belongs_to_many :relatives - end - assert_rejects @matcher, Person.new - end - - should "reject an association of the wrong type" do - define_model :relatives, :person_id => :integer - define_model :person do - has_many :relatives - end - assert_rejects @matcher, Person.new - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb deleted file mode 100644 index bb0b45f..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb +++ /dev/null @@ -1,80 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class EnsureInclusionOfMatcherTest < Test::Unit::TestCase # :nodoc: - - context "an attribute which must be included in a range" do - setup do - @model = define_model(:example, :attr => :integer) do - validates_inclusion_of :attr, :in => 2..5 - end.new - end - - should "accept ensuring the correct range" do - assert_accepts ensure_inclusion_of(:attr).in_range(2..5), @model - end - - should "reject ensuring a lower minimum value" do - assert_rejects ensure_inclusion_of(:attr).in_range(1..5), @model - end - - should "reject ensuring a higher minimum value" do - assert_rejects ensure_inclusion_of(:attr).in_range(3..5), @model - end - - should "reject ensuring a lower maximum value" do - assert_rejects ensure_inclusion_of(:attr).in_range(2..4), @model - end - - should "reject ensuring a higher maximum value" do - assert_rejects ensure_inclusion_of(:attr).in_range(2..6), @model - end - - should "not override the default message with a blank" do - assert_accepts ensure_inclusion_of(:attr). - in_range(2..5). - with_message(nil), - @model - end - end - - context "an attribute with a custom ranged value validation" do - setup do - @model = define_model(:example, :attr => :string) do - validates_inclusion_of :attr, :in => 2..4, :message => 'not good' - - end.new - end - - should "accept ensuring the correct range" do - assert_accepts ensure_inclusion_of(:attr). - in_range(2..4). - with_message(/not good/), - @model - end - end - - context "an attribute with custom range validations" do - setup do - define_model :example, :attr => :integer do - def validate - if attr < 2 - errors.add(:attr, 'too low') - elsif attr > 5 - errors.add(:attr, 'too high') - end - end - end - @model = Example.new - end - - should "accept ensuring the correct range and messages" do - assert_accepts ensure_inclusion_of(:attr). - in_range(2..5). - with_low_message(/low/). - with_high_message(/high/), - @model - end - - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_length_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_length_of_matcher_test.rb deleted file mode 100644 index a41d5f0..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_length_of_matcher_test.rb +++ /dev/null @@ -1,158 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class EnsureLengthOfMatcher < Test::Unit::TestCase # :nodoc: - - context "an attribute with a non-zero minimum length validation" do - setup do - @model = define_model(:example, :attr => :string) do - validates_length_of :attr, :minimum => 4 - end.new - end - - should "accept ensuring the correct minimum length" do - assert_accepts ensure_length_of(:attr).is_at_least(4), @model - end - - should "reject ensuring a lower minimum length with any message" do - assert_rejects ensure_length_of(:attr). - is_at_least(3). - with_short_message(/.*/), - @model - end - - should "reject ensuring a higher minimum length with any message" do - assert_rejects ensure_length_of(:attr). - is_at_least(5). - with_short_message(/.*/), - @model - end - - should "not override the default message with a blank" do - assert_accepts ensure_length_of(:attr). - is_at_least(4). - with_short_message(nil), - @model - end - end - - context "an attribute with a minimum length validation of 0" do - setup do - @model = define_model(:example, :attr => :string) do - validates_length_of :attr, :minimum => 0 - end.new - end - - should "accept ensuring the correct minimum length" do - assert_accepts ensure_length_of(:attr).is_at_least(0), @model - end - end - - context "an attribute with a maximum length" do - setup do - @model = define_model(:example, :attr => :string) do - validates_length_of :attr, :maximum => 4 - end.new - end - - should "accept ensuring the correct maximum length" do - assert_accepts ensure_length_of(:attr).is_at_most(4), @model - end - - should "reject ensuring a lower maximum length with any message" do - assert_rejects ensure_length_of(:attr). - is_at_most(3). - with_long_message(/.*/), - @model - end - - should "reject ensuring a higher maximum length with any message" do - assert_rejects ensure_length_of(:attr). - is_at_most(5). - with_long_message(/.*/), - @model - end - - should "not override the default message with a blank" do - assert_accepts ensure_length_of(:attr). - is_at_most(4). - with_long_message(nil), - @model - end - end - - context "an attribute with a required exact length" do - setup do - @model = define_model(:example, :attr => :string) do - validates_length_of :attr, :is => 4 - end.new - end - - should "accept ensuring the correct length" do - assert_accepts ensure_length_of(:attr).is_equal_to(4), @model - end - - should "reject ensuring a lower maximum length with any message" do - assert_rejects ensure_length_of(:attr). - is_equal_to(3). - with_message(/.*/), - @model - end - - should "reject ensuring a higher maximum length with any message" do - assert_rejects ensure_length_of(:attr). - is_equal_to(5). - with_message(/.*/), - @model - end - - should "not override the default message with a blank" do - assert_accepts ensure_length_of(:attr). - is_equal_to(4). - with_message(nil), - @model - end - end - - context "an attribute with a custom minimum length validation" do - setup do - @model = define_model(:example, :attr => :string) do - validates_length_of :attr, :minimum => 4, :too_short => 'short' - end.new - end - - should "accept ensuring the correct minimum length" do - assert_accepts ensure_length_of(:attr). - is_at_least(4). - with_short_message(/short/), - @model - end - - end - - context "an attribute with a custom maximum length validation" do - setup do - @model = define_model(:example, :attr => :string) do - validates_length_of :attr, :maximum => 4, :too_long => 'long' - end.new - end - - should "accept ensuring the correct minimum length" do - assert_accepts ensure_length_of(:attr). - is_at_most(4). - with_long_message(/long/), - @model - end - - end - - context "an attribute without a length validation" do - setup do - @model = define_model(:example, :attr => :string).new - end - - should "reject ensuring a minimum length" do - assert_rejects ensure_length_of(:attr).is_at_least(1), @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_db_column_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_db_column_matcher_test.rb deleted file mode 100644 index 5afeeec..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_db_column_matcher_test.rb +++ /dev/null @@ -1,169 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class HaveDbColumnMatcherTest < Test::Unit::TestCase # :nodoc: - - context "have_db_column" do - setup do - @matcher = have_db_column(:nickname) - end - - should "accept an existing database column" do - create_table 'superheros' do |table| - table.string :nickname - end - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a nonexistent database column" do - define_model :superhero - assert_rejects @matcher, Superhero.new - end - end - - context "have_db_column of type string" do - setup do - @matcher = have_db_column(:nickname).of_type(:string) - end - - should "accept a column of correct type" do - create_table 'superheros' do |table| - table.string :nickname - end - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a nonexistent database column" do - define_model :superhero - assert_rejects @matcher, Superhero.new - end - - should "reject a column of wrong type" do - create_table 'superheros' do |table| - table.integer :nickname - end - define_model_class 'Superhero' - assert_rejects @matcher, Superhero.new - end - end - - context "have_db_column with precision option" do - setup do - @matcher = have_db_column(:salary).with_options(:precision => 5) - end - - should "accept a column of correct precision" do - create_table 'superheros' do |table| - table.decimal :salary, :precision => 5 - end - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a column of wrong precision" do - create_table 'superheros' do |table| - table.decimal :salary, :precision => 15 - end - define_model_class 'Superhero' - assert_rejects @matcher, Superhero.new - end - end - - context "have_db_column with limit option" do - setup do - @matcher = have_db_column(:email). - of_type(:string). - with_options(:limit => 255) - end - - should "accept a column of correct limit" do - create_table 'superheros' do |table| - table.string :email, :limit => 255 - end - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a column of wrong limit" do - create_table 'superheros' do |table| - table.string :email, :limit => 500 - end - define_model_class 'Superhero' - assert_rejects @matcher, Superhero.new - end - end - - context "have_db_column with default option" do - setup do - @matcher = have_db_column(:admin). - of_type(:boolean). - with_options(:default => false) - end - - should "accept a column of correct default" do - create_table 'superheros' do |table| - table.boolean :admin, :default => false - end - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a column of wrong default" do - create_table 'superheros' do |table| - table.boolean :admin, :default => true - end - define_model_class 'Superhero' - assert_rejects @matcher, Superhero.new - end - end - - context "have_db_column with null option" do - setup do - @matcher = have_db_column(:admin). - of_type(:boolean). - with_options(:null => false) - end - - should "accept a column of correct null" do - create_table 'superheros' do |table| - table.boolean :admin, :null => false - end - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a column of wrong null" do - create_table 'superheros' do |table| - table.boolean :admin, :null => true - end - define_model_class 'Superhero' - assert_rejects @matcher, Superhero.new - end - end - - context "have_db_column with scale option" do - setup do - @matcher = have_db_column(:salary). - of_type(:decimal). - with_options(:scale => 2) - end - - should "accept a column of correct scale" do - create_table 'superheros' do |table| - table.decimal :salary, :precision => 10, :scale => 2 - end - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a column of wrong scale" do - create_table 'superheros' do |table| - table.decimal :salary, :precision => 10, :scale => 4 - end - define_model_class 'Superhero' - assert_rejects @matcher, Superhero.new - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_index_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_index_matcher_test.rb deleted file mode 100644 index a7cea9f..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_index_matcher_test.rb +++ /dev/null @@ -1,74 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class HaveIndexMatcherTest < Test::Unit::TestCase # :nodoc: - - context "have_index" do - setup do - @matcher = have_index(:age) - end - - should "accept an existing index" do - db_connection = create_table 'superheros' do |table| - table.integer :age - end - db_connection.add_index :superheros, :age - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject a nonexistent index" do - define_model :superhero - assert_rejects @matcher, Superhero.new - end - end - - context "have_index with unique option" do - setup do - @matcher = have_index(:ssn).unique(true) - end - - should "accept an index of correct unique" do - db_connection = create_table 'superheros' do |table| - table.integer :ssn - end - db_connection.add_index :superheros, :ssn, :unique => true - define_model_class 'Superhero' - assert_accepts @matcher, Superhero.new - end - - should "reject an index of wrong unique" do - db_connection = create_table 'superheros' do |table| - table.integer :ssn - end - db_connection.add_index :superheros, :ssn, :unique => false - define_model_class 'Superhero' - assert_rejects @matcher, Superhero.new - end - end - - context "have_index on multiple columns" do - setup do - @matcher = have_index([:geocodable_type, :geocodable_id]) - end - - should "accept an existing index" do - db_connection = create_table 'geocodings' do |table| - table.integer :geocodable_id - table.string :geocodable_type - end - db_connection.add_index :geocodings, [:geocodable_type, :geocodable_id] - define_model_class 'Geocoding' - assert_accepts @matcher, Geocoding.new - end - - should "reject a nonexistant index" do - db_connection = create_table 'geocodings' do |table| - table.integer :geocodable_id - table.string :geocodable_type - end - define_model_class 'Geocoding' - assert_rejects @matcher, Geocoding.new - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_named_scope_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_named_scope_matcher_test.rb deleted file mode 100644 index 2e9ecb5..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_named_scope_matcher_test.rb +++ /dev/null @@ -1,65 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class HaveNamedScopeMatcherTest < Test::Unit::TestCase # :nodoc: - - context "an attribute with a named scope" do - setup do - define_model :example, :attr => :string do - named_scope :xyz, lambda {|n| - { :order => :attr } - } - end - @model = Example.new - end - - should "accept having a scope with the correct signature" do - assert_accepts have_named_scope("xyz(1)"), @model - end - - should "accept having a scope with the correct signature and find options" do - assert_accepts have_named_scope("xyz(1)").finding(:order => :attr), @model - end - - should "reject having a scope with incorrect find options" do - assert_rejects have_named_scope("xyz(1)"). - finding(:order => 'attr DESC'), - @model - end - - should "reject having a scope with another name" do - assert_rejects have_named_scope("abc(1)"), @model - end - - end - - should "evaluate the scope in the correct context" do - define_model :example, :attr => :string do - named_scope :xyz, lambda {|n| - { :order => n } - } - end - model = Example.new - @order = :attr - assert_accepts have_named_scope("xyz(@order)"). - finding(:order => @order). - in_context(self), - model - end - - context "a method that does not return a scope" do - setup do - klass = Class.new - klass.class_eval do - def self.xyz - 'xyz' - end - end - @model = klass.new - end - - should "reject having a named scope with that name" do - assert_rejects have_named_scope(:xyz), @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_readonly_attributes_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_readonly_attributes_matcher_test.rb deleted file mode 100644 index 81a47c8..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_readonly_attributes_matcher_test.rb +++ /dev/null @@ -1,29 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class HaveReadonlyAttributesMatcherTest < Test::Unit::TestCase # :nodoc: - - context "an attribute that cannot be set after being saved" do - setup do - define_model :example, :attr => :string do - attr_readonly :attr - end - @model = Example.new - end - - should "accept being read-only" do - assert_accepts have_readonly_attribute(:attr), @model - end - end - - context "an attribute that can be set after being saved" do - setup do - define_model :example, :attr => :string - @model = Example.new - end - - should "accept being read-only" do - assert_rejects have_readonly_attribute(:attr), @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_acceptance_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_acceptance_of_matcher_test.rb deleted file mode 100644 index d19d5ff..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_acceptance_of_matcher_test.rb +++ /dev/null @@ -1,44 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class ValidateAcceptanceOfMatcherTest < Test::Unit::TestCase # :nodoc: - - context "an attribute which must be accepted" do - setup do - @model = define_model(:example) do - validates_acceptance_of :attr - end.new - end - - should "require that attribute to be accepted" do - assert_accepts validate_acceptance_of(:attr), @model - end - - should "not overwrite the default message with nil" do - assert_accepts validate_acceptance_of(:attr).with_message(nil), @model - end - end - - context "an attribute that does not need to be accepted" do - setup do - @model = define_model(:example, :attr => :string).new - end - - should "not require that attribute to be accepted" do - assert_rejects validate_acceptance_of(:attr), @model - end - end - - context "an attribute which must be accepted with a custom message" do - setup do - @model = define_model(:example) do - validates_acceptance_of :attr, :message => 'custom' - end.new - end - - should "require that attribute to be accepted with that message" do - assert_accepts validate_acceptance_of(:attr).with_message(/custom/), - @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_numericality_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_numericality_of_matcher_test.rb deleted file mode 100644 index f9ab3a1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_numericality_of_matcher_test.rb +++ /dev/null @@ -1,52 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class ValidateNumericalityOfMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a numeric attribute" do - setup do - define_model :example, :attr => :string do - validates_numericality_of :attr - end - @model = Example.new - end - - should "only allow numeric values for that attribute" do - assert_accepts validate_numericality_of(:attr), @model - end - - should "not override the default message with a blank" do - assert_accepts validate_numericality_of(:attr).with_message(nil), - @model - end - end - - context "a numeric attribute with a custom validation message" do - setup do - define_model :example, :attr => :string do - validates_numericality_of :attr, :message => 'custom' - end - @model = Example.new - end - - should "only allow numeric values for that attribute with that message" do - assert_accepts validate_numericality_of(:attr). - with_message(/custom/), - @model - end - - should "not allow numeric values for that attribute with another message" do - assert_rejects validate_numericality_of(:attr), @model - end - end - - context "a non-numeric attribute" do - setup do - @model = define_model(:example, :attr => :string).new - end - - should "not only allow numeric values for that attribute" do - assert_rejects validate_numericality_of(:attr), @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_presence_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_presence_of_matcher_test.rb deleted file mode 100644 index f59440a..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_presence_of_matcher_test.rb +++ /dev/null @@ -1,86 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class ValidatePresenceOfMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a required attribute" do - setup do - define_model :example, :attr => :string do - validates_presence_of :attr - end - @model = Example.new - end - - should "require a value" do - assert_accepts validate_presence_of(:attr), @model - end - - should "not override the default message with a blank" do - assert_accepts validate_presence_of(:attr).with_message(nil), @model - end - end - - context "an optional attribute" do - setup do - @model = define_model(:example, :attr => :string).new - end - - should "not require a value" do - assert_rejects validate_presence_of(:attr), @model - end - end - - context "a required has_many association" do - setup do - define_model :child - @model = define_model :parent do - has_many :children - validates_presence_of :children - end.new - end - - should "require the attribute to be set" do - assert_accepts validate_presence_of(:children), @model - end - end - - context "an optional has_many association" do - setup do - define_model :child - @model = define_model :parent do - has_many :children - end.new - end - - should "not require the attribute to be set" do - assert_rejects validate_presence_of(:children), @model - end - end - - context "a required has_and_belongs_to_many association" do - setup do - define_model :child - @model = define_model :parent do - has_and_belongs_to_many :children - validates_presence_of :children - end.new - end - - should "require the attribute to be set" do - assert_accepts validate_presence_of(:children), @model - end - end - - context "an optional has_and_belongs_to_many association" do - setup do - define_model :child - @model = define_model :parent do - has_and_belongs_to_many :children - end.new - end - - should "not require the attribute to be set" do - assert_rejects validate_presence_of(:children), @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb deleted file mode 100644 index cf7c0f9..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb +++ /dev/null @@ -1,147 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class ValidateUniquenessOfMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a unique attribute" do - setup do - @model = define_model(:example, :attr => :string, - :other => :integer) do - validates_uniqueness_of :attr - end.new - end - - context "with an existing value" do - setup do - @existing = Example.create!(:attr => 'value', :other => 1) - end - - should "require a unique value for that attribute" do - assert_accepts validate_uniqueness_of(:attr), @model - end - - should "pass when the subject is an existing record" do - assert_accepts validate_uniqueness_of(:attr), @existing - end - - should "fail when a scope is specified" do - assert_rejects validate_uniqueness_of(:attr).scoped_to(:other), @model - end - end - - context "without an existing value" do - setup do - assert_nil Example.find(:first) - @matcher = validate_uniqueness_of(:attr) - end - - should "fail to require a unique value" do - assert_rejects @matcher, @model - end - - should "alert the tester that an existing value is not present" do - @matcher.matches?(@model) - assert @matcher.negative_failure_message =~ /^Can't find first .*/ - end - end - end - - context "a unique attribute with a custom error and an existing value" do - setup do - @model = define_model(:example, :attr => :string) do - validates_uniqueness_of :attr, :message => 'Bad value' - end.new - Example.create! - end - - should "fail when checking the default message" do - assert_rejects validate_uniqueness_of(:attr), @model - end - - should "fail when checking a message that doesn't match" do - assert_rejects validate_uniqueness_of(:attr).with_message(/abc/i), @model - end - - should "pass when checking a message that matches" do - assert_accepts validate_uniqueness_of(:attr).with_message(/bad/i), @model - end - end - - context "a scoped unique attribute with an existing value" do - setup do - @model = define_model(:example, :attr => :string, - :scope1 => :integer, - :scope2 => :integer) do - validates_uniqueness_of :attr, :scope => [:scope1, :scope2] - end.new - @existing = Example.create!(:attr => 'value', :scope1 => 1, :scope2 => 2) - end - - should "pass when the correct scope is specified" do - assert_accepts validate_uniqueness_of(:attr).scoped_to(:scope1, :scope2), - @model - end - - should "pass when the subject is an existing record" do - assert_accepts validate_uniqueness_of(:attr).scoped_to(:scope1, :scope2), - @existing - end - - should "fail when a different scope is specified" do - assert_rejects validate_uniqueness_of(:attr).scoped_to(:scope1), @model - end - - should "fail when no scope is specified" do - assert_rejects validate_uniqueness_of(:attr), @model - end - - should "fail when a non-existent attribute is specified as a scope" do - assert_rejects validate_uniqueness_of(:attr).scoped_to(:fake), @model - end - end - - context "a non-unique attribute with an existing value" do - setup do - @model = define_model(:example, :attr => :string).new - Example.create!(:attr => 'value') - end - - should "not require a unique value for that attribute" do - assert_rejects validate_uniqueness_of(:attr), @model - end - end - - context "a case sensitive unique attribute with an existing value" do - setup do - @model = define_model(:example, :attr => :string) do - validates_uniqueness_of :attr, :case_sensitive => true - end.new - Example.create!(:attr => 'value') - end - - should "not require a unique, case-insensitive value for that attribute" do - assert_rejects validate_uniqueness_of(:attr).case_insensitive, @model - end - - should "require a unique, case-sensitive value for that attribute" do - assert_accepts validate_uniqueness_of(:attr), @model - end - end - - context "a case sensitive unique integer attribute with an existing value" do - setup do - @model = define_model(:example, :attr => :integer) do - validates_uniqueness_of :attr, :case_sensitive => true - end.new - Example.create!(:attr => 'value') - end - - should "require a unique, case-insensitive value for that attribute" do - assert_accepts validate_uniqueness_of(:attr).case_insensitive, @model - end - - should "require a unique, case-sensitive value for that attribute" do - assert_accepts validate_uniqueness_of(:attr), @model - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/assign_to_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/assign_to_matcher_test.rb deleted file mode 100644 index 4b32724..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/assign_to_matcher_test.rb +++ /dev/null @@ -1,35 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class AssignToMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a controller that assigns to an instance variable" do - setup do - @controller = build_response { @var = 'value' } - end - - should "accept assigning to that variable" do - assert_accepts assign_to(:var), @controller - end - - should "accept assigning to that variable with the correct class" do - assert_accepts assign_to(:var).with_kind_of(String), @controller - end - - should "reject assigning to that variable with another class" do - assert_rejects assign_to(:var).with_kind_of(Fixnum), @controller - end - - should "accept assigning the correct value to that variable" do - assert_accepts assign_to(:var).with('value'), @controller - end - - should "reject assigning another value to that variable" do - assert_rejects assign_to(:var).with('other'), @controller - end - - should "reject assigning to another variable" do - assert_rejects assign_to(:other), @controller - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/filter_param_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/filter_param_matcher_test.rb deleted file mode 100644 index e8437af..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/filter_param_matcher_test.rb +++ /dev/null @@ -1,32 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class FilterParamMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a controller that filters no parameters" do - setup do - @controller = define_controller(:examples).new - end - - should "reject filtering any parameter" do - assert_rejects filter_param(:any), @controller - end - end - - context "a controller that filters a parameter" do - setup do - @controller = define_controller :examples do - filter_parameter_logging :password - end.new - end - - should "accept filtering that parameter" do - assert_accepts filter_param(:password), @controller - end - - should "reject filtering another parameter" do - assert_rejects filter_param(:other), @controller - end - end - -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/render_with_layout_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/render_with_layout_matcher_test.rb deleted file mode 100644 index e7f7e2b..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/render_with_layout_matcher_test.rb +++ /dev/null @@ -1,33 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class RenderWithLayoutMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a controller that renders with a layout" do - setup do - @controller = build_response { render :layout => 'wide' } - end - - should "accept rendering with any layout" do - assert_accepts render_with_layout, @controller - end - - should "accept rendering with that layout" do - assert_accepts render_with_layout(:wide), @controller - end - - should "reject rendering with another layout" do - assert_rejects render_with_layout(:other), @controller - end - end - - context "a controller that renders without a layout" do - setup do - @controller = build_response { render :layout => false } - end - - should "reject rendering with a layout" do - assert_rejects render_with_layout, @controller - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_content_type_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_content_type_matcher_test.rb deleted file mode 100644 index 6719ff3..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_content_type_matcher_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class RespondWithContentTypeMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a controller responding with content type :xml" do - setup do - @controller = build_response { render :xml => { :user => "thoughtbot" }.to_xml } - end - - should "accept responding with content type :xml" do - assert_accepts respond_with_content_type(:xml), @controller - end - - should "accept responding with content type 'application/xml'" do - assert_accepts respond_with_content_type('application/xml'), @controller - end - - should "accept responding with content type /xml/" do - assert_accepts respond_with_content_type(/xml/), @controller - end - - should "reject responding with another content type" do - assert_rejects respond_with_content_type(:json), @controller - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_matcher_test.rb deleted file mode 100644 index 759ae16..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_matcher_test.rb +++ /dev/null @@ -1,106 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class RespondWithMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a controller responding with success" do - setup do - @controller = build_response { render :text => "text", :status => 200 } - end - - should "accept responding with 200" do - assert_accepts respond_with(200), @controller - end - - should "accept responding with :success" do - assert_accepts respond_with(:success), @controller - end - - should "reject responding with another status" do - assert_rejects respond_with(:error), @controller - end - end - - context "a controller responding with redirect" do - setup do - @controller = build_response { render :text => "text", :status => 301 } - end - - should "accept responding with 301" do - assert_accepts respond_with(301), @controller - end - - should "accept responding with :redirect" do - assert_accepts respond_with(:redirect), @controller - end - - should "reject responding with another status" do - assert_rejects respond_with(:error), @controller - end - end - - context "a controller responding with missing" do - setup do - @controller = build_response { render :text => "text", :status => 404 } - end - - should "accept responding with 404" do - assert_accepts respond_with(404), @controller - end - - should "accept responding with :missing" do - assert_accepts respond_with(:missing), @controller - end - - should "reject responding with another status" do - assert_rejects respond_with(:success), @controller - end - end - - context "a controller responding with error" do - setup do - @controller = build_response { render :text => "text", :status => 500 } - end - - should "accept responding with 500" do - assert_accepts respond_with(500), @controller - end - - should "accept responding with :error" do - assert_accepts respond_with(:error), @controller - end - - should "reject responding with another status" do - assert_rejects respond_with(:success), @controller - end - end - - context "a controller responding with not implemented" do - setup do - @controller = build_response { render :text => "text", :status => 501 } - end - - should "accept responding with 501" do - assert_accepts respond_with(501), @controller - end - - should "accept responding with :not_implemented" do - assert_accepts respond_with(:not_implemented), @controller - end - - should "reject responding with another status" do - assert_rejects respond_with(:success), @controller - end - end - - context "a controller raising an error" do - setup do - @controller = build_response { raise RailsError } - end - - should "reject responding with any status" do - assert_rejects respond_with(:success), @controller - end - end - -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/route_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/route_matcher_test.rb deleted file mode 100644 index ede9b4d..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/route_matcher_test.rb +++ /dev/null @@ -1,58 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class RouteToMatcherTest < Test::Unit::TestCase # :nodoc: - - context "given a controller with a defined route" do - setup do - @controller = define_controller('Examples').new - define_routes do |map| - map.connect 'examples/:id', :controller => 'examples', - :action => 'example' - end - end - - should "accept routing the correct path to the correct parameters" do - assert_accepts route(:get, '/examples/1'). - to(:action => 'example', :id => '1'), - @controller - end - - should "accept a symbol controller" do - assert_accepts route(:get, '/examples/1'). - to(:controller => :examples, - :action => 'example', - :id => '1'), - self - end - - should "accept a symbol action" do - assert_accepts route(:get, '/examples/1'). - to(:action => :example, :id => '1'), - @controller - end - - should "accept a non-string parameter" do - assert_accepts route(:get, '/examples/1'). - to(:action => 'example', :id => 1), - @controller - end - - should "reject an undefined route" do - assert_rejects route(:get, '/bad_route').to(:var => 'value'), @controller - end - - should "reject a route for another controller" do - @other = define_controller('Other').new - assert_rejects route(:get, '/examples/1'). - to(:action => 'example', :id => '1'), - @other - end - - should "reject a route for different parameters" do - assert_rejects route(:get, '/examples/1'). - to(:action => 'other', :id => '1'), - @controller - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_session_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_session_matcher_test.rb deleted file mode 100644 index 771bce3..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_session_matcher_test.rb +++ /dev/null @@ -1,31 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class SetSessionMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a controller that sets a session variable" do - setup do - @controller = build_response { session[:var] = 'value' } - end - - should "accept assigning to that variable" do - assert_accepts set_session(:var), @controller - end - - should "accept assigning the correct value to that variable" do - assert_accepts set_session(:var).to('value'), @controller - end - - should "reject assigning another value to that variable" do - assert_rejects set_session(:var).to('other'), @controller - end - - should "reject assigning to another variable" do - assert_rejects set_session(:other), @controller - end - - should "accept assigning nil to another variable" do - assert_accepts set_session(:other).to(nil), @controller - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_the_flash_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_the_flash_matcher.rb deleted file mode 100644 index 4d0a17d..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_the_flash_matcher.rb +++ /dev/null @@ -1,41 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') - -class SetTheFlashMatcherTest < Test::Unit::TestCase # :nodoc: - - context "a controller that sets a flash message" do - setup do - @controller = build_response { flash[:notice] = 'value' } - end - - should "accept setting any flash message" do - assert_accepts set_the_flash, @controller - end - - should "accept setting the exact flash message" do - assert_accepts set_the_flash.to('value'), @controller - end - - should "accept setting a matched flash message" do - assert_accepts set_the_flash.to(/value/), @controller - end - - should "reject setting a different flash message" do - assert_rejects set_the_flash.to('other'), @controller - end - - should "reject setting a different pattern" do - assert_rejects set_the_flash.to(/other/), @controller - end - end - - context "a controller that doesn't set a flash message" do - setup do - @controller = build_response - end - - should "reject setting any flash message" do - assert_rejects set_the_flash, @controller - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/model_builder.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/model_builder.rb deleted file mode 100644 index 084f1a7..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/model_builder.rb +++ /dev/null @@ -1,106 +0,0 @@ -class Test::Unit::TestCase - def create_table(table_name, &block) - connection = ActiveRecord::Base.connection - - begin - connection.execute("DROP TABLE IF EXISTS #{table_name}") - connection.create_table(table_name, &block) - @created_tables ||= [] - @created_tables << table_name - connection - rescue Exception => e - connection.execute("DROP TABLE IF EXISTS #{table_name}") - raise e - end - end - - def define_constant(class_name, base, &block) - class_name = class_name.to_s.camelize - - klass = Class.new(base) - Object.const_set(class_name, klass) - - klass.class_eval(&block) if block_given? - - @defined_constants ||= [] - @defined_constants << class_name - - klass - end - - def define_model_class(class_name, &block) - define_constant(class_name, ActiveRecord::Base, &block) - end - - def define_model(name, columns = {}, &block) - class_name = name.to_s.pluralize.classify - table_name = class_name.tableize - - create_table(table_name) do |table| - columns.each do |name, type| - table.column name, type - end - end - - define_model_class(class_name, &block) - end - - def define_controller(class_name, &block) - class_name = class_name.to_s - class_name << 'Controller' unless class_name =~ /Controller$/ - define_constant(class_name, ActionController::Base, &block) - end - - def define_routes(&block) - @replaced_routes = ActionController::Routing::Routes - new_routes = ActionController::Routing::RouteSet.new - silence_warnings do - ActionController::Routing.const_set('Routes', new_routes) - end - new_routes.draw(&block) - end - - def build_response(&block) - klass = define_controller('Examples') - block ||= lambda { render :nothing => true } - klass.class_eval { define_method(:example, &block) } - define_routes do |map| - map.connect 'examples', :controller => 'examples', :action => 'example' - end - - @controller = klass.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - get :example - - @controller - end - - def teardown_with_models - if @defined_constants - @defined_constants.each do |class_name| - Object.send(:remove_const, class_name) - end - end - - if @created_tables - @created_tables.each do |table_name| - ActiveRecord::Base. - connection. - execute("DROP TABLE IF EXISTS #{table_name}") - end - end - - if @replaced_routes - ActionController::Routing::Routes.clear! - silence_warnings do - ActionController::Routing.const_set('Routes', @replaced_routes) - end - @replaced_routes.reload! - end - - teardown_without_models - end - alias_method :teardown_without_models, :teardown - alias_method :teardown, :teardown_with_models -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/autoload_macro_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/autoload_macro_test.rb deleted file mode 100644 index ecfa356..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/autoload_macro_test.rb +++ /dev/null @@ -1,18 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', 'test_helper') - -class AutoloadMacroTest < Test::Unit::TestCase # :nodoc: - context "The macro auto-loader" do - should "load macros from the plugins" do - assert self.class.respond_to?('plugin_macro') - end - - should "load macros from the gems" do - assert self.class.respond_to?('gem_macro') - end - - should "load custom macros from ROOT/test/shoulda_macros" do - assert self.class.respond_to?('custom_macro') - end - end -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/context_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/context_test.rb deleted file mode 100644 index 352ea14..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/context_test.rb +++ /dev/null @@ -1,145 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', 'test_helper') - -class ContextTest < Test::Unit::TestCase # :nodoc: - - def self.context_macro(&blk) - context "with a subcontext made by a macro" do - setup { @context_macro = :foo } - - merge_block &blk - end - end - - # def self.context_macro(&blk) - # context "with a subcontext made by a macro" do - # setup { @context_macro = :foo } - # yield # <- this doesn't work. - # end - # end - - context "context with setup block" do - setup do - @blah = "blah" - end - - should "run the setup block" do - assert_equal "blah", @blah - end - - should "have name set right" do - assert_match(/^test: context with setup block/, self.to_s) - end - - context "and a subcontext" do - setup do - @blah = "#{@blah} twice" - end - - should "be named correctly" do - assert_match(/^test: context with setup block and a subcontext should be named correctly/, self.to_s) - end - - should "run the setup blocks in order" do - assert_equal @blah, "blah twice" - end - end - - context_macro do - should "have name set right" do - assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, self.to_s) - end - - should "run the setup block of that context macro" do - assert_equal :foo, @context_macro - end - - should "run the setup block of the main context" do - assert_equal "blah", @blah - end - end - - end - - context "another context with setup block" do - setup do - @blah = "foo" - end - - should "have @blah == 'foo'" do - assert_equal "foo", @blah - end - - should "have name set right" do - assert_match(/^test: another context with setup block/, self.to_s) - end - end - - context "context with method definition" do - setup do - def hello; "hi"; end - end - - should "be able to read that method" do - assert_equal "hi", hello - end - - should "have name set right" do - assert_match(/^test: context with method definition/, self.to_s) - end - end - - context "another context" do - should "not define @blah" do - assert_nil @blah - end - end - - context "context with multiple setups and/or teardowns" do - - cleanup_count = 0 - - 2.times do |i| - setup { cleanup_count += 1 } - teardown { cleanup_count -= 1 } - end - - 2.times do |i| - should "call all setups and all teardowns (check ##{i + 1})" do - assert_equal 2, cleanup_count - end - end - - context "subcontexts" do - - 2.times do |i| - setup { cleanup_count += 1 } - teardown { cleanup_count -= 1 } - end - - 2.times do |i| - should "also call all setups and all teardowns in parent and subcontext (check ##{i + 1})" do - assert_equal 4, cleanup_count - end - end - - end - - end - - should_eventually "pass, since it's unimplemented" do - flunk "what?" - end - - should_eventually "not require a block when using should_eventually" - should "pass without a block, as that causes it to piggyback to should_eventually" - - context "context for testing should piggybacking" do - should "call should_eventually as we are not passing a block" - end - - context "context" do - context "with nested subcontexts" do - should_eventually "only print this statement once for a should_eventually" - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/convert_to_should_syntax_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/convert_to_should_syntax_test.rb deleted file mode 100644 index 8b0594f..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/convert_to_should_syntax_test.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'test/unit' - -class ConvertToShouldSyntaxTest < Test::Unit::TestCase # :nodoc: - - BEFORE_FIXTURE = <<-EOS - class DummyTest < Test::Unit::TestCase - - should "Not change this_word_with_underscores" do - end - - def test_should_be_working - assert true - end - - def test_some_cool_stuff - assert true - end - - def non_test_method - end - - end - EOS - - AFTER_FIXTURE = <<-EOS - class DummyTest < Test::Unit::TestCase - - should "Not change this_word_with_underscores" do - end - - should "be working" do - assert true - end - - should "RENAME ME: test some cool stuff" do - assert true - end - - def non_test_method - end - - end - EOS - - FIXTURE_PATH = "./convert_to_should_syntax_fixture.dat" - - RUBY = ENV['RUBY'] || 'ruby' - - def test_convert_to_should_syntax - File.open(FIXTURE_PATH, "w") {|f| f.write(BEFORE_FIXTURE)} - cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), '../../bin/convert_to_should_syntax')} #{FIXTURE_PATH}" - output = `#{cmd}` - File.unlink($1) if output.match(/has been stored in '([^']+)/) - assert_match(/has been converted/, output) - result = IO.read(FIXTURE_PATH) - assert_equal result, AFTER_FIXTURE - end - - def teardown - File.unlink(FIXTURE_PATH) - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/helpers_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/helpers_test.rb deleted file mode 100644 index 0c581b9..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/helpers_test.rb +++ /dev/null @@ -1,241 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', 'test_helper') -require 'action_mailer' -require 'mocha' - -class HelpersTest < Test::Unit::TestCase # :nodoc: - - context "given delivered emails" do - setup do - email1 = stub(:subject => "one", :to => ["none1@email.com"]) - email2 = stub(:subject => "two", :to => ["none2@email.com"]) - ActionMailer::Base.stubs(:deliveries).returns([email1, email2]) - end - - should "have sent an email" do - assert_sent_email - - assert_raises(Test::Unit::AssertionFailedError) do - assert_did_not_send_email - end - end - - should "find email one" do - assert_sent_email do |e| - e.subject =~ /one/ - end - end - - should "not find an email that doesn't exist" do - assert_raises(Test::Unit::AssertionFailedError) do - assert_sent_email do |e| - e.subject =~ /whatever/ - end - end - end - end - - context "when there are no emails" do - setup do - ActionMailer::Base.stubs(:deliveries).returns([]) - end - - should "not have sent an email" do - assert_did_not_send_email - - assert_raises(Test::Unit::AssertionFailedError) do - assert_sent_email - end - end - end - - context "an array of values" do - setup do - @a = ['abc', 'def', 3] - end - - [/b/, 'abc', 3].each do |x| - should "contain #{x.inspect}" do - assert_raises(Test::Unit::AssertionFailedError) do - assert_does_not_contain @a, x - end - assert_contains @a, x - end - end - - should "not contain 'wtf'" do - assert_raises(Test::Unit::AssertionFailedError) {assert_contains @a, 'wtf'} - assert_does_not_contain @a, 'wtf' - end - - should "be the same as another array, ordered differently" do - assert_same_elements(@a, [3, "def", "abc"]) - assert_raises(Test::Unit::AssertionFailedError) do - assert_same_elements(@a, [3, 3, "def", "abc"]) - end - assert_raises(Test::Unit::AssertionFailedError) do - assert_same_elements([@a, "abc"].flatten, [3, 3, "def", "abc"]) - end - end - end - - context "an array of values" do - setup do - @a = [1, 2, "(3)"] - end - - context "after adding another value" do - setup do - @a.push(4) - end - - should_change "@a.length", :by => 1 - should_change "@a.length", :from => 3 - should_change "@a.length", :to => 4 - should_change "@a[0]", :by => 0 - should_not_change "@a[0]" - end - - context "after replacing it with an array of strings" do - setup do - @a = %w(a b c d e f) - end - - should_change "@a.length", :by => 3 - should_change "@a.length", :from => 3, :to => 6, :by => 3 - should_change "@a[0]" - should_change "@a[1]", :from => 2, :to => "b" - should_change "@a[2]", :from => /\d/, :to => /\w/ - should_change "@a[3]", :to => String - end - end - - context "assert_good_value" do - should "validate a good email address" do - assert_good_value User.new, :email, "good@example.com" - end - - should "validate a good SSN with a custom message" do - assert_good_value User.new, :ssn, "xxxxxxxxx", /length/ - end - - should "fail to validate a bad email address" do - assert_raises Test::Unit::AssertionFailedError do - assert_good_value User.new, :email, "bad" - end - end - - should "fail to validate a bad SSN that is too short" do - assert_raises Test::Unit::AssertionFailedError do - assert_good_value User.new, :ssn, "x", /length/ - end - end - - should "accept a class as the first argument" do - assert_good_value User, :email, "good@example.com" - end - - context "with an instance variable" do - setup do - @product = Product.new(:tangible => true) - end - - should "use that instance variable" do - assert_good_value Product, :price, "9999", /included/ - end - end - end - - context "assert_bad_value" do - should "invalidate a bad email address" do - assert_bad_value User.new, :email, "bad" - end - - should "invalidate a bad SSN with a custom message" do - assert_bad_value User.new, :ssn, "x", /length/ - end - - should "fail to invalidate a good email address" do - assert_raises Test::Unit::AssertionFailedError do - assert_bad_value User.new, :email, "good@example.com" - end - end - - should "fail to invalidate a good SSN" do - assert_raises Test::Unit::AssertionFailedError do - assert_bad_value User.new, :ssn, "xxxxxxxxx", /length/ - end - end - - should "accept a class as the first argument" do - assert_bad_value User, :email, "bad" - end - - context "with an instance variable" do - setup do - @product = Product.new(:tangible => true) - end - - should "use that instance variable" do - assert_bad_value Product, :price, "0", /included/ - end - end - end - - context "a matching matcher" do - setup do - @matcher = stub('matcher', :matches? => true, - :failure_message => 'bad failure message', - :negative_failure_message => 'big time failure') - end - - should "pass when given to assert_accepts" do - assert_accepts @matcher, 'target' - end - - context "when given to assert_rejects" do - setup do - begin - assert_rejects @matcher, 'target' - rescue Test::Unit::AssertionFailedError => @error - end - end - - should "fail" do - assert_not_nil @error - end - - should "use the error message from the matcher" do - assert_equal 'big time failure', @error.message - end - end - end - - context "a non-matching matcher" do - setup do - @matcher = stub('matcher', :matches? => false, - :failure_message => 'big time failure', - :negative_failure_message => 'bad failure message') - end - - should "pass when given to assert_rejects" do - assert_rejects @matcher, 'target' - end - - context "when given to assert_accepts" do - setup do - begin - assert_accepts @matcher, 'target' - rescue Test::Unit::AssertionFailedError => @error - end - end - - should "fail" do - assert_not_nil @error - end - - should "use the error message from the matcher" do - assert_equal 'big time failure', @error.message - end - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/private_helpers_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/private_helpers_test.rb deleted file mode 100644 index 7b2564a..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/private_helpers_test.rb +++ /dev/null @@ -1,34 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', 'test_helper') - -class PrivateHelpersTest < Test::Unit::TestCase # :nodoc: - include Shoulda::Private - context "get_options!" do - should "remove opts from args" do - args = [:a, :b, {}] - get_options!(args) - assert_equal [:a, :b], args - end - - should "return wanted opts in order" do - args = [{:one => 1, :two => 2}] - one, two = get_options!(args, :one, :two) - assert_equal 1, one - assert_equal 2, two - end - - should "raise ArgumentError if given unwanted option" do - args = [{:one => 1, :two => 2}] - assert_raises ArgumentError do - get_options!(args, :one) - end - end - end - - class ::SomeModel; end - context "model_class" do - should "sniff the class constant from the test class" do - self.expects(:name).returns("SomeModelTest") - assert_equal SomeModel, model_class - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/should_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/should_test.rb deleted file mode 100644 index f32e8f1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/should_test.rb +++ /dev/null @@ -1,266 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', 'test_helper') - -class ShouldTest < Test::Unit::TestCase # :nodoc: - should "be able to define a should statement outside of a context" do - assert true - end - - should "see the name of my class as ShouldTest" do - assert_equal "ShouldTest", self.class.name - end - - def self.should_see_class_methods - should "be able to see class methods" do - assert true - end - end - - def self.should_see_a_context_block_like_a_Test_Unit_class - should "see a context block as a Test::Unit class" do - assert_equal "ShouldTest", self.class.name - end - end - - def self.should_see_blah - should "see @blah through a macro" do - assert @blah - end - end - - def self.should_not_see_blah - should "not see @blah through a macro" do - assert_nil @blah - end - end - - def self.should_be_able_to_make_context_macros(prefix = nil) - context "a macro" do - should "have the tests named correctly" do - assert_match(/^test: #{prefix}a macro should have the tests named correctly/, self.to_s) - end - end - end - - context "Context" do - - should_see_class_methods - should_see_a_context_block_like_a_Test_Unit_class - should_be_able_to_make_context_macros("Context ") - - should "not define @blah" do - assert ! self.instance_variables.include?("@blah") - end - - should_not_see_blah - - should "be able to define a should statement" do - assert true - end - - should "see the name of my class as ShouldTest" do - assert_equal "ShouldTest", self.class.name - end - - context "with a subcontext" do - should_be_able_to_make_context_macros("Context with a subcontext ") - end - end - - context "Context with setup block" do - setup do - @blah = "blah" - end - - should "have @blah == 'blah'" do - assert_equal "blah", @blah - end - should_see_blah - - should "have name set right" do - assert_match(/^test: Context with setup block/, self.to_s) - end - - context "and a subcontext" do - setup do - @blah = "#{@blah} twice" - end - - should "be named correctly" do - assert_match(/^test: Context with setup block and a subcontext should be named correctly/, self.to_s) - end - - should "run the setup methods in order" do - assert_equal @blah, "blah twice" - end - should_see_blah - end - end - - context "Another context with setup block" do - setup do - @blah = "foo" - end - - should "have @blah == 'foo'" do - assert_equal "foo", @blah - end - - should "have name set right" do - assert_match(/^test: Another context with setup block/, self.to_s) - end - should_see_blah - end - - should_eventually "pass, since it's a should_eventually" do - flunk "what?" - end - - # Context creation and naming - - def test_should_create_a_new_context - assert_nothing_raised do - Shoulda::Context.new("context name", self) do; end - end - end - - def test_should_create_a_nested_context - assert_nothing_raised do - parent = Shoulda::Context.new("Parent", self) do; end - child = Shoulda::Context.new("Child", parent) do; end - end - end - - def test_should_name_a_contexts_correctly - parent = Shoulda::Context.new("Parent", self) do; end - child = Shoulda::Context.new("Child", parent) do; end - grandchild = Shoulda::Context.new("GrandChild", child) do; end - - assert_equal "Parent", parent.full_name - assert_equal "Parent Child", child.full_name - assert_equal "Parent Child GrandChild", grandchild.full_name - end - - # Should statements - - def test_should_have_should_hashes_when_given_should_statements - context = Shoulda::Context.new("name", self) do - should "be good" do; end - should "another" do; end - end - - names = context.shoulds.map {|s| s[:name]} - assert_equal ["another", "be good"], names.sort - end - - # setup and teardown - - def test_should_capture_setup_and_teardown_blocks - context = Shoulda::Context.new("name", self) do - setup do; "setup"; end - teardown do; "teardown"; end - end - - assert_equal "setup", context.setup_blocks.first.call - assert_equal "teardown", context.teardown_blocks.first.call - end - - # building - - def test_should_create_shoulda_test_for_each_should_on_build - context = Shoulda::Context.new("name", self) do - should "one" do; end - should "two" do; end - end - context.expects(:create_test_from_should_hash).with(has_entry(:name => "one")) - context.expects(:create_test_from_should_hash).with(has_entry(:name => "two")) - context.build - end - - def test_should_create_test_methods_on_build - tu_class = Test::Unit::TestCase - context = Shoulda::Context.new("A Context", tu_class) do - should "define the test" do; end - end - - tu_class.expects(:define_method).with(:"test: A Context should define the test. ") - context.build - end - - def test_should_create_test_methods_on_build_when_subcontext - tu_class = Test::Unit::TestCase - context = Shoulda::Context.new("A Context", tu_class) do - context "with a child" do - should "define the test" do; end - end - end - - tu_class.expects(:define_method).with(:"test: A Context with a child should define the test. ") - context.build - end - - # Test::Unit integration - - def test_should_create_a_new_context_and_build_it_on_Test_Unit_context - c = mock("context") - c.expects(:build) - Shoulda::Context.expects(:new).with("foo", kind_of(Class)).returns(c) - self.class.context "foo" do; end - end - - def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should - s = mock("test") - Shoulda::Context.any_instance.expects(:should).with("rock", {}).returns(s) - Shoulda::Context.any_instance.expects(:build) - self.class.should "rock" do; end - end - - def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should_eventually - s = mock("test") - Shoulda::Context.any_instance.expects(:should_eventually).with("rock").returns(s) - Shoulda::Context.any_instance.expects(:build) - self.class.should_eventually "rock" do; end - end - - should "run a :before proc", :before => lambda { @value = "before" } do - assert_equal "before", @value - end - - context "A :before proc" do - setup do - assert_equal "before", @value - @value = "setup" - end - - should "run before the current setup", :before => lambda { @value = "before" } do - assert_equal "setup", @value - end - end - - context "a before statement" do - setup do - assert_equal "before", @value - @value = "setup" - end - - before_should "run before the current setup" do - @value = "before" - end - end - - context "A context" do - setup do - @value = "outer" - end - - context "with a subcontext and a :before proc" do - before = lambda do - assert "outer", @value - @value = "before" - end - should "run after the parent setup", :before => before do - assert_equal "before", @value - end - end - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/application.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/application.rb deleted file mode 100644 index 10fa987..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/application.rb +++ /dev/null @@ -1,25 +0,0 @@ -# Filters added to this controller apply to all controllers in the application. -# Likewise, all the methods added will be available for all controllers. - -class ApplicationController < ActionController::Base - # Pick a unique cookie name to distinguish our session data from others' - session :session_key => '_rails_root_session_id' - - def ensure_logged_in - unless session[:logged_in] - respond_to do |accepts| - accepts.html do - flash[:error] = 'What do you think you\'re doing?' - redirect_to '/' - end - accepts.xml do - headers["Status"] = "Unauthorized" - headers["WWW-Authenticate"] = %(Basic realm="Web Password") - render :text => "Couldn't authenticate you", :status => '401 Unauthorized' - end - end - return false - end - return true - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/posts_controller.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/posts_controller.rb deleted file mode 100644 index 46c9212..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/posts_controller.rb +++ /dev/null @@ -1,86 +0,0 @@ -class PostsController < ApplicationController - before_filter :ensure_logged_in - before_filter :load_user - - def index - @posts = @user.posts - - respond_to do |format| - format.html # index.rhtml - format.xml { render :xml => @posts.to_xml } - format.rss do - headers['Content-Type'] = 'application/rss+xml' - session[:special] = '$2 off your next purchase' - session[:special_user_id] = @user.id - head :ok - end - end - end - - def show - @post = @user.posts.find(params[:id]) - @false_flag = false - - respond_to do |format| - format.html { render :layout => 'wide' } - format.xml { render :xml => @post.to_xml } - end - end - - def new - @post = @user.posts.build - render :layout => false - end - - def edit - @post = @user.posts.find(params[:id]) - end - - def create - @post = @user.posts.build(params[:post]) - - respond_to do |format| - if @post.save - flash[:notice] = 'Post was successfully created.' - format.html { redirect_to user_post_url(@post.user, @post) } - format.xml { head :created, :location => user_post_url(@post.user, @post) } - else - format.html { render :action => "new" } - format.xml { render :xml => @post.errors.to_xml } - end - end - end - - def update - @post = @user.posts.find(params[:id]) - - respond_to do |format| - if @post.update_attributes(params[:post]) - flash[:notice] = 'Post was successfully updated.' - format.html { redirect_to user_post_url(@post.user, @post) } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @post.errors.to_xml } - end - end - end - - def destroy - @post = @user.posts.find(params[:id]) - @post.destroy - - flash[:notice] = "Post was removed" - - respond_to do |format| - format.html { redirect_to user_posts_url(@post.user) } - format.xml { head :ok } - end - end - - private - - def load_user - @user = User.find(params[:user_id]) - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/users_controller.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/users_controller.rb deleted file mode 100644 index 7a54a30..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/users_controller.rb +++ /dev/null @@ -1,84 +0,0 @@ -class UsersController < ApplicationController - - filter_parameter_logging :ssn - - # GET /users - # GET /users.xml - def index - @users = User.find(:all) - - respond_to do |format| - format.html # index.rhtml - format.xml { render :xml => @users.to_xml } - end - end - - # GET /users/1 - # GET /users/1.xml - def show - @user = User.find(params[:id]) - - respond_to do |format| - format.html # show.rhtml - format.xml { render :xml => @user.to_xml } - end - end - - # GET /users/new - def new - @user = User.new - end - - # GET /users/1;edit - def edit - @user = User.find(params[:id]) - end - - # POST /users - # POST /users.xml - def create - @user = User.new(params[:user]) - - respond_to do |format| - if @user.save - flash[:notice] = 'User was successfully created.' - format.html { redirect_to user_url(@user) } - format.xml { head :created, :location => user_url(@user) } - else - format.html { render :action => "new" } - format.xml { render :xml => @user.errors.to_xml } - end - end - end - - # PUT /users/1 - # PUT /users/1.xml - def update - @user = User.find(params[:id]) - - respond_to do |format| - if @user.update_attributes(params[:user]) - flash[:notice] = 'User was successfully updated.' - format.html { redirect_to user_url(@user) } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @user.errors.to_xml } - end - end - end - - # DELETE /users/1 - # DELETE /users/1.xml - def destroy - @user = User.find(params[:id]) - @user.destroy - - flash[:notice] = "User was removed" - - respond_to do |format| - format.html { redirect_to users_url } - format.xml { head :ok } - end - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/application_helper.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/application_helper.rb deleted file mode 100644 index 22a7940..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/application_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -# Methods added to this helper will be available to all templates in the application. -module ApplicationHelper -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/posts_helper.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/posts_helper.rb deleted file mode 100644 index a7b8cec..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/posts_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PostsHelper -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/users_helper.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/users_helper.rb deleted file mode 100644 index 2310a24..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/users_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module UsersHelper -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/address.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/address.rb deleted file mode 100644 index 225903e..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/address.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Address < ActiveRecord::Base - belongs_to :addressable, :polymorphic => true - validates_uniqueness_of :title, :scope => [:addressable_type, :addressable_id] - - validates_length_of :zip, :minimum => 5 - validates_numericality_of :zip -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/flea.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/flea.rb deleted file mode 100644 index 0ad2beb..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/flea.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Flea < ActiveRecord::Base - has_and_belongs_to_many :dogs -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/friendship.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/friendship.rb deleted file mode 100644 index 3844c77..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/friendship.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Friendship < ActiveRecord::Base - belongs_to :user - belongs_to :friend, :class_name => "User" -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/pets/dog.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/pets/dog.rb deleted file mode 100644 index c1810c0..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/pets/dog.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Pets - class Dog < ActiveRecord::Base - belongs_to :user, :foreign_key => :owner_id - belongs_to :address, :dependent => :destroy - has_many :treats - has_and_belongs_to_many :fleas, :join_table => :fleas - validates_presence_of :treats, :fleas - validates_presence_of :owner_id - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/post.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/post.rb deleted file mode 100644 index 7d13e19..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/post.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Post < ActiveRecord::Base - belongs_to :user - belongs_to :owner, :foreign_key => :user_id, :class_name => 'User' - has_many :taggings - has_many :tags, :through => :taggings - has_many :through_tags, :through => :taggings, :source => :tag - - validates_uniqueness_of :title - validates_presence_of :title - validates_presence_of :body, :message => 'Seriously... wtf' - validates_numericality_of :user_id -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/product.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/product.rb deleted file mode 100644 index 6222bec..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/product.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Product < ActiveRecord::Base - validates_presence_of :title - - validates_inclusion_of :price, :in => 0..99, :unless => :tangible - validates_format_of :size, :with => /^\d+\D+$/, :unless => :tangible - - validates_presence_of :price, :if => :tangible - validates_inclusion_of :price, :in => 1..9999, :if => :tangible - validates_inclusion_of :weight, :in => 1..100, :if => :tangible - validates_format_of :size, :with => /.+x.+x.+/, :if => :tangible - validates_length_of :size, :in => 5..20, :if => :tangible -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tag.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tag.rb deleted file mode 100644 index 83692df..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tag.rb +++ /dev/null @@ -1,8 +0,0 @@ -class Tag < ActiveRecord::Base - has_many :taggings, :dependent => :destroy - has_many :posts, :through => :taggings - - validates_length_of :name, :minimum => 2 - - attr_accessible :name -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tagging.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tagging.rb deleted file mode 100644 index 9b8fb6b..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tagging.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Tagging < ActiveRecord::Base - belongs_to :post - belongs_to :tag -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/treat.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/treat.rb deleted file mode 100644 index a80a7e0..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/treat.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Treat < ActiveRecord::Base - -end \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/user.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/user.rb deleted file mode 100644 index c99857c..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/user.rb +++ /dev/null @@ -1,29 +0,0 @@ -class User < ActiveRecord::Base - has_many :posts - has_many :dogs, :foreign_key => :owner_id, :class_name => "Pets::Dog" - - has_many :friendships - has_many :friends, :through => :friendships - - has_one :address, :as => :addressable, :dependent => :destroy - - named_scope :old, :conditions => "age > 50" - named_scope :eighteen, :conditions => { :age => 18 } - named_scope :recent, lambda {|count| { :limit => count } } - - def self.recent_via_method(count) - scoped(:limit => count) - end - - attr_protected :password - attr_readonly :name - - validates_format_of :email, :with => /\w*@\w*.com/ - validates_length_of :email, :in => 1..100 - validates_numericality_of :age, :greater_than_or_equal_to => 1, - :less_than_or_equal_to => 100 - validates_acceptance_of :eula - validates_uniqueness_of :email, :scope => :name, :case_sensitive => false - validates_length_of :ssn, :is => 9, :message => "Social Security Number is not the right length" - validates_numericality_of :ssn -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/posts.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/posts.rhtml deleted file mode 100644 index 3b15ce3..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/posts.rhtml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - Posts: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> - - - -

<%= flash[:notice] %>

- -<%= yield %> - - - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/users.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/users.rhtml deleted file mode 100644 index 23757aa..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/users.rhtml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Users: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> - - - -

<%= flash[:notice] %>

- -<%= yield %> - - - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/wide.html.erb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/wide.html.erb deleted file mode 100644 index 668d3b7..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/wide.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/edit.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/edit.rhtml deleted file mode 100644 index 65bd4fe..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/edit.rhtml +++ /dev/null @@ -1,27 +0,0 @@ -

Editing post

- -<%= error_messages_for :post %> - -<% form_for(:post, :url => user_post_path(@post.user, @post), :html => { :method => :put }) do |f| %> -

- User
- <%= f.text_field :user_id %> -

- -

- Title
- <%= f.text_field :title %> -

- -

- Body
- <%= f.text_area :body %> -

- -

- <%= submit_tag "Update" %> -

-<% end %> - -<%= link_to 'Show', user_post_path(@post.user, @post) %> | -<%= link_to 'Back', user_posts_path(@post.user) %> diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/index.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/index.rhtml deleted file mode 100644 index f6bb3bd..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/index.rhtml +++ /dev/null @@ -1,25 +0,0 @@ -

Listing posts

- - - - - - - - -<% for post in @posts %> - - - - - - - - -<% end %> -
UserTitleBody
<%=h post.user_id %><%=h post.title %><%=h post.body %><%= link_to 'Show', user_post_path(post.user, post) %><%= link_to 'Edit', edit_user_post_path(post.user, post) %><%= link_to 'Destroy', user_post_path(post.user, post), :confirm => 'Are you sure?', - :method => :delete %>
- -
- -<%= link_to 'New post', new_user_post_path(post.user) %> diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/new.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/new.rhtml deleted file mode 100644 index 216f1e0..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/new.rhtml +++ /dev/null @@ -1,26 +0,0 @@ -

New post

- -<%= error_messages_for :post %> - -<% form_for(:post, :url => user_posts_path(@user)) do |f| %> -

- User
- <%= f.text_field :user_id %> -

- -

- Title
- <%= f.text_field :title %> -

- -

- Body
- <%= f.text_area :body %> -

- -

- <%= submit_tag "Create" %> -

-<% end %> - -<%= link_to 'Back', user_posts_path(@user) %> diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/show.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/show.rhtml deleted file mode 100644 index b9d3791..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/show.rhtml +++ /dev/null @@ -1,18 +0,0 @@ -

- User: - <%=h @post.user_id %> -

- -

- Title: - <%=h @post.title %> -

- -

- Body: - <%=h @post.body %> -

- - -<%= link_to 'Edit', edit_user_post_path(@post.user, @post) %> | -<%= link_to 'Back', user_posts_path(@post.user) %> diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/edit.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/edit.rhtml deleted file mode 100644 index 9c47ad5..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/edit.rhtml +++ /dev/null @@ -1,22 +0,0 @@ -

Editing user

- -<%= error_messages_for :user %> - -<% form_for(:user, :url => user_path(@user), :html => { :method => :put }) do |f| %> -

- Email
- <%= f.text_field :email %> -

- -

- Age
- <%= f.text_field :age %> -

- -

- <%= submit_tag "Update" %> -

-<% end %> - -<%= link_to 'Show', user_path(@user) %> | -<%= link_to 'Back', users_path %> \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/index.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/index.rhtml deleted file mode 100644 index 83f2e91..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/index.rhtml +++ /dev/null @@ -1,22 +0,0 @@ -

Listing users

- - - - - - - -<% for user in @users %> - - - - - - - -<% end %> -
EmailAge
<%=h user.email %><%=h user.age %><%= link_to 'Show', user_path(user) %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user_path(user), :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New user', new_user_path %> \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/new.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/new.rhtml deleted file mode 100644 index 6f2c3a4..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/new.rhtml +++ /dev/null @@ -1,21 +0,0 @@ -

New user

- -<%= error_messages_for :user %> - -<% form_for(:user, :url => users_path) do |f| %> -

- Email
- <%= f.text_field :email %> -

- -

- Age
- <%= f.text_field :age %> -

- -

- <%= submit_tag "Create" %> -

-<% end %> - -<%= link_to 'Back', users_path %> \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/show.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/show.rhtml deleted file mode 100644 index bdcad8a..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/show.rhtml +++ /dev/null @@ -1,13 +0,0 @@ -

- Email: - <%=h @user.email %> -

- -

- Age: - <%=h @user.age %> -

- - -<%= link_to 'Edit', edit_user_path(@user) %> | -<%= link_to 'Back', users_path %> \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/boot.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/boot.rb deleted file mode 100644 index cd21fb9..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/boot.rb +++ /dev/null @@ -1,109 +0,0 @@ -# Don't change this file! -# Configure your app in config/environment.rb and config/environments/*.rb - -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) - -module Rails - class << self - def boot! - unless booted? - preinitialize - pick_boot.run - end - end - - def booted? - defined? Rails::Initializer - end - - def pick_boot - (vendor_rails? ? VendorBoot : GemBoot).new - end - - def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") - end - - def preinitialize - load(preinitializer_path) if File.exist?(preinitializer_path) - end - - def preinitializer_path - "#{RAILS_ROOT}/config/preinitializer.rb" - end - end - - class Boot - def run - load_initializer - Rails::Initializer.run(:set_load_path) - end - end - - class VendorBoot < Boot - def load_initializer - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - Rails::Initializer.run(:install_gem_spec_stubs) - end - end - - class GemBoot < Boot - def load_initializer - self.class.load_rubygems - load_rails_gem - require 'initializer' - end - - def load_rails_gem - if version = self.class.gem_version - gem 'rails', version - else - gem 'rails' - end - rescue Gem::LoadError => load_error - $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) - exit 1 - end - - class << self - def rubygems_version - Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion - end - - def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] - else - parse_gem_version(read_environment_rb) - end - end - - def load_rubygems - require 'rubygems' - - unless rubygems_version >= '0.9.4' - $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.) - exit 1 - end - - rescue LoadError - $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org) - exit 1 - end - - def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ - end - - private - def read_environment_rb - File.read("#{RAILS_ROOT}/config/environment.rb") - end - end - end -end - -# All that for this: -Rails.boot! diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environment.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environment.rb deleted file mode 100644 index a3b00b8..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environment.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Specifies gem version of Rails to use when vendor/rails is not present -old_verbose, $VERBOSE = $VERBOSE, nil -RAILS_GEM_VERSION = '= 2.2.2' unless defined? RAILS_GEM_VERSION -$VERBOSE = old_verbose - -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - config.log_level = :debug - config.cache_classes = false - config.whiny_nils = true -end - -# Dependencies.log_activity = true diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environments/test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environments/test.rb deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/new_rails_defaults.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/new_rails_defaults.rb deleted file mode 100644 index 5e60c0a..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/new_rails_defaults.rb +++ /dev/null @@ -1,15 +0,0 @@ -# These settings change the behavior of Rails 2 apps and will be defaults -# for Rails 3. You can remove this initializer when Rails 3 is released. - -# Include Active Record class name as root for JSON serialized output. -ActiveRecord::Base.include_root_in_json = true - -# Store the full class name (including module namespace) in STI type column. -ActiveRecord::Base.store_full_sti_class = true - -# Use ISO 8601 format for JSON serialized times and dates. -ActiveSupport.use_standard_json_time_format = true - -# Don't escape HTML entities in JSON, leave that for the #json_escape helper. -# if you're including raw json in an HTML page. -ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/shoulda.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/shoulda.rb deleted file mode 100644 index d132470..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/shoulda.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This simulates loading the shoulda plugin, but without relying on -# vendor/plugins - -shoulda_path = File.join(File.dirname(__FILE__), *%w(.. .. .. ..)) -shoulda_lib_path = File.join(shoulda_path, "lib") - -$LOAD_PATH.unshift(shoulda_lib_path) -load File.join(shoulda_path, "init.rb") diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/routes.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/routes.rb deleted file mode 100644 index ae2bddd..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/routes.rb +++ /dev/null @@ -1,6 +0,0 @@ -ActionController::Routing::Routes.draw do |map| - - map.resources :posts - map.resources :users, :has_many => :posts - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/001_create_users.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/001_create_users.rb deleted file mode 100644 index 13abb7b..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/001_create_users.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def self.up - create_table :users do |t| - t.column :name, :string - t.column :email, :string - t.column :age, :integer - t.column :ssn, :string - t.column :phone, :string - end - add_index :users, :email, :unique => true - add_index :users, :name - add_index :users, :age - add_index :users, [:email, :name], :unique => true - end - - def self.down - drop_table :users - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/002_create_posts.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/002_create_posts.rb deleted file mode 100644 index 9ed4deb..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/002_create_posts.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreatePosts < ActiveRecord::Migration - def self.up - create_table :posts do |t| - t.column :user_id, :integer - t.column :title, :string - t.column :body, :text - end - end - - def self.down - drop_table :posts - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/003_create_taggings.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/003_create_taggings.rb deleted file mode 100644 index e163a0a..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/003_create_taggings.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateTaggings < ActiveRecord::Migration - def self.up - create_table :taggings do |t| - t.column :post_id, :integer - t.column :tag_id, :integer - end - end - - def self.down - drop_table :taggings - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/004_create_tags.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/004_create_tags.rb deleted file mode 100644 index dc58c4f..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/004_create_tags.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTags < ActiveRecord::Migration - def self.up - create_table :tags do |t| - t.column :name, :string - end - end - - def self.down - drop_table :tags - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/005_create_dogs.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/005_create_dogs.rb deleted file mode 100644 index d1ada90..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/005_create_dogs.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateDogs < ActiveRecord::Migration - def self.up - create_table :dogs do |t| - t.column :owner_id, :integer - t.column :address_id, :integer - end - end - - def self.down - drop_table :dogs - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/006_create_addresses.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/006_create_addresses.rb deleted file mode 100644 index 151cf45..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/006_create_addresses.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateAddresses < ActiveRecord::Migration - def self.up - create_table :addresses do |t| - t.column :title, :string - t.column :addressable_id, :integer - t.column :addressable_type, :string - t.column :zip, :string - end - end - - def self.down - drop_table :addresses - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/007_create_fleas.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/007_create_fleas.rb deleted file mode 100644 index 81ac051..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/007_create_fleas.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateFleas < ActiveRecord::Migration - def self.up - create_table :fleas do |t| - t.string :name - end - end - - def self.down - drop_table :fleas - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/008_create_dogs_fleas.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/008_create_dogs_fleas.rb deleted file mode 100644 index 98555ae..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/008_create_dogs_fleas.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateDogsFleas < ActiveRecord::Migration - def self.up - create_table :dogs_fleas do |t| - t.integer :dog_id - t.integer :flea_id - end - end - - def self.down - drop_table :dogs_fleas - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/009_create_products.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/009_create_products.rb deleted file mode 100644 index 173f948..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/009_create_products.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateProducts < ActiveRecord::Migration - def self.up - create_table :products do |t| - t.string :title - t.integer :price - t.integer :weight - t.string :size - t.boolean :tangible - - t.timestamps - end - end - - def self.down - drop_table :products - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/010_create_friendships.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/010_create_friendships.rb deleted file mode 100644 index 99d0f6c..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/010_create_friendships.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateFriendships < ActiveRecord::Migration - def self.up - create_table :friendships do |t| - t.integer :user_id - t.integer :friend_id - - t.timestamps - end - end - - def self.down - drop_table :friendships - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/011_create_treats.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/011_create_treats.rb deleted file mode 100644 index 1b1a002..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/011_create_treats.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateTreats < ActiveRecord::Migration - def self.up - create_table :treats do |t| - t.integer :dog_id - t.timestamps - end - end - - def self.down - drop_table :treats - end -end \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/schema.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/schema.rb deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/404.html b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/404.html deleted file mode 100644 index eff660b..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/404.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - The page you were looking for doesn't exist (404) - - - - - -
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
- - \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/422.html b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/422.html deleted file mode 100644 index b54e4a3..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/422.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - The change you wanted was rejected (422) - - - - - -
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
- - \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/500.html b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/500.html deleted file mode 100644 index 0e9c14f..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/500.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - We're sorry, but something went wrong (500) - - - - - -
-

We're sorry, but something went wrong.

-

We've been notified about this issue and we'll take a look at it shortly.

-
- - \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/console b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/console deleted file mode 100755 index 498077a..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/console +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/console' diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/generate b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/generate deleted file mode 100755 index 173a9f1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/script/generate +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/generate' diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/test/shoulda_macros/custom_macro.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/test/shoulda_macros/custom_macro.rb deleted file mode 100644 index ffae9e8..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/test/shoulda_macros/custom_macro.rb +++ /dev/null @@ -1,6 +0,0 @@ -module CustomMacro - def custom_macro - end -end -Test::Unit::TestCase.extend(CustomMacro) - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb deleted file mode 100644 index 6c47076..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +++ /dev/null @@ -1,6 +0,0 @@ -module GemMacro - def gem_macro - end -end -Test::Unit::TestCase.extend(GemMacro) - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb deleted file mode 100644 index 4c3ba16..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +++ /dev/null @@ -1,6 +0,0 @@ -module PluginMacro - def plugin_macro - end -end -Test::Unit::TestCase.extend(PluginMacro) - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rspec_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rspec_test.rb deleted file mode 100644 index dfbc0e9..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rspec_test.rb +++ /dev/null @@ -1,207 +0,0 @@ -require 'test_helper' - -begin - gem 'rspec' - gem 'rspec-rails' -rescue LoadError => exception - puts exception.message - puts "RSpec integration was not tested because RSpec is not available" -else - - class RspecTest < Test::Unit::TestCase - - SHOULDA_ROOT = - File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze - - def setup - build_gemspec - end - - def teardown - FileUtils.rm_rf(project_dir) - FileUtils.rm_rf("#{shoulda_root}/pkg") - end - - should "integrate correctly when using config.gem in test.rb" do - create_project - insert(rspec_dependencies, "config/environments/test.rb") - vendor_gems('test') - configure_spec_rails - assert_configured - end - - should "integrate correctly when using config.gem in environment.rb" do - create_project - insert(rspec_dependencies, - "config/environment.rb", - /Rails::Initializer\.run/) - vendor_gems('development') - configure_spec_rails - assert_configured - end - - should "integrate correctly when using require in spec_helper" do - create_project - configure_spec_rails - insert(%{gem 'shoulda'; require 'shoulda'}, - "spec/spec_helper.rb", - %{require 'spec/rails'}) - assert_configured - end - - should "integrate correctly when unpacked and required in spec_helper" do - create_project - configure_spec_rails - insert(%{require 'shoulda'}, - "spec/spec_helper.rb", - %{require 'spec/rails'}) - unpack_gems - assert_configured - end - - def create_project - command "rails #{project_dir}" - end - - def vendor_gems(env) - project_command "rake gems:unpack RAILS_ENV=#{env}" - end - - def unpack_gems - FileUtils.mkdir_p "#{project_dir}/vendor/gems" - FileUtils.cd "#{project_dir}/vendor/gems" do - %w(rspec rspec-rails shoulda).each do |gem| - command "gem unpack #{gem}" - end - end - - insert('config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/*/lib"]', - "config/environment.rb", - /Rails::Initializer\.run/) - end - - def command(command) - output = `GEM_PATH=#{shoulda_root}/pkg #{command} 2>&1` - unless $? == 0 - flunk("Command failed with status #{$?}\n#{command}\n#{output}") - end - @command_output ||= '' - @command_output << output - output - end - - def project_command(command) - result = nil - FileUtils.cd project_dir do - result = command(command) - end - result - end - - def shoulda_command(command) - FileUtils.cd shoulda_root do - command(command) - end - end - - def project_name - 'example_rails_project' - end - - def project_dir - File.expand_path(File.join(File.dirname(__FILE__), project_name)) - end - - def insert(content, path, after = nil) - path = File.join(project_dir, path) - contents = IO.read(path) - if after - contents.gsub!(/^(.*#{after}.*)$/, "\\1\n#{content}") - else - contents << "\n" << content - end - File.open(path, 'w') {|file| file.write(contents) } - end - - def rspec_dependencies - return <<-EOS - config.gem 'rspec', :lib => 'spec' - config.gem 'rspec-rails', :lib => false - config.gem 'shoulda', :lib => 'shoulda' - EOS - end - - def configure_spec_rails - project_command "script/generate rspec" - end - - def assert_configured - create_model - migrate - create_controller - assert_spec_passes - end - - def create_model - project_command "script/generate rspec_model person name:string" - insert "validates_presence_of :name", - "app/models/person.rb", - /class Person/ - insert "it { should validate_presence_of(:name) }", - "spec/models/person_spec.rb", - /describe Person do/ - end - - def create_controller - project_command "script/generate rspec_controller people" - insert "def index; render :text => 'Hello'; end", - "app/controllers/people_controller.rb", - /class PeopleController/ - shoulda_controller_example = <<-EOS - describe PeopleController, "on GET index" do - integrate_views - subject { controller } - before(:each) { get :index } - it { should respond_with(:success) } - end - EOS - insert shoulda_controller_example, - "spec/controllers/people_controller_spec.rb" - end - - def migrate - project_command "rake db:migrate" - end - - def assert_spec_passes - result = project_command("rake spec SPEC_OPTS=-fs") - assert_match /should require name to be set/, result - assert_match /should respond with 200/, result - end - - def shoulda_root - SHOULDA_ROOT - end - - def build_gemspec - backup_gemspec do - shoulda_command "rake gemspec" - shoulda_command "rake gem" - shoulda_command "gem install --no-ri --no-rdoc -i pkg pkg/shoulda*.gem" - end - end - - def backup_gemspec - actual = "#{shoulda_root}/shoulda.gemspec" - backup = "#{shoulda_root}/backup.gemspec" - FileUtils.mv(actual, backup) - begin - yield - ensure - FileUtils.mv(backup, actual) - end - end - - end - -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/test_helper.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/test_helper.rb deleted file mode 100644 index 29b1910..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/test_helper.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'fileutils' - -# Load the environment -ENV['RAILS_ENV'] = 'test' - -rails_root = File.dirname(__FILE__) + '/rails_root' - -require "#{rails_root}/config/environment.rb" - -# Load the testing framework -require 'test_help' -silence_warnings { RAILS_ENV = ENV['RAILS_ENV'] } - -# Run the migrations -ActiveRecord::Migration.verbose = false -ActiveRecord::Migrator.migrate("#{RAILS_ROOT}/db/migrate") - -# Setup the fixtures path -Test::Unit::TestCase.fixture_path = File.join(File.dirname(__FILE__), "fixtures") - -class Test::Unit::TestCase #:nodoc: - def create_fixtures(*table_names) - if block_given? - Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield } - else - Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) - end - end - - self.use_transactional_fixtures = false - self.use_instantiated_fixtures = false -end - -require 'test/fail_macros' -require 'test/model_builder' diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/address_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/address_test.rb deleted file mode 100644 index bce0005..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/address_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class AddressTest < Test::Unit::TestCase - fixtures :all - - should_belong_to :addressable - should_validate_uniqueness_of :title, :scoped_to => [:addressable_id, :addressable_type] - should_ensure_length_at_least :zip, 5 - should_only_allow_numeric_values_for :zip -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/dog_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/dog_test.rb deleted file mode 100644 index f927117..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/dog_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class Pets::DogTest < Test::Unit::TestCase - should_belong_to :user - should_belong_to :address, :dependent => :destroy - should_have_many :treats - should_have_and_belong_to_many :fleas - should_require_attributes :treats, :fleas - should_validate_presence_of :owner_id -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/flea_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/flea_test.rb deleted file mode 100644 index 37f4b64..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/flea_test.rb +++ /dev/null @@ -1,6 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class FleaTest < Test::Unit::TestCase - should_have_and_belong_to_many :dogs -end - diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/friendship_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/friendship_test.rb deleted file mode 100644 index 2407d44..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/friendship_test.rb +++ /dev/null @@ -1,6 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class FriendshipTest < ActiveSupport::TestCase - should_belong_to :user - should_belong_to :friend -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/post_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/post_test.rb deleted file mode 100644 index 2dd5dd5..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/post_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class PostTest < Test::Unit::TestCase - fixtures :all - - should_belong_to :user - should_belong_to :owner - should_have_many :tags, :through => :taggings - should_have_many :through_tags, :through => :taggings - - should_require_unique_attributes :title - should_validate_presence_of :body, :message => /wtf/ - should_validate_presence_of :title - should_validate_numericality_of :user_id - - should_fail do - should_validate_uniqueness_of :title, :case_sensitive => false - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/product_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/product_test.rb deleted file mode 100644 index 1c47f79..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/product_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ProductTest < ActiveSupport::TestCase - context "An intangible product" do - setup do - @product = Product.new(:tangible => false) - end - - should_validate_presence_of :title - should_not_allow_values_for :size, "22" - should_allow_values_for :size, "22kb" - should_ensure_value_in_range :price, 0..99 - end - - context "A tangible product" do - setup do - @product = Product.new(:tangible => true) - end - - should_validate_presence_of :price - should_ensure_value_in_range :price, 1..9999 - should_ensure_value_in_range :weight, 1..100 - should_not_allow_values_for :size, "22", "10x15" - should_allow_values_for :size, "12x12x1" - should_ensure_length_in_range :size, 5..20 - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tag_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tag_test.rb deleted file mode 100644 index fc2e1d1..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tag_test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class TagTest < Test::Unit::TestCase - should_have_many :taggings, :dependent => :destroy - should_have_many :posts - - should_ensure_length_at_least :name, 2 - - should_protect_attributes :secret - should_allow_mass_assignment_of :name - - should_fail do - should_not_allow_mass_assignment_of :name - end -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tagging_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tagging_test.rb deleted file mode 100644 index 3f8c35c..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/tagging_test.rb +++ /dev/null @@ -1,6 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class TaggingTest < Test::Unit::TestCase - should_belong_to :post - should_belong_to :tag -end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/user_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/user_test.rb deleted file mode 100644 index d47f421..0000000 --- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/unit/user_test.rb +++ /dev/null @@ -1,70 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class UserTest < Test::Unit::TestCase - fixtures :all - - should_have_many :posts - should_have_many :dogs - - should_have_many :friendships - should_have_many :friends - - should_have_one :address - should_have_one :address, :dependent => :destroy - - should_have_indices :email, :name - should_have_index :age - should_have_index [:email, :name], :unique => true - should_have_index :age, :unique => false - - should_fail do - should_have_index :phone - should_have_index :email, :unique => false - should_have_index :age, :unique => true - end - - should_have_named_scope :old, :conditions => "age > 50" - should_have_named_scope :eighteen, :conditions => { :age => 18 } - - should_have_named_scope 'recent(5)', :limit => 5 - should_have_named_scope 'recent(1)', :limit => 1 - should_have_named_scope 'recent_via_method(7)', :limit => 7 - - context "when given an instance variable" do - setup { @count = 2 } - should_have_named_scope 'recent(@count)', :limit => 2 - end - - should_not_allow_values_for :email, "blah", "b lah" - should_allow_values_for :email, "a@b.com", "asdf@asdf.com" - should_ensure_length_in_range :email, 1..100 - should_ensure_value_in_range :age, 1..100, :low_message => /greater/, - :high_message => /less/ - should_fail do - should_ensure_value_in_range :age, 1..100, :low_message => /more/, - :high_message => /less/ - end - should_fail do - should_ensure_value_in_range :age, 1..100, :low_message => /greater/, - :high_message => /fewer/ - end - should_not_allow_mass_assignment_of :password - should_have_class_methods :find, :destroy - should_have_instance_methods :email, :age, :email=, :valid? - should_have_db_columns :name, :email, :age - should_have_db_column :id, :type => "integer" - should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255, - :null => true, :scale => nil - should_validate_acceptance_of :eula - should_require_acceptance_of :eula - should_validate_uniqueness_of :email, :scoped_to => :name, :case_sensitive => false - - should_ensure_length_is :ssn, 9, :message => "Social Security Number is not the right length" - should_validate_numericality_of :ssn - - should_have_readonly_attributes :name - - should_fail do - should_not_allow_mass_assignment_of :name, :age - end -end