muck-comments 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +24 -0
- data/Rakefile +2 -11
- data/VERSION +1 -1
- data/app/controllers/muck/comments_controller.rb +66 -36
- data/app/helpers/muck_comments_helper.rb +23 -5
- data/app/views/activity_templates/_comment.html.erb +3 -9
- data/app/views/comments/_comment.html.erb +6 -25
- data/app/views/comments/_form.html.erb +2 -1
- data/app/views/comments/index.html.erb +3 -0
- data/app/views/comments/new.html.erb +5 -0
- data/db/migrate/20090730154102_allow_null_user.rb +9 -0
- data/lib/active_record/acts/muck_comment.rb +2 -2
- data/lib/acts_as_commentable_with_threading.rb +3 -3
- data/lib/muck_comments.rb +2 -0
- data/locales/en.yml +5 -1
- data/muck-comments.gemspec +307 -15
- data/test/rails_root/.gitignore +8 -0
- data/test/rails_root/.rake_tasks +103 -0
- data/test/rails_root/Capfile +3 -0
- data/test/rails_root/Rakefile +15 -0
- data/test/rails_root/app/controllers/application_controller.rb +21 -0
- data/test/rails_root/app/controllers/default_controller.rb +7 -0
- data/test/rails_root/app/helpers/application_helper.rb +3 -0
- data/test/rails_root/app/models/.keep +0 -0
- data/test/rails_root/app/models/comment.rb +3 -0
- data/test/rails_root/app/models/user.rb +8 -0
- data/test/rails_root/app/models/user_session.rb +2 -0
- data/test/rails_root/app/views/default/index.html.erb +0 -0
- data/test/rails_root/app/views/layouts/default.html.erb +26 -0
- data/test/rails_root/config/amazon_s3.yml +14 -0
- data/test/rails_root/config/boot.rb +109 -0
- data/test/rails_root/config/database.yml +23 -0
- data/test/rails_root/config/environment.rb +30 -0
- data/test/rails_root/config/environments/cucumber.rb +38 -0
- data/test/rails_root/config/environments/development.rb +19 -0
- data/test/rails_root/config/environments/production.rb +1 -0
- data/test/rails_root/config/environments/test.rb +42 -0
- data/test/rails_root/config/global_config.yml +77 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/requires.rb +13 -0
- data/test/rails_root/config/initializers/session_store.rb +8 -0
- data/test/rails_root/config/routes.rb +4 -0
- data/test/rails_root/db/.keep +0 -0
- data/test/rails_root/db/migrate/20090320174818_create_muck_permissions_and_roles.rb +16 -0
- data/test/rails_root/db/migrate/20090402033319_add_muck_activities.rb +36 -0
- data/test/rails_root/db/migrate/20090402234137_create_languages.rb +18 -0
- data/test/rails_root/db/migrate/20090426041056_create_countries.rb +15 -0
- data/test/rails_root/db/migrate/20090426041103_create_states.rb +18 -0
- data/test/rails_root/db/migrate/20090602041838_create_users.rb +39 -0
- data/test/rails_root/db/migrate/20090608073052_create_friends.rb +16 -0
- data/test/rails_root/db/migrate/20090613173314_create_comments.rb +24 -0
- data/test/rails_root/db/migrate/20090703055724_add_contents.rb +49 -0
- data/test/rails_root/db/migrate/20090704220055_create_slugs.rb +18 -0
- data/test/rails_root/db/migrate/20090704220120_acts_as_taggable_on_migration.rb +29 -0
- data/test/rails_root/db/migrate/20090730044139_add_comment_cache.rb +9 -0
- data/test/rails_root/db/migrate/20090730074858_add_comment_count_to_users.rb +9 -0
- data/test/rails_root/db/migrate/20090730154102_allow_null_user.rb +9 -0
- data/test/rails_root/db/schema.rb +215 -0
- data/test/rails_root/features/comments.feature +21 -0
- data/test/rails_root/features/step_definitions/comment_steps.rb +11 -0
- data/test/rails_root/features/step_definitions/common_steps.rb +93 -0
- data/test/rails_root/features/step_definitions/webrat_steps.rb +128 -0
- data/test/rails_root/features/support/env.rb +49 -0
- data/test/rails_root/features/support/paths.rb +33 -0
- data/test/rails_root/lib/tasks/cucumber.rake +20 -0
- data/test/rails_root/public/.htaccess +40 -0
- data/test/rails_root/public/404.html +30 -0
- data/test/rails_root/public/422.html +30 -0
- data/test/rails_root/public/500.html +30 -0
- data/test/rails_root/public/dispatch.rb +10 -0
- data/test/rails_root/public/favicon.ico +0 -0
- data/test/rails_root/public/images/arrow_left.gif +0 -0
- data/test/rails_root/public/images/arrow_right.gif +0 -0
- data/test/rails_root/public/images/fancybox/fancy_closebox.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_progress.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_right.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_e.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_n.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_ne.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_nw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_s.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_se.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_sw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_w.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_main.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_right.png +0 -0
- data/test/rails_root/public/images/icons/accept.png +0 -0
- data/test/rails_root/public/images/icons/add.png +0 -0
- data/test/rails_root/public/images/icons/delete.png +0 -0
- data/test/rails_root/public/images/icons/vote.png +0 -0
- data/test/rails_root/public/images/loading.gif +0 -0
- data/test/rails_root/public/images/nothing.png +0 -0
- data/test/rails_root/public/images/profile_default.jpg +0 -0
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/images/spinner.gif +0 -0
- data/test/rails_root/public/images/sprites.png +0 -0
- data/test/rails_root/public/javascripts/application.js +2 -0
- data/test/rails_root/public/javascripts/builder.js +136 -0
- data/test/rails_root/public/javascripts/controls.js +963 -0
- data/test/rails_root/public/javascripts/dragdrop.js +972 -0
- data/test/rails_root/public/javascripts/effects.js +1120 -0
- data/test/rails_root/public/javascripts/fancyzoom.min.js +1 -0
- data/test/rails_root/public/javascripts/jquery/jquery-ui.js +273 -0
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +1 -0
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +9 -0
- data/test/rails_root/public/javascripts/jquery/jquery.form.js +637 -0
- data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +2 -0
- data/test/rails_root/public/javascripts/jquery/jquery.js +19 -0
- data/test/rails_root/public/javascripts/jquery/jquery.tips.js +69 -0
- data/test/rails_root/public/javascripts/muck.js +80 -0
- data/test/rails_root/public/javascripts/muck_activities.js +108 -0
- data/test/rails_root/public/javascripts/prototype.js +4225 -0
- data/test/rails_root/public/javascripts/scriptaculous.js +58 -0
- data/test/rails_root/public/javascripts/slider.js +277 -0
- data/test/rails_root/public/javascripts/sound.js +60 -0
- data/test/rails_root/public/robots.txt +1 -0
- data/test/rails_root/public/stylesheets/.keep +0 -0
- data/test/rails_root/public/stylesheets/admin.css +12 -0
- data/test/rails_root/public/stylesheets/blueprint/ie.css +26 -0
- data/test/rails_root/public/stylesheets/blueprint/liquid_screen.css +203 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/key.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/readme.txt +32 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/screen.css +97 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/screen.css +71 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/readme.txt +18 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/screen.css +40 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/liquid.css +134 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/src/liquid.css +197 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/readme.txt +10 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/screen.css +109 -0
- data/test/rails_root/public/stylesheets/blueprint/print.css +30 -0
- data/test/rails_root/public/stylesheets/blueprint/screen.css +251 -0
- data/test/rails_root/public/stylesheets/blueprint/sprite.css +1 -0
- data/test/rails_root/public/stylesheets/blueprint/src/forms.css +49 -0
- data/test/rails_root/public/stylesheets/blueprint/src/grid.css +213 -0
- data/test/rails_root/public/stylesheets/blueprint/src/grid.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/src/ie.css +59 -0
- data/test/rails_root/public/stylesheets/blueprint/src/print.css +85 -0
- data/test/rails_root/public/stylesheets/blueprint/src/reset.css +38 -0
- data/test/rails_root/public/stylesheets/blueprint/src/typography.css +105 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_888888_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/jquery.fancybox.css +44 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_217bc0_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_469bdd_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/reset.css +0 -0
- data/test/rails_root/public/stylesheets/styles.css +89 -0
- data/test/rails_root/public/stylesheets/themes/blue/styles.css +1 -0
- data/test/rails_root/public/stylesheets/themes/red/styles.css +1 -0
- data/test/rails_root/script/about +3 -0
- data/test/rails_root/script/breakpointer +3 -0
- data/test/rails_root/script/console +3 -0
- data/test/rails_root/script/create_project.rb +52 -0
- data/test/rails_root/script/cucumber +8 -0
- data/test/rails_root/script/dbconsole +3 -0
- data/test/rails_root/script/destroy +3 -0
- data/test/rails_root/script/generate +3 -0
- data/test/rails_root/script/performance/benchmarker +3 -0
- data/test/rails_root/script/performance/profiler +3 -0
- data/test/rails_root/script/performance/request +3 -0
- data/test/rails_root/script/plugin +3 -0
- data/test/rails_root/script/process/inspector +3 -0
- data/test/rails_root/script/process/reaper +3 -0
- data/test/rails_root/script/process/spawner +3 -0
- data/test/rails_root/script/runner +3 -0
- data/test/rails_root/script/server +3 -0
- data/test/rails_root/test/factories.rb +75 -0
- data/test/rails_root/test/functional/.keep +0 -0
- data/test/rails_root/test/functional/comments_controller_test.rb +72 -0
- data/test/rails_root/test/mocks/development/.keep +0 -0
- data/test/rails_root/test/mocks/test/.keep +0 -0
- data/test/rails_root/test/shoulda_macros/controller.rb +49 -0
- data/test/rails_root/test/shoulda_macros/forms.rb +32 -0
- data/test/rails_root/test/shoulda_macros/models.rb +50 -0
- data/test/rails_root/test/shoulda_macros/pagination.rb +53 -0
- data/test/rails_root/test/shoulda_macros/plugins.rb +34 -0
- data/test/rails_root/test/test_helper.rb +48 -0
- data/test/rails_root/test/unit/.keep +0 -0
- data/test/rails_root/test/unit/comment_test.rb +63 -0
- data/test/rails_root/test/unit/user_test.rb +23 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/README +43 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb +62 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb +132 -0
- data/test/rails_root/vendor/plugins/validation_reflection/CHANGELOG +24 -0
- data/test/rails_root/vendor/plugins/validation_reflection/LICENSE +20 -0
- data/test/rails_root/vendor/plugins/validation_reflection/README +64 -0
- data/test/rails_root/vendor/plugins/validation_reflection/Rakefile +22 -0
- data/test/rails_root/vendor/plugins/validation_reflection/about.yml +7 -0
- data/test/rails_root/vendor/plugins/validation_reflection/init.rb +8 -0
- data/test/rails_root/vendor/plugins/validation_reflection/lib/boiler_plate/validation_reflection.rb +129 -0
- data/test/rails_root/vendor/plugins/validation_reflection/test/test_helper.rb +36 -0
- data/test/rails_root/vendor/plugins/validation_reflection/test/validation_reflection_test.rb +126 -0
- metadata +307 -15
- data/test/db/database.yml +0 -18
- data/test/db/schema.rb +0 -25
- data/test/factories.rb +0 -8
- data/test/functional/comments_controller_test.rb +0 -34
- data/test/test_helper.rb +0 -44
- data/test/unit/comment_test.rb +0 -49
- data/test/unit/commentable_test.rb +0 -7
@@ -0,0 +1,29 @@
|
|
1
|
+
class ActsAsTaggableOnMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :tags do |t|
|
4
|
+
t.column :name, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
create_table :taggings do |t|
|
8
|
+
t.column :tag_id, :integer
|
9
|
+
t.column :taggable_id, :integer
|
10
|
+
t.column :tagger_id, :integer
|
11
|
+
t.column :tagger_type, :string
|
12
|
+
|
13
|
+
# You should make sure that the column created is
|
14
|
+
# long enough to store the required class names.
|
15
|
+
t.column :taggable_type, :string
|
16
|
+
t.column :context, :string
|
17
|
+
|
18
|
+
t.column :created_at, :datetime
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index :taggings, :tag_id
|
22
|
+
add_index :taggings, [:taggable_id, :taggable_type, :context]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.down
|
26
|
+
drop_table :taggings
|
27
|
+
drop_table :tags
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
2
|
+
# please use the migrations feature of Active Record to incrementally modify your database, and
|
3
|
+
# then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
6
|
+
# to create the application database on another system, you should be using db:schema:load, not running
|
7
|
+
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
|
+
#
|
10
|
+
# It's strongly recommended to check this file into your version control system.
|
11
|
+
|
12
|
+
ActiveRecord::Schema.define(:version => 20090730154102) do
|
13
|
+
|
14
|
+
create_table "activities", :force => true do |t|
|
15
|
+
t.integer "item_id"
|
16
|
+
t.string "item_type"
|
17
|
+
t.string "template"
|
18
|
+
t.integer "source_id"
|
19
|
+
t.string "source_type"
|
20
|
+
t.text "content"
|
21
|
+
t.string "title"
|
22
|
+
t.boolean "is_status_update", :default => false
|
23
|
+
t.boolean "is_public", :default => true
|
24
|
+
t.datetime "created_at"
|
25
|
+
t.datetime "updated_at"
|
26
|
+
t.integer "comment_count", :default => 0
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index "activities", ["item_id", "item_type"], :name => "index_activities_on_item_id_and_item_type"
|
30
|
+
|
31
|
+
create_table "activity_feeds", :force => true do |t|
|
32
|
+
t.integer "activity_id"
|
33
|
+
t.integer "ownable_id"
|
34
|
+
t.string "ownable_type"
|
35
|
+
end
|
36
|
+
|
37
|
+
add_index "activity_feeds", ["activity_id"], :name => "index_activity_feeds_on_activity_id"
|
38
|
+
add_index "activity_feeds", ["ownable_id", "ownable_type"], :name => "index_activity_feeds_on_ownable_id_and_ownable_type"
|
39
|
+
|
40
|
+
create_table "comments", :force => true do |t|
|
41
|
+
t.integer "commentable_id", :default => 0
|
42
|
+
t.string "commentable_type", :limit => 15, :default => ""
|
43
|
+
t.text "body"
|
44
|
+
t.integer "user_id"
|
45
|
+
t.integer "parent_id"
|
46
|
+
t.integer "lft"
|
47
|
+
t.integer "rgt"
|
48
|
+
t.integer "is_denied", :default => 0, :null => false
|
49
|
+
t.boolean "is_reviewed", :default => false
|
50
|
+
t.datetime "created_at"
|
51
|
+
t.datetime "updated_at"
|
52
|
+
end
|
53
|
+
|
54
|
+
add_index "comments", ["commentable_id", "commentable_type"], :name => "index_comments_on_commentable_id_and_commentable_type"
|
55
|
+
add_index "comments", ["user_id"], :name => "index_comments_on_user_id"
|
56
|
+
|
57
|
+
create_table "content_permissions", :force => true do |t|
|
58
|
+
t.integer "content_id"
|
59
|
+
t.integer "user_id"
|
60
|
+
t.datetime "created_at"
|
61
|
+
t.datetime "updated_at"
|
62
|
+
end
|
63
|
+
|
64
|
+
add_index "content_permissions", ["content_id", "user_id"], :name => "index_content_permissions_on_content_id_and_user_id"
|
65
|
+
|
66
|
+
create_table "content_translations", :force => true do |t|
|
67
|
+
t.integer "content_id"
|
68
|
+
t.string "title"
|
69
|
+
t.text "body"
|
70
|
+
t.string "locale"
|
71
|
+
t.boolean "user_edited", :default => false
|
72
|
+
t.datetime "created_at"
|
73
|
+
t.datetime "updated_at"
|
74
|
+
end
|
75
|
+
|
76
|
+
add_index "content_translations", ["content_id"], :name => "index_content_translations_on_content_id"
|
77
|
+
add_index "content_translations", ["locale"], :name => "index_content_translations_on_locale"
|
78
|
+
|
79
|
+
create_table "contents", :force => true do |t|
|
80
|
+
t.integer "creator_id"
|
81
|
+
t.string "title"
|
82
|
+
t.text "body"
|
83
|
+
t.string "locale"
|
84
|
+
t.text "body_raw"
|
85
|
+
t.integer "contentable_id"
|
86
|
+
t.string "contentable_type"
|
87
|
+
t.integer "parent_id"
|
88
|
+
t.integer "lft"
|
89
|
+
t.integer "rgt"
|
90
|
+
t.boolean "is_public"
|
91
|
+
t.string "state"
|
92
|
+
t.datetime "created_at"
|
93
|
+
t.datetime "updated_at"
|
94
|
+
end
|
95
|
+
|
96
|
+
add_index "contents", ["creator_id"], :name => "index_contents_on_creator_id"
|
97
|
+
add_index "contents", ["parent_id"], :name => "index_contents_on_parent_id"
|
98
|
+
|
99
|
+
create_table "countries", :force => true do |t|
|
100
|
+
t.string "name", :limit => 128, :default => "", :null => false
|
101
|
+
t.string "abbreviation", :limit => 3, :default => "", :null => false
|
102
|
+
t.integer "sort", :default => 1000, :null => false
|
103
|
+
end
|
104
|
+
|
105
|
+
add_index "countries", ["abbreviation"], :name => "index_countries_on_abbreviation"
|
106
|
+
add_index "countries", ["name"], :name => "index_countries_on_name"
|
107
|
+
|
108
|
+
create_table "friends", :force => true do |t|
|
109
|
+
t.integer "inviter_id"
|
110
|
+
t.integer "invited_id"
|
111
|
+
t.integer "status", :default => 0
|
112
|
+
t.datetime "created_at"
|
113
|
+
t.datetime "updated_at"
|
114
|
+
end
|
115
|
+
|
116
|
+
add_index "friends", ["invited_id", "inviter_id"], :name => "index_friends_on_invited_id_and_inviter_id"
|
117
|
+
add_index "friends", ["inviter_id", "invited_id"], :name => "index_friends_on_inviter_id_and_invited_id"
|
118
|
+
|
119
|
+
create_table "languages", :force => true do |t|
|
120
|
+
t.string "name"
|
121
|
+
t.string "english_name"
|
122
|
+
t.string "locale"
|
123
|
+
t.boolean "supported", :default => true
|
124
|
+
t.integer "is_default", :default => 0
|
125
|
+
end
|
126
|
+
|
127
|
+
add_index "languages", ["locale"], :name => "index_languages_on_locale"
|
128
|
+
add_index "languages", ["name"], :name => "index_languages_on_name"
|
129
|
+
|
130
|
+
create_table "permissions", :force => true do |t|
|
131
|
+
t.integer "role_id", :null => false
|
132
|
+
t.integer "user_id", :null => false
|
133
|
+
t.datetime "created_at"
|
134
|
+
t.datetime "updated_at"
|
135
|
+
end
|
136
|
+
|
137
|
+
create_table "roles", :force => true do |t|
|
138
|
+
t.string "rolename"
|
139
|
+
t.datetime "created_at"
|
140
|
+
t.datetime "updated_at"
|
141
|
+
end
|
142
|
+
|
143
|
+
create_table "slugs", :force => true do |t|
|
144
|
+
t.string "name"
|
145
|
+
t.integer "sluggable_id"
|
146
|
+
t.integer "sequence", :default => 1, :null => false
|
147
|
+
t.string "sluggable_type", :limit => 40
|
148
|
+
t.string "scope", :limit => 40
|
149
|
+
t.datetime "created_at"
|
150
|
+
end
|
151
|
+
|
152
|
+
add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_name_and_sluggable_type_and_scope_and_sequence", :unique => true
|
153
|
+
add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id"
|
154
|
+
|
155
|
+
create_table "states", :force => true do |t|
|
156
|
+
t.string "name", :limit => 128, :default => "", :null => false
|
157
|
+
t.string "abbreviation", :limit => 3, :default => "", :null => false
|
158
|
+
t.integer "country_id", :limit => 8, :null => false
|
159
|
+
end
|
160
|
+
|
161
|
+
add_index "states", ["abbreviation"], :name => "index_states_on_abbreviation"
|
162
|
+
add_index "states", ["country_id"], :name => "index_states_on_country_id"
|
163
|
+
add_index "states", ["name"], :name => "index_states_on_name"
|
164
|
+
|
165
|
+
create_table "taggings", :force => true do |t|
|
166
|
+
t.integer "tag_id"
|
167
|
+
t.integer "taggable_id"
|
168
|
+
t.integer "tagger_id"
|
169
|
+
t.string "tagger_type"
|
170
|
+
t.string "taggable_type"
|
171
|
+
t.string "context"
|
172
|
+
t.datetime "created_at"
|
173
|
+
end
|
174
|
+
|
175
|
+
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
176
|
+
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
177
|
+
|
178
|
+
create_table "tags", :force => true do |t|
|
179
|
+
t.string "name"
|
180
|
+
end
|
181
|
+
|
182
|
+
create_table "users", :force => true do |t|
|
183
|
+
t.string "login"
|
184
|
+
t.string "email"
|
185
|
+
t.string "first_name"
|
186
|
+
t.string "last_name"
|
187
|
+
t.string "crypted_password"
|
188
|
+
t.string "password_salt"
|
189
|
+
t.string "persistence_token"
|
190
|
+
t.string "single_access_token"
|
191
|
+
t.string "perishable_token"
|
192
|
+
t.integer "login_count", :default => 0, :null => false
|
193
|
+
t.integer "failed_login_count", :default => 0, :null => false
|
194
|
+
t.datetime "last_request_at"
|
195
|
+
t.datetime "last_login_at"
|
196
|
+
t.datetime "current_login_at"
|
197
|
+
t.string "current_login_ip"
|
198
|
+
t.string "last_login_ip"
|
199
|
+
t.boolean "terms_of_service", :default => false, :null => false
|
200
|
+
t.string "time_zone", :default => "UTC"
|
201
|
+
t.datetime "disabled_at"
|
202
|
+
t.datetime "activated_at"
|
203
|
+
t.datetime "created_at"
|
204
|
+
t.datetime "updated_at"
|
205
|
+
t.integer "comment_count", :default => 0
|
206
|
+
end
|
207
|
+
|
208
|
+
add_index "users", ["email"], :name => "index_users_on_email"
|
209
|
+
add_index "users", ["last_request_at"], :name => "index_users_on_last_request_at"
|
210
|
+
add_index "users", ["login"], :name => "index_users_on_login"
|
211
|
+
add_index "users", ["perishable_token"], :name => "index_users_on_perishable_token"
|
212
|
+
add_index "users", ["persistence_token"], :name => "index_users_on_persistence_token"
|
213
|
+
add_index "users", ["single_access_token"], :name => "index_users_on_single_access_token"
|
214
|
+
|
215
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: View comments page
|
2
|
+
As a user
|
3
|
+
I want to be able to view and add comments
|
4
|
+
|
5
|
+
Scenario: Anonymous user visits the comments
|
6
|
+
Given I am not logged in
|
7
|
+
And There are comments
|
8
|
+
When I go to "the show comments page"
|
9
|
+
Then I should see "comments"
|
10
|
+
|
11
|
+
Scenario: Logged in user views add comment
|
12
|
+
Given I log in with role "administrator"
|
13
|
+
When I go to "the create comments page"
|
14
|
+
Then I should see "Add a new comment"
|
15
|
+
|
16
|
+
Scenario: Add comment
|
17
|
+
GivenScenario: Logged in user views add comment
|
18
|
+
When I fill in "comment_body" with "a test comment"
|
19
|
+
And I press "Add Comment"
|
20
|
+
Then I should see "added comment"
|
21
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given /^There are comments$/ do
|
2
|
+
create_comments
|
3
|
+
end
|
4
|
+
|
5
|
+
def create_comments(commentable = nil)
|
6
|
+
commentable ||= Factory(:user)
|
7
|
+
comment = Factory(:comment, :commentable => commentable)
|
8
|
+
child = Factory(:comment, :commentable => commentable)
|
9
|
+
child.move_to_child_of(comment)
|
10
|
+
comment
|
11
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
PASSWORD = "asdfasdf"
|
2
|
+
|
3
|
+
def log_in_user(user, password)
|
4
|
+
visit(login_url)
|
5
|
+
fill_in("user_session_login", :with => user.login)
|
6
|
+
fill_in("user_session_password", :with => PASSWORD)
|
7
|
+
click_button("Sign In")
|
8
|
+
end
|
9
|
+
|
10
|
+
def log_in_with_login_and_role(login, role)
|
11
|
+
@user = Factory(:user, :login => login, :password => PASSWORD, :password_confirmation => PASSWORD)
|
12
|
+
@user.add_to_role(role)
|
13
|
+
log_in_user(@user, PASSWORD)
|
14
|
+
end
|
15
|
+
|
16
|
+
def log_in_with_role(role)
|
17
|
+
@user = Factory(:user, :password => PASSWORD, :password_confirmation => PASSWORD)
|
18
|
+
@user.add_to_role(role)
|
19
|
+
log_in_user(@user, PASSWORD)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
Before do
|
24
|
+
ActionMailer::Base.deliveries = []
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# Assumes password is 'asdfasdf'
|
29
|
+
Given /I log in as "(.*)"/ do |login|
|
30
|
+
@user = User.find_by_login(login)
|
31
|
+
log_in_user(@user, PASSWORD)
|
32
|
+
end
|
33
|
+
|
34
|
+
Given /I log in as new user "(.*)" with password "(.*)"/ do |login, password|
|
35
|
+
@user = Factory(:user, :login => login, :password => password, :password_confirmation => password)
|
36
|
+
log_in_user(@user, password)
|
37
|
+
end
|
38
|
+
|
39
|
+
Given /I log in as new user/ do
|
40
|
+
@user = Factory(:user, :password => PASSWORD, :password_confirmation => PASSWORD)
|
41
|
+
log_in_user(@user, PASSWORD)
|
42
|
+
end
|
43
|
+
|
44
|
+
Given /^I log in with role "(.*)"$/ do |role|
|
45
|
+
log_in_with_role(role)
|
46
|
+
end
|
47
|
+
|
48
|
+
Given /^I am not logged in$/ do
|
49
|
+
post '/logout'
|
50
|
+
end
|
51
|
+
|
52
|
+
Then /^I should see the login$/ do
|
53
|
+
response.body.should =~ /sign_in/m
|
54
|
+
response.body.should =~ /user_session_login/m
|
55
|
+
response.body.should =~ /user_session_password/m
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
#features/step_definitions/common_steps.rb
|
60
|
+
# On page/record
|
61
|
+
Given /^I am on "([^"]*)"$/ do |path|
|
62
|
+
visit path
|
63
|
+
end
|
64
|
+
|
65
|
+
Then /^I should be on "([^"]*)"$/ do |path|
|
66
|
+
current_path.should == path
|
67
|
+
end
|
68
|
+
|
69
|
+
Given /^I am on "([^"]*)" "([^"]*)"$/ do |model,number|
|
70
|
+
visit polymorphic_path(record_from_strings(model,number))
|
71
|
+
end
|
72
|
+
|
73
|
+
Then /^I should be on "([^"]*)" "([^"]*)"$/ do |model,number|
|
74
|
+
current_path.should == polymorphic_path(record_from_strings(model,number))
|
75
|
+
end
|
76
|
+
|
77
|
+
# Existing
|
78
|
+
Given /^a "([^"]*)" exists for "([^"]*)" "([^"]*)"$/ do |associated,model,number|
|
79
|
+
record = record_from_strings(model,number)
|
80
|
+
record.send(associated.underscore+'=',valid(associated))
|
81
|
+
record.save!
|
82
|
+
end
|
83
|
+
|
84
|
+
# Support
|
85
|
+
def current_path
|
86
|
+
response.request.request_uri
|
87
|
+
end
|
88
|
+
|
89
|
+
def record_from_strings(model,number)
|
90
|
+
model.constantize.find(:first,:offset=>number.to_i-1)
|
91
|
+
end
|
92
|
+
|
93
|
+
|
@@ -0,0 +1,128 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
2
|
+
|
3
|
+
# Commonly used webrat steps
|
4
|
+
# http://github.com/brynary/webrat
|
5
|
+
|
6
|
+
Given /^I am on (.+)$/ do |page_name|
|
7
|
+
visit path_to(page_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^I go to (.+)$/ do |page_name|
|
11
|
+
visit path_to(page_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
When /^I press "([^\"]*)"$/ do |button|
|
15
|
+
click_button(button)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I follow "([^\"]*)"$/ do |link|
|
19
|
+
click_link(link)
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
23
|
+
fill_in(field, :with => value)
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
27
|
+
select(value, :from => field)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
31
|
+
# When I select "December 25, 2008 10:00" as the date and time
|
32
|
+
When /^I select "([^\"]*)" as the date and time$/ do |time|
|
33
|
+
select_datetime(time)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Use this step when using multiple datetime_select helpers on a page or
|
37
|
+
# you want to specify which datetime to select. Given the following view:
|
38
|
+
# <%= f.label :preferred %><br />
|
39
|
+
# <%= f.datetime_select :preferred %>
|
40
|
+
# <%= f.label :alternative %><br />
|
41
|
+
# <%= f.datetime_select :alternative %>
|
42
|
+
# The following steps would fill out the form:
|
43
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
44
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
45
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
46
|
+
select_datetime(datetime, :from => datetime_label)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Use this step in conjunction with Rail's time_select helper. For example:
|
50
|
+
# When I select "2:20PM" as the time
|
51
|
+
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
52
|
+
# will convert the 2:20PM to 14:20 and then select it.
|
53
|
+
When /^I select "([^\"]*)" as the time$/ do |time|
|
54
|
+
select_time(time)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Use this step when using multiple time_select helpers on a page or you want to
|
58
|
+
# specify the name of the time on the form. For example:
|
59
|
+
# When I select "7:30AM" as the "Gym" time
|
60
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
61
|
+
select_time(time, :from => time_label)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Use this step in conjunction with Rail's date_select helper. For example:
|
65
|
+
# When I select "February 20, 1981" as the date
|
66
|
+
When /^I select "([^\"]*)" as the date$/ do |date|
|
67
|
+
select_date(date)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Use this step when using multiple date_select helpers on one page or
|
71
|
+
# you want to specify the name of the date on the form. For example:
|
72
|
+
# When I select "April 26, 1982" as the "Date of Birth" date
|
73
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
74
|
+
select_date(date, :from => date_label)
|
75
|
+
end
|
76
|
+
|
77
|
+
When /^I check "([^\"]*)"$/ do |field|
|
78
|
+
check(field)
|
79
|
+
end
|
80
|
+
|
81
|
+
When /^I uncheck "([^\"]*)"$/ do |field|
|
82
|
+
uncheck(field)
|
83
|
+
end
|
84
|
+
|
85
|
+
When /^I choose "([^\"]*)"$/ do |field|
|
86
|
+
choose(field)
|
87
|
+
end
|
88
|
+
|
89
|
+
When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
90
|
+
attach_file(field, path)
|
91
|
+
end
|
92
|
+
|
93
|
+
Then /^I should see "([^\"]*)"$/ do |text|
|
94
|
+
response.should contain(text)
|
95
|
+
end
|
96
|
+
|
97
|
+
Then /^I should see \/([^\/]*)\/$/ do |regexp|
|
98
|
+
regexp = Regexp.new(regexp)
|
99
|
+
response.should contain(regexp)
|
100
|
+
end
|
101
|
+
|
102
|
+
Then /^I should not see "([^\"]*)"$/ do |text|
|
103
|
+
response.should_not contain(text)
|
104
|
+
end
|
105
|
+
|
106
|
+
Then /^I should not see \/([^\/]*)\/$/ do |regexp|
|
107
|
+
response.should_not contain(text)
|
108
|
+
end
|
109
|
+
|
110
|
+
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
111
|
+
field_labeled(field).value.should =~ /#{value}/
|
112
|
+
end
|
113
|
+
|
114
|
+
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
115
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
116
|
+
end
|
117
|
+
|
118
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
119
|
+
field_labeled(label).should be_checked
|
120
|
+
end
|
121
|
+
|
122
|
+
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
123
|
+
field_labeled(label).should_not be_checked
|
124
|
+
end
|
125
|
+
|
126
|
+
Then /^I should be on (.+)$/ do |page_name|
|
127
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
128
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Sets up the Rails environment for Cucumber
|
2
|
+
ENV["RAILS_ENV"] ||= "cucumber"
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test/test_helper')
|
5
|
+
require 'cucumber/rails/world'
|
6
|
+
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
|
7
|
+
|
8
|
+
require 'database_cleaner'
|
9
|
+
require 'database_cleaner/cucumber'
|
10
|
+
DatabaseCleaner.strategy = :truncation
|
11
|
+
|
12
|
+
Cucumber::Rails.use_transactional_fixtures
|
13
|
+
|
14
|
+
# Comment out the next line if you want Rails' own error handling
|
15
|
+
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
16
|
+
Cucumber::Rails.bypass_rescue
|
17
|
+
|
18
|
+
require 'webrat'
|
19
|
+
require 'cucumber/webrat/table_locator' # Lets you do table.diff!(table_at('#my_table').to_a)
|
20
|
+
|
21
|
+
# Comment out the next two lines if you're not using RSpec's matchers (should / should_not) in your steps.
|
22
|
+
require 'cucumber/rails/rspec'
|
23
|
+
#require 'webrat/rspec-rails'
|
24
|
+
|
25
|
+
require 'webrat/core/matchers'
|
26
|
+
|
27
|
+
Webrat.configure do |config|
|
28
|
+
config.mode = :rails
|
29
|
+
end
|
30
|
+
|
31
|
+
# Webrat.configure do |config|
|
32
|
+
# config.mode = :selenium
|
33
|
+
# config.application_environment = :test
|
34
|
+
# config.application_framework = :rails
|
35
|
+
# end
|
36
|
+
|
37
|
+
# To enable selenium:
|
38
|
+
# 1. sudo gem install selenium-client
|
39
|
+
# 2. uncomment Webrat.configure that contains :selenium and then comment out the one that contains :rails above
|
40
|
+
# 3. set: self.use_transactional_fixtures = false in test_helper.rb
|
41
|
+
# 4. uncomment in test_helper.rb:
|
42
|
+
# setup do |session|
|
43
|
+
# session.host! "localhost:3001"
|
44
|
+
# end
|
45
|
+
# 5. Be sure to apply the patch mentioned in the viget article below found here: http://gist.github.com/141590
|
46
|
+
|
47
|
+
# References:
|
48
|
+
# http://www.brynary.com/2009/4/6/switching-webrat-to-selenium-mode
|
49
|
+
# http://www.viget.com/extend/getting-started-with-webrat-selenium-rails-and-firefox-3/
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
# Maps a name to a path. Used by the
|
3
|
+
#
|
4
|
+
# When /^I go to (.+)$/ do |page_name|
|
5
|
+
#
|
6
|
+
# step definition in webrat_steps.rb
|
7
|
+
#
|
8
|
+
def path_to(page_name)
|
9
|
+
case page_name
|
10
|
+
|
11
|
+
when /the homepage/
|
12
|
+
'/'
|
13
|
+
|
14
|
+
when /the show comments page/
|
15
|
+
comment_path(Comment.first)
|
16
|
+
|
17
|
+
when /the create comments page/
|
18
|
+
new_comment_path(make_parent_params(Factory(:user)))
|
19
|
+
|
20
|
+
# Add more mappings here.
|
21
|
+
# Here is a more fancy example:
|
22
|
+
#
|
23
|
+
# when /^(.*)'s profile page$/i
|
24
|
+
# user_profile_path(User.find_by_login($1))
|
25
|
+
|
26
|
+
else
|
27
|
+
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
28
|
+
"Now, go and add a mapping in #{__FILE__}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
World(NavigationHelpers)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
|
2
|
+
|
3
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
|
8
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
9
|
+
t.fork = true
|
10
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
11
|
+
end
|
12
|
+
task :features => 'db:test:prepare'
|
13
|
+
rescue LoadError
|
14
|
+
desc 'Cucumber rake task not available'
|
15
|
+
task :features do
|
16
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# General Apache options
|
2
|
+
AddHandler fastcgi-script .fcgi
|
3
|
+
AddHandler cgi-script .cgi
|
4
|
+
Options +FollowSymLinks +ExecCGI
|
5
|
+
|
6
|
+
# If you don't want Rails to look in certain directories,
|
7
|
+
# use the following rewrite rules so that Apache won't rewrite certain requests
|
8
|
+
#
|
9
|
+
# Example:
|
10
|
+
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
11
|
+
# RewriteRule .* - [L]
|
12
|
+
|
13
|
+
# Redirect all requests not available on the filesystem to Rails
|
14
|
+
# By default the cgi dispatcher is used which is very slow
|
15
|
+
#
|
16
|
+
# For better performance replace the dispatcher with the fastcgi one
|
17
|
+
#
|
18
|
+
# Example:
|
19
|
+
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
20
|
+
RewriteEngine On
|
21
|
+
|
22
|
+
# If your Rails application is accessed via an Alias directive,
|
23
|
+
# then you MUST also set the RewriteBase in this htaccess file.
|
24
|
+
#
|
25
|
+
# Example:
|
26
|
+
# Alias /myrailsapp /path/to/myrailsapp/public
|
27
|
+
# RewriteBase /myrailsapp
|
28
|
+
|
29
|
+
RewriteRule ^$ index.html [QSA]
|
30
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
31
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
32
|
+
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
33
|
+
|
34
|
+
# In case Rails experiences terminal errors
|
35
|
+
# Instead of displaying this message you can supply a file here which will be rendered instead
|
36
|
+
#
|
37
|
+
# Example:
|
38
|
+
# ErrorDocument 500 /500.html
|
39
|
+
|
40
|
+
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|