calagator 0.0.1.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +23 -0
- data/README.md +75 -0
- data/Rakefile +12 -0
- data/app/assets/images/confused-alligator-sm.png +0 -0
- data/app/assets/images/disk.png +0 -0
- data/app/assets/images/edit.png +0 -0
- data/app/assets/images/external_sites/epdx.png +0 -0
- data/app/assets/images/external_sites/external.gif +0 -0
- data/app/assets/images/external_sites/facebook.png +0 -0
- data/app/assets/images/external_sites/foursquare.png +0 -0
- data/app/assets/images/external_sites/gowalla.png +0 -0
- data/app/assets/images/external_sites/lanyrd.png +0 -0
- data/app/assets/images/external_sites/meetup.png +0 -0
- data/app/assets/images/external_sites/plancast.png +0 -0
- data/app/assets/images/external_sites/shizzow.png +0 -0
- data/app/assets/images/external_sites/upcoming.png +0 -0
- data/app/assets/images/external_sites/yelp.png +0 -0
- data/app/assets/images/feed.png +0 -0
- data/app/assets/images/heart.png +0 -0
- data/app/assets/images/icon_ical.gif +0 -0
- data/app/assets/images/information.png +0 -0
- data/app/assets/images/nav_marker.gif +0 -0
- data/app/assets/images/nav_marker.png +0 -0
- data/app/assets/images/plus.png +0 -0
- data/app/assets/images/redx.png +0 -0
- data/app/assets/images/site-icon.png +0 -0
- data/app/assets/images/spinner.gif +0 -0
- data/app/assets/images/star.png +0 -0
- data/app/assets/images/subnav_marker.gif +0 -0
- data/app/assets/images/subnav_marker.png +0 -0
- data/app/assets/images/tag_blue.png +0 -0
- data/app/assets/images/tag_icons/angular.png +0 -0
- data/app/assets/images/tag_icons/beer.png +0 -0
- data/app/assets/images/tag_icons/bitcoin.png +0 -0
- data/app/assets/images/tag_icons/free.png +0 -0
- data/app/assets/images/tag_icons/golang.png +0 -0
- data/app/assets/images/tag_icons/html.png +0 -0
- data/app/assets/images/tag_icons/javascript.png +0 -0
- data/app/assets/images/tag_icons/linux.png +0 -0
- data/app/assets/images/tag_icons/php.png +0 -0
- data/app/assets/images/tag_icons/pizza.png +0 -0
- data/app/assets/images/tag_icons/python.png +0 -0
- data/app/assets/images/tag_icons/rails.png +0 -0
- data/app/assets/images/tag_icons/ruby.png +0 -0
- data/app/assets/images/tag_icons/sass.png +0 -0
- data/app/assets/images/tag_icons/swift.png +0 -0
- data/app/assets/images/transmit_blue.png +0 -0
- data/app/assets/images/weekday_background.gif +0 -0
- data/app/assets/javascripts/calagator.js +18 -0
- data/app/assets/javascripts/calagator/forms.js +60 -0
- data/app/assets/stylesheets/calagator.scss +8 -0
- data/app/assets/stylesheets/calagator/common.scss +14 -0
- data/app/assets/stylesheets/calagator/datepicker.scss +177 -0
- data/app/assets/stylesheets/calagator/errors.css +110 -0
- data/app/assets/stylesheets/calagator/forms.scss +4 -0
- data/app/assets/stylesheets/calagator/reset.css +40 -0
- data/app/assets/stylesheets/calagator/theme.css +0 -0
- data/app/controllers/calagator/admin_controller.rb +27 -0
- data/app/controllers/calagator/application_controller.rb +82 -0
- data/app/controllers/calagator/events_controller.rb +171 -0
- data/app/controllers/calagator/site_controller.rb +35 -0
- data/app/controllers/calagator/sources_controller.rb +94 -0
- data/app/controllers/calagator/venues_controller.rb +133 -0
- data/app/controllers/calagator/versions_controller.rb +20 -0
- data/app/helpers/calagator/application_helper.rb +128 -0
- data/app/helpers/calagator/events_helper.rb +184 -0
- data/app/helpers/calagator/google_event_export_helper.rb +67 -0
- data/app/helpers/calagator/mapping_helper.rb +103 -0
- data/app/helpers/calagator/sources_helper.rb +10 -0
- data/app/helpers/calagator/tags_helper.rb +42 -0
- data/app/helpers/calagator/time_range_helper.rb +166 -0
- data/app/models/calagator/event.rb +246 -0
- data/app/models/calagator/event/cloner.rb +39 -0
- data/app/models/calagator/event/ical_renderer.rb +155 -0
- data/app/models/calagator/event/overview.rb +45 -0
- data/app/models/calagator/event/saver.rb +58 -0
- data/app/models/calagator/event/search.rb +72 -0
- data/app/models/calagator/event/search_engine.rb +28 -0
- data/app/models/calagator/event/search_engine/apache_sunspot.rb +106 -0
- data/app/models/calagator/event/search_engine/sql.rb +107 -0
- data/app/models/calagator/source.rb +115 -0
- data/app/models/calagator/source/importer.rb +46 -0
- data/app/models/calagator/source/parser.rb +128 -0
- data/app/models/calagator/source/parser/facebook.rb +67 -0
- data/app/models/calagator/source/parser/hcal.rb +108 -0
- data/app/models/calagator/source/parser/http_authentication_required_error.rb +6 -0
- data/app/models/calagator/source/parser/ical.rb +186 -0
- data/app/models/calagator/source/parser/meetup.rb +72 -0
- data/app/models/calagator/source/parser/not_found.rb +9 -0
- data/app/models/calagator/source/parser/plancast.rb +59 -0
- data/app/models/calagator/venue.rb +161 -0
- data/app/models/calagator/venue/geocoder.rb +51 -0
- data/app/models/calagator/venue/search.rb +63 -0
- data/app/models/calagator/venue/search_engine.rb +24 -0
- data/app/models/calagator/venue/search_engine/apache_sunspot.rb +85 -0
- data/app/models/calagator/venue/search_engine/sql.rb +68 -0
- data/app/models/event/search_engine/base.rb +0 -0
- data/app/observers/calagator/cache_observer.rb +37 -0
- data/app/views/calagator/admin/events.html.erb +28 -0
- data/app/views/calagator/admin/index.html.erb +8 -0
- data/app/views/calagator/events/_feed_item.html.erb +62 -0
- data/app/views/calagator/events/_form.html.erb +63 -0
- data/app/views/calagator/events/_gcal_reminder.html.erb +1 -0
- data/app/views/calagator/events/_hcal.html.erb +41 -0
- data/app/views/calagator/events/_item.html.erb +120 -0
- data/app/views/calagator/events/_list.html.erb +30 -0
- data/app/views/calagator/events/_list_item.html.erb +37 -0
- data/app/views/calagator/events/_search_section.html.erb +15 -0
- data/app/views/calagator/events/_subnav.html.erb +13 -0
- data/app/views/calagator/events/_table.html.erb +74 -0
- data/app/views/calagator/events/duplicates.html.erb +58 -0
- data/app/views/calagator/events/edit.html.erb +3 -0
- data/app/views/calagator/events/index.atom.builder +32 -0
- data/app/views/calagator/events/index.html.erb +51 -0
- data/app/views/calagator/events/index.kml.erb +20 -0
- data/app/views/calagator/events/new.html.erb +7 -0
- data/app/views/calagator/events/search.html.erb +25 -0
- data/app/views/calagator/events/show.html.erb +81 -0
- data/app/views/calagator/site/_appropriateness_message.html.erb +15 -0
- data/app/views/calagator/site/_description.html.erb +3 -0
- data/app/views/calagator/site/about.html.erb +7 -0
- data/app/views/calagator/site/defunct.html.erb +15 -0
- data/app/views/calagator/site/export.html.erb +4 -0
- data/app/views/calagator/site/index.html.erb +40 -0
- data/app/views/calagator/site/opensearch.xml.builder +8 -0
- data/app/views/calagator/sources/_subnav.html.erb +0 -0
- data/app/views/calagator/sources/edit.html.erb +12 -0
- data/app/views/calagator/sources/import.html.erb +10 -0
- data/app/views/calagator/sources/index.html.erb +22 -0
- data/app/views/calagator/sources/new.html.erb +32 -0
- data/app/views/calagator/sources/show.html.erb +16 -0
- data/app/views/calagator/venues/_form.html.erb +57 -0
- data/app/views/calagator/venues/_subnav.html.erb +10 -0
- data/app/views/calagator/venues/duplicates.html.erb +65 -0
- data/app/views/calagator/venues/edit.html.erb +3 -0
- data/app/views/calagator/venues/index.html.erb +93 -0
- data/app/views/calagator/venues/index.kml.erb +15 -0
- data/app/views/calagator/venues/map.html.erb +4 -0
- data/app/views/calagator/venues/new.html.erb +5 -0
- data/app/views/calagator/venues/show.html.erb +113 -0
- data/app/views/calagator/versions/_chooser.html.erb +28 -0
- data/app/views/calagator/versions/_edit_with_chooser.html.erb +16 -0
- data/app/views/layouts/calagator/application.html.erb +110 -0
- data/config/deploy/local.rb +37 -0
- data/config/deploy/lucca.rb +33 -0
- data/config/initializers/dates.rb +7 -0
- data/config/initializers/formtastic.rb +82 -0
- data/config/initializers/geokit.rb +74 -0
- data/config/initializers/ics_renderer.rb +6 -0
- data/config/initializers/load_tag_model_extensions.rb +3 -0
- data/config/initializers/mime_types.rb +9 -0
- data/config/initializers/observers.rb +1 -0
- data/config/initializers/search_engine.rb +4 -0
- data/config/initializers/set_default_url_host.rb +5 -0
- data/config/initializers/time_get_zone.rb +8 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +55 -0
- data/config/secrets.yml.blag +75 -0
- data/config/sunspot.yml +23 -0
- data/db/development.sqlite3 +0 -0
- data/db/development.sqlite3.bak +0 -0
- data/db/development.sqlite3.old +0 -0
- data/db/development~20111112@110950.sqlite3 +0 -0
- data/db/migrate/001_create_events.rb +17 -0
- data/db/migrate/002_create_venues.rb +17 -0
- data/db/migrate/003_create_sources.rb +16 -0
- data/db/migrate/004_add_detailed_fields_to_venue.rb +19 -0
- data/db/migrate/005_add_end_time_to_events.rb +9 -0
- data/db/migrate/006_add_source_id_to_events.rb +9 -0
- data/db/migrate/008_add_source_id_to_venues.rb +10 -0
- data/db/migrate/009_add_duplicate_of_column_to_venues.rb +9 -0
- data/db/migrate/010_add_duplicate_of_column_to_events.rb +9 -0
- data/db/migrate/011_change_lat_long_type.rb +12 -0
- data/db/migrate/012_add_source_reimport.rb +9 -0
- data/db/migrate/013_change_end_time_to_duration.rb +11 -0
- data/db/migrate/014_remove_format_type_from_source.rb +9 -0
- data/db/migrate/015_create_updates.rb +15 -0
- data/db/migrate/016_remove_next_update_from_source.rb +9 -0
- data/db/migrate/20080705163959_change_duration_to_end_time.rb +11 -0
- data/db/migrate/20080705164959_create_tags_and_taggings.rb +28 -0
- data/db/migrate/20081011181519_create_versioned_events.rb +25 -0
- data/db/migrate/20081011193124_create_versioned_venues.rb +32 -0
- data/db/migrate/20081115190515_add_rrule_to_events.rb +15 -0
- data/db/migrate/20090912082129_create_versions.rb +18 -0
- data/db/migrate/20110219205156_add_closed_flag_to_venues.rb +9 -0
- data/db/migrate/20110220001008_add_wifi_flag_to_venues.rb +9 -0
- data/db/migrate/20110220011427_add_access_notes_to_venues.rb +9 -0
- data/db/migrate/20110220031117_add_events_count_to_venues.rb +8 -0
- data/db/migrate/20110604174521_add_venue_details_to_events.rb +9 -0
- data/db/migrate/20110717231316_acts_as_taggable_on_migration.rb +50 -0
- data/db/migrate/20120709092821_cleanup.rb +14 -0
- data/db/migrate/20120831234448_specify_venues_latitude_and_longitude_precision.rb +11 -0
- data/db/migrate/20150206085809_remove_updates.rb +13 -0
- data/db/migrate/20150207231355_add_locked_status_to_events.rb +5 -0
- data/db/production.sqlite3 +0 -0
- data/db/schema.rb +102 -0
- data/db/seeds.rb +16 -0
- data/db/test.sqlite3 +0 -0
- data/db/test2.sqlite3 +0 -0
- data/lib/calagator.rb +30 -0
- data/lib/calagator/blacklist_validator.rb +69 -0
- data/lib/calagator/decode_html_entities_hack.rb +33 -0
- data/lib/calagator/duplicate_checking.rb +133 -0
- data/lib/calagator/duplicate_checking/controller_actions.rb +38 -0
- data/lib/calagator/duplicate_checking/duplicate_finder.rb +83 -0
- data/lib/calagator/duplicate_checking/duplicate_squasher.rb +74 -0
- data/lib/calagator/engine.rb +30 -0
- data/lib/calagator/strip_whitespace.rb +19 -0
- data/lib/calagator/tag_model_extensions.rb +104 -0
- data/lib/calagator/url_prefixer.rb +9 -0
- data/lib/calagator/version.rb +3 -0
- data/lib/generators/calagator/install_generator.rb +39 -0
- data/lib/generators/calagator/templates/config/calagator.rb +26 -0
- data/lib/generators/calagator/templates/config/secrets.yml.sample +83 -0
- data/lib/secrets_reader.rb +76 -0
- data/lib/tasks/spec_db.rake +53 -0
- data/lib/tasks/sunspot_reindex_calagator.rake +6 -0
- data/lib/tasks/sunspot_solr_restart_enhancements.rake +19 -0
- data/lib/tasks/update_counter_caches.rake +13 -0
- data/lib/templates/erb/scaffold/_form.html.erb +11 -0
- data/lib/theme_reader.rb +17 -0
- data/lib/wait_for_solr.rb +25 -0
- data/spec/controllers/calagator/application_controller_spec.rb +47 -0
- data/spec/controllers/calagator/events_controller_spec.rb +794 -0
- data/spec/controllers/calagator/site_controller_spec.rb +59 -0
- data/spec/controllers/calagator/sources_controller_spec.rb +439 -0
- data/spec/controllers/calagator/venues_controller_spec.rb +319 -0
- data/spec/controllers/calagator/versions_controller_spec.rb +82 -0
- data/spec/controllers/squash_many_duplicates_examples.rb +49 -0
- data/spec/dummy/Gemfile +39 -0
- data/spec/dummy/Gemfile.lock +195 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +14 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/calagator.rb +26 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +59 -0
- data/spec/dummy/config/secrets.yml +83 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150309023304_create_events.calagator.rb +18 -0
- data/spec/dummy/db/migrate/20150309023305_create_venues.calagator.rb +18 -0
- data/spec/dummy/db/migrate/20150309023306_create_sources.calagator.rb +17 -0
- data/spec/dummy/db/migrate/20150309023307_add_detailed_fields_to_venue.calagator.rb +20 -0
- data/spec/dummy/db/migrate/20150309023308_add_end_time_to_events.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023309_add_source_id_to_events.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023310_add_source_id_to_venues.calagator.rb +11 -0
- data/spec/dummy/db/migrate/20150309023311_add_duplicate_of_column_to_venues.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023312_add_duplicate_of_column_to_events.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023313_change_lat_long_type.calagator.rb +13 -0
- data/spec/dummy/db/migrate/20150309023314_add_source_reimport.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023315_change_end_time_to_duration.calagator.rb +12 -0
- data/spec/dummy/db/migrate/20150309023316_remove_format_type_from_source.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023317_create_updates.calagator.rb +16 -0
- data/spec/dummy/db/migrate/20150309023318_remove_next_update_from_source.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023319_change_duration_to_end_time.calagator.rb +12 -0
- data/spec/dummy/db/migrate/20150309023320_create_tags_and_taggings.calagator.rb +29 -0
- data/spec/dummy/db/migrate/20150309023321_create_versioned_events.calagator.rb +26 -0
- data/spec/dummy/db/migrate/20150309023322_create_versioned_venues.calagator.rb +33 -0
- data/spec/dummy/db/migrate/20150309023323_add_rrule_to_events.calagator.rb +16 -0
- data/spec/dummy/db/migrate/20150309023324_create_versions.calagator.rb +19 -0
- data/spec/dummy/db/migrate/20150309023325_add_closed_flag_to_venues.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023326_add_wifi_flag_to_venues.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023327_add_access_notes_to_venues.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023328_add_events_count_to_venues.calagator.rb +9 -0
- data/spec/dummy/db/migrate/20150309023329_add_venue_details_to_events.calagator.rb +10 -0
- data/spec/dummy/db/migrate/20150309023330_acts_as_taggable_on_migration.calagator.rb +51 -0
- data/spec/dummy/db/migrate/20150309023331_cleanup.calagator.rb +15 -0
- data/spec/dummy/db/migrate/20150309023332_specify_venues_latitude_and_longitude_precision.calagator.rb +12 -0
- data/spec/dummy/db/migrate/20150309023333_remove_updates.calagator.rb +14 -0
- data/spec/dummy/db/migrate/20150309023334_add_locked_status_to_events.calagator.rb +6 -0
- data/spec/dummy/db/schema.rb +95 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/doc/README_FOR_APP +2 -0
- data/spec/dummy/log/development.log +273 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/test/performance/browsing_test.rb +12 -0
- data/spec/dummy/test/test_helper.rb +13 -0
- data/spec/factories.rb +93 -0
- data/spec/features/add_event_spec.rb +99 -0
- data/spec/features/add_venue_spec.rb +34 -0
- data/spec/features/admin_auth_spec.rb +22 -0
- data/spec/features/admin_lock_event_spec.rb +41 -0
- data/spec/features/import_events_from_feed_spec.rb +43 -0
- data/spec/features/managing_event_spec.rb +111 -0
- data/spec/features/managing_venue_spec.rb +71 -0
- data/spec/features/search_event_spec.rb +27 -0
- data/spec/helpers/calagator/application_helper_spec.rb +82 -0
- data/spec/helpers/calagator/events_helper_spec.rb +172 -0
- data/spec/helpers/calagator/google_event_export_helper_spec.rb +70 -0
- data/spec/helpers/calagator/sources_helper_spec.rb +12 -0
- data/spec/helpers/calagator/tags_helper_spec.rb +85 -0
- data/spec/helpers/calagator/time_range_helper_spec.rb +59 -0
- data/spec/lib/calagator/blacklist_validator_spec.rb +65 -0
- data/spec/lib/calagator/decode_html_entities_hack_spec.rb +54 -0
- data/spec/lib/calagator/settings_spec.rb +20 -0
- data/spec/lib/calagator/url_prefixer_spec.rb +33 -0
- data/spec/lib/secrets_reader_spec.rb +65 -0
- data/spec/models/calagator/event/cloner_spec.rb +43 -0
- data/spec/models/calagator/event/overview_spec.rb +79 -0
- data/spec/models/calagator/event/search_spec.rb +103 -0
- data/spec/models/calagator/event_search_spec.rb +149 -0
- data/spec/models/calagator/event_spec.rb +859 -0
- data/spec/models/calagator/source/parser_facebook_spec.rb +73 -0
- data/spec/models/calagator/source/parser_hcal_spec.rb +69 -0
- data/spec/models/calagator/source/parser_ical_non_standard_spec.rb +91 -0
- data/spec/models/calagator/source/parser_ical_spec.rb +322 -0
- data/spec/models/calagator/source/parser_meetup_spec.rb +69 -0
- data/spec/models/calagator/source/parser_plancast_spec.rb +53 -0
- data/spec/models/calagator/source/parser_spec.rb +238 -0
- data/spec/models/calagator/source_spec.rb +135 -0
- data/spec/models/calagator/venue/search_spec.rb +92 -0
- data/spec/models/calagator/venue_search_spec.rb +124 -0
- data/spec/models/calagator/venue_spec.rb +346 -0
- data/spec/models/tag_spec.rb +35 -0
- data/spec/rails_helper.rb +39 -0
- data/spec/spec_helper.rb +140 -0
- data/spec/support/disable_geocoding.rb +1 -0
- data/spec/support/http_samples.rb +5 -0
- data/spec/support/samples/facebook.json +23 -0
- data/spec/support/samples/hcal_basic.xml +6 -0
- data/spec/support/samples/hcal_dup_event_dup_venue.xml +13 -0
- data/spec/support/samples/hcal_event_duplicates_fixture.xml +13 -0
- data/spec/support/samples/hcal_event_wo_lat_and_long.xml +14 -0
- data/spec/support/samples/hcal_multiple.xml +16 -0
- data/spec/support/samples/hcal_same_event_twice_with_different_venues.xml +12 -0
- data/spec/support/samples/hcal_single.xml +8 -0
- data/spec/support/samples/hcal_two_identical_events.xml +14 -0
- data/spec/support/samples/hcal_upcoming_v1.html +412 -0
- data/spec/support/samples/hcal_upcoming_v2.html +749 -0
- data/spec/support/samples/hcal_upcoming_v3.html +685 -0
- data/spec/support/samples/hcal_upcoming_v4.html +761 -0
- data/spec/support/samples/ical_apple.ics +22 -0
- data/spec/support/samples/ical_apple_v3.ics +37 -0
- data/spec/support/samples/ical_basic.ics +15 -0
- data/spec/support/samples/ical_basic_with_duration.ics +16 -0
- data/spec/support/samples/ical_event_with_squashed_venue.ics +12 -0
- data/spec/support/samples/ical_eventful_many.ics +504 -0
- data/spec/support/samples/ical_gmt.ics +12 -0
- data/spec/support/samples/ical_google.ics +786 -0
- data/spec/support/samples/ical_multiple_calendars.ics +111 -0
- data/spec/support/samples/ical_upcoming.ics +36 -0
- data/spec/support/samples/ical_upcoming_many.ics +682 -0
- data/spec/support/samples/ical_upcoming_v2.ics +43 -0
- data/spec/support/samples/ical_z.ics +10 -0
- data/spec/support/samples/meetup.ics +16 -0
- data/spec/support/samples/meetup.json +31 -0
- data/spec/support/samples/plancast.ics +59 -0
- data/spec/support/samples/plancast.json +51 -0
- data/spec/support/samples/plancast_with_missing_venue.json +39 -0
- data/spec/support/samples/upcoming_v1.xml +8 -0
- data/spec/support/samples/upcoming_v2_with_invalid_utc_dates.xml +8 -0
- data/spec/support/time_convenience_methods.rb +8 -0
- data/spec/support/time_zones.rb +12 -0
- data/spec/support/url_helpers.rb +5 -0
- data/spec/support/wait_for_ajax.rb +15 -0
- data/spec/support/webmock.rb +8 -0
- data/spec/travis_spec.rb +7 -0
- metadata +1194 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Calagator
|
4
|
+
|
5
|
+
describe SiteController, :type => :controller do
|
6
|
+
routes { Calagator::Engine.routes }
|
7
|
+
|
8
|
+
describe "#omfg" do
|
9
|
+
it "raises an error" do
|
10
|
+
expect { get :omfg }.to raise_exception(ArgumentError, "OMFG")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#hello" do
|
15
|
+
it "renders 'hello' in plain text" do
|
16
|
+
get :hello
|
17
|
+
expect(response.body).to eq("hello")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#index" do
|
22
|
+
it "should render requests for HTML successfully" do
|
23
|
+
get :index
|
24
|
+
expect(response).to be_success
|
25
|
+
expect(response).to render_template :index
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should redirect requests for non-HTML to events" do
|
29
|
+
get :index, :format => "json"
|
30
|
+
expect(response).to redirect_to(events_path(:format => "json"))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "about" do
|
35
|
+
it "renders an html document" do
|
36
|
+
get :about
|
37
|
+
expect(response).to be_success
|
38
|
+
expect(response).to render_template :about
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "opensearch" do
|
43
|
+
it "renders an xml document" do
|
44
|
+
get :opensearch, format: "xml"
|
45
|
+
expect(response).to be_success
|
46
|
+
expect(response).to render_template :opensearch
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "defunct" do
|
51
|
+
it "renders an html document" do
|
52
|
+
get :defunct
|
53
|
+
expect(response).to be_success
|
54
|
+
expect(response).to render_template :defunct
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,439 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Calagator
|
4
|
+
|
5
|
+
describe SourcesController, :type => :controller do
|
6
|
+
routes { Calagator::Engine.routes }
|
7
|
+
|
8
|
+
describe "using import logic" do
|
9
|
+
before(:each) do
|
10
|
+
@venue = mock_model(Venue,
|
11
|
+
:source => nil,
|
12
|
+
:source= => true,
|
13
|
+
:save! => true,
|
14
|
+
:duplicate_of_id =>nil)
|
15
|
+
|
16
|
+
@event = mock_model(Event,
|
17
|
+
:title => "Super Event",
|
18
|
+
:source= => true,
|
19
|
+
:save! => true,
|
20
|
+
:venue => @venue,
|
21
|
+
:start_time => Time.now+1.week,
|
22
|
+
:end_time => nil,
|
23
|
+
:duplicate_of_id => nil)
|
24
|
+
|
25
|
+
@source = Source.new(:url => "http://my.url/")
|
26
|
+
allow(@source).to receive(:save!).and_return(true)
|
27
|
+
allow(@source).to receive(:to_events).and_return([@event])
|
28
|
+
|
29
|
+
allow(Source).to receive(:new).and_return(@source)
|
30
|
+
allow(Source).to receive(:find_or_create_by_url).and_return(@source)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should provide a way to create new sources" do
|
34
|
+
get :new
|
35
|
+
expect(assigns(:source)).to be_a_kind_of Source
|
36
|
+
expect(assigns(:source)).to be_a_new_record
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "with render views" do
|
40
|
+
render_views
|
41
|
+
|
42
|
+
it "should save the source object when creating events" do
|
43
|
+
expect(@source).to receive(:save!)
|
44
|
+
post :import, :source => {:url => @source.url}
|
45
|
+
expect(flash[:success]).to match /Imported/i
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should limit the number of created events to list in the flash" do
|
49
|
+
excess = 5
|
50
|
+
events = (1..(5+excess))\
|
51
|
+
.inject([]){|result,i| result << @event; result}
|
52
|
+
expect(@source).to receive(:to_events).and_return(events)
|
53
|
+
post :import, :source => {:url => @source.url}
|
54
|
+
expect(flash[:success]).to match /And #{excess} other events/si
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should assign newly-created events to the source" do
|
59
|
+
post :import, :source => {:url => @source.url}
|
60
|
+
expect(@event).to be_persisted
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should assign newly created venues to the source" do
|
64
|
+
post :import, :source => {:url => @source.url}
|
65
|
+
expect(@venue).to be_persisted
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
describe "is given problematic sources" do
|
70
|
+
before do
|
71
|
+
@source = stub_model(Source)
|
72
|
+
expect(Source).to receive(:find_or_create_from).and_return(@source)
|
73
|
+
end
|
74
|
+
|
75
|
+
def assert_import_raises(exception)
|
76
|
+
expect(@source).to receive(:create_events!).and_raise(exception)
|
77
|
+
post :import, :source => {:url => "http://invalid.host"}
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should fail when host responds with no events" do
|
81
|
+
expect(@source).to receive(:create_events!).and_return([])
|
82
|
+
post :import, :source => {:url => "http://empty.host"}
|
83
|
+
expect(flash[:failure]).to match /Unable to find any upcoming events to import from this source/
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should fail when host responds with a 404" do
|
87
|
+
assert_import_raises(Source::Parser::NotFound)
|
88
|
+
expect(flash[:failure]).to match /No events found at remote site/
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should fail when host responds with an error" do
|
92
|
+
assert_import_raises(OpenURI::HTTPError.new("omfg", "bbq"))
|
93
|
+
expect(flash[:failure]).to match /Couldn't download events/
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should fail when host is not responding" do
|
97
|
+
assert_import_raises(Errno::EHOSTUNREACH.new("omfg"))
|
98
|
+
expect(flash[:failure]).to match /Couldn't connect to remote site/
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should fail when host is not found" do
|
102
|
+
assert_import_raises(SocketError.new("omfg"))
|
103
|
+
expect(flash[:failure]).to match /Couldn't find IP address for remote site/
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should fail when host requires authentication" do
|
107
|
+
assert_import_raises(Source::Parser::HttpAuthenticationRequiredError.new("omfg"))
|
108
|
+
expect(flash[:failure]).to match /requires authentication/
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should fail when host throws something strange" do
|
112
|
+
assert_import_raises(TypeError)
|
113
|
+
expect(flash[:failure]).to match /Unknown error: TypeError/
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
describe "handling GET /sources" do
|
120
|
+
|
121
|
+
before(:each) do
|
122
|
+
@source = mock_model(Source)
|
123
|
+
allow(Source).to receive(:listing).and_return([@source])
|
124
|
+
end
|
125
|
+
|
126
|
+
def do_get
|
127
|
+
get :index
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should be successful" do
|
131
|
+
do_get
|
132
|
+
expect(response).to be_success
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should render index template" do
|
136
|
+
do_get
|
137
|
+
expect(response).to render_template :index
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should find sources" do
|
141
|
+
expect(Source).to receive(:listing).and_return([@source])
|
142
|
+
do_get
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should assign the found sources for the view" do
|
146
|
+
do_get
|
147
|
+
expect(assigns[:sources]).to eq [@source]
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe "handling GET /sources.xml" do
|
152
|
+
|
153
|
+
before(:each) do
|
154
|
+
@sources = double("Array of Sources", :to_xml => "XML")
|
155
|
+
allow(Source).to receive(:find).and_return(@sources)
|
156
|
+
end
|
157
|
+
|
158
|
+
def do_get
|
159
|
+
@request.env["HTTP_ACCEPT"] = "application/xml"
|
160
|
+
get :index
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should be successful" do
|
164
|
+
do_get
|
165
|
+
expect(response).to be_success
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should find all sources" do
|
169
|
+
expect(Source).to receive(:listing).and_return(@sources)
|
170
|
+
do_get
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should render the found sources as xml" do
|
174
|
+
do_get
|
175
|
+
expect(response.content_type).to eq 'application/xml'
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe "show" do
|
180
|
+
it "should redirect when asked for unknown source" do
|
181
|
+
expect(Source).to receive(:find).and_raise(ActiveRecord::RecordNotFound.new)
|
182
|
+
get :show, :id => "1"
|
183
|
+
|
184
|
+
expect(response).to be_redirect
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe "handling GET /sources/1" do
|
189
|
+
|
190
|
+
before(:each) do
|
191
|
+
@source = mock_model(Source)
|
192
|
+
allow(Source).to receive(:find).and_return(@source)
|
193
|
+
end
|
194
|
+
|
195
|
+
def do_get
|
196
|
+
get :show, :id => "1"
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should be successful" do
|
200
|
+
do_get
|
201
|
+
expect(response).to be_success
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should render show template" do
|
205
|
+
do_get
|
206
|
+
expect(response).to render_template :show
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should find the source requested" do
|
210
|
+
expect(Source).to receive(:find).with("1", :include => [:events, :venues]).and_return(@source)
|
211
|
+
do_get
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should assign the found source for the view" do
|
215
|
+
do_get
|
216
|
+
expect(assigns[:source]).to eq @source
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
describe "handling GET /sources/1.xml" do
|
221
|
+
|
222
|
+
before(:each) do
|
223
|
+
@source = mock_model(Source, :to_xml => "XML")
|
224
|
+
allow(Source).to receive(:find).and_return(@source)
|
225
|
+
end
|
226
|
+
|
227
|
+
def do_get
|
228
|
+
@request.env["HTTP_ACCEPT"] = "application/xml"
|
229
|
+
get :show, :id => "1"
|
230
|
+
end
|
231
|
+
|
232
|
+
it "should be successful" do
|
233
|
+
do_get
|
234
|
+
expect(response).to be_success
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should find the source requested" do
|
238
|
+
expect(Source).to receive(:find).with("1", :include => [:events, :venues]).and_return(@source)
|
239
|
+
do_get
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should render the found source as xml" do
|
243
|
+
expect(@source).to receive(:to_xml).and_return("XML")
|
244
|
+
do_get
|
245
|
+
expect(response.body).to eq "XML"
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
describe "handling GET /sources/new" do
|
250
|
+
|
251
|
+
before(:each) do
|
252
|
+
@source = mock_model(Source)
|
253
|
+
allow(Source).to receive(:new).and_return(@source)
|
254
|
+
end
|
255
|
+
|
256
|
+
def do_get
|
257
|
+
get :new
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should be successful" do
|
261
|
+
do_get
|
262
|
+
expect(response).to be_success
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should render new template" do
|
266
|
+
do_get
|
267
|
+
expect(response).to render_template :new
|
268
|
+
end
|
269
|
+
|
270
|
+
it "should create an new source" do
|
271
|
+
expect(Source).to receive(:new).and_return(@source)
|
272
|
+
do_get
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should not save the new source" do
|
276
|
+
expect(@source).not_to receive(:save)
|
277
|
+
do_get
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should assign the new source for the view" do
|
281
|
+
do_get
|
282
|
+
expect(assigns[:source]).to eq @source
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
describe "handling GET /sources/1/edit" do
|
287
|
+
|
288
|
+
before(:each) do
|
289
|
+
@source = mock_model(Source)
|
290
|
+
allow(Source).to receive(:find).and_return(@source)
|
291
|
+
end
|
292
|
+
|
293
|
+
def do_get
|
294
|
+
get :edit, :id => "1"
|
295
|
+
end
|
296
|
+
|
297
|
+
it "should be successful" do
|
298
|
+
do_get
|
299
|
+
expect(response).to be_success
|
300
|
+
end
|
301
|
+
|
302
|
+
it "should render edit template" do
|
303
|
+
do_get
|
304
|
+
expect(response).to render_template :edit
|
305
|
+
end
|
306
|
+
|
307
|
+
it "should find the source requested" do
|
308
|
+
expect(Source).to receive(:find).and_return(@source)
|
309
|
+
do_get
|
310
|
+
end
|
311
|
+
|
312
|
+
it "should assign the found Source for the view" do
|
313
|
+
do_get
|
314
|
+
expect(assigns[:source]).to eq @source
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
describe "handling POST /sources" do
|
319
|
+
|
320
|
+
before(:each) do
|
321
|
+
@source = mock_model(Source, :to_param => "1")
|
322
|
+
allow(Source).to receive(:new).and_return(@source)
|
323
|
+
end
|
324
|
+
|
325
|
+
describe "with successful save" do
|
326
|
+
|
327
|
+
def do_post
|
328
|
+
expect(@source).to receive(:update_attributes).and_return(true)
|
329
|
+
post :create, :source => {}
|
330
|
+
end
|
331
|
+
|
332
|
+
it "should create a new source" do
|
333
|
+
expect(Source).to receive(:new).and_return(@source)
|
334
|
+
do_post
|
335
|
+
end
|
336
|
+
|
337
|
+
it "should redirect to the new source" do
|
338
|
+
do_post
|
339
|
+
expect(response).to redirect_to(source_url("1"))
|
340
|
+
end
|
341
|
+
|
342
|
+
end
|
343
|
+
|
344
|
+
describe "with failed save" do
|
345
|
+
|
346
|
+
def do_post
|
347
|
+
expect(@source).to receive(:update_attributes).and_return(false)
|
348
|
+
allow(@source).to receive_messages(new_record?: true)
|
349
|
+
post :create, :source => {}
|
350
|
+
end
|
351
|
+
|
352
|
+
it "should re-render 'new'" do
|
353
|
+
do_post
|
354
|
+
expect(response).to render_template :new
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
describe "handling PUT /sources/1" do
|
361
|
+
|
362
|
+
before(:each) do
|
363
|
+
@source = mock_model(Source, :to_param => "1")
|
364
|
+
allow(Source).to receive(:find).and_return(@source)
|
365
|
+
end
|
366
|
+
|
367
|
+
describe "with successful update" do
|
368
|
+
|
369
|
+
def do_put
|
370
|
+
expect(@source).to receive(:update_attributes).and_return(true)
|
371
|
+
put :update, :id => "1"
|
372
|
+
end
|
373
|
+
|
374
|
+
it "should find the source requested" do
|
375
|
+
expect(Source).to receive(:find).with("1").and_return(@source)
|
376
|
+
do_put
|
377
|
+
end
|
378
|
+
|
379
|
+
it "should update the found source" do
|
380
|
+
do_put
|
381
|
+
expect(assigns(:source)).to eq @source
|
382
|
+
end
|
383
|
+
|
384
|
+
it "should assign the found source for the view" do
|
385
|
+
do_put
|
386
|
+
expect(assigns(:source)).to eq @source
|
387
|
+
end
|
388
|
+
|
389
|
+
it "should redirect to the source" do
|
390
|
+
do_put
|
391
|
+
expect(response).to redirect_to(source_url("1"))
|
392
|
+
end
|
393
|
+
|
394
|
+
end
|
395
|
+
|
396
|
+
describe "with failed update" do
|
397
|
+
|
398
|
+
def do_put
|
399
|
+
expect(@source).to receive(:update_attributes).and_return(false)
|
400
|
+
put :update, :id => "1"
|
401
|
+
end
|
402
|
+
|
403
|
+
it "should re-render 'edit'" do
|
404
|
+
do_put
|
405
|
+
expect(response).to render_template :edit
|
406
|
+
end
|
407
|
+
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
describe "handling DELETE /sources/1" do
|
412
|
+
|
413
|
+
before(:each) do
|
414
|
+
@source = mock_model(Source, :destroy => true)
|
415
|
+
allow(Source).to receive(:find).and_return(@source)
|
416
|
+
end
|
417
|
+
|
418
|
+
def do_delete
|
419
|
+
delete :destroy, :id => "1"
|
420
|
+
end
|
421
|
+
|
422
|
+
it "should find the source requested" do
|
423
|
+
expect(Source).to receive(:find).with("1").and_return(@source)
|
424
|
+
do_delete
|
425
|
+
end
|
426
|
+
|
427
|
+
it "should call destroy on the found source" do
|
428
|
+
expect(@source).to receive(:destroy)
|
429
|
+
do_delete
|
430
|
+
end
|
431
|
+
|
432
|
+
it "should redirect to the sources list" do
|
433
|
+
do_delete
|
434
|
+
expect(response).to redirect_to(sources_url)
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
end
|