storytime 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +448 -0
- data/Guardfile +24 -0
- data/MIT-LICENSE +1 -1
- data/README.md +160 -0
- data/app/assets/{javascripts/storytime/subscriptions.js → images/storytime/.keep} +0 -0
- data/app/assets/images/storytime/storytime-logo-nav-light.png +0 -0
- data/app/assets/images/storytime/storytime-logo-nav.png +0 -0
- data/app/assets/images/storytime/storytime-logo.png +0 -0
- data/app/assets/javascripts/storytime/application.js +11 -3
- data/app/assets/javascripts/storytime/base.js.coffee +44 -6
- data/app/assets/javascripts/storytime/blog_posts.js.coffee +16 -0
- data/app/assets/javascripts/storytime/blogs.js.coffee +18 -0
- data/app/assets/javascripts/storytime/character_counter.js.coffee +26 -0
- data/app/assets/javascripts/storytime/contenteditable.js.coffee +15 -0
- data/app/assets/javascripts/storytime/custom_posts.js.coffee +16 -0
- data/app/assets/javascripts/storytime/editor.js.coffee +50 -134
- data/app/assets/javascripts/storytime/media.js.coffee +91 -22
- data/app/assets/javascripts/storytime/pages.js.coffee +16 -0
- data/app/assets/javascripts/storytime/posts.js.coffee +28 -1
- data/app/assets/javascripts/storytime/sites.js.coffee +1 -16
- data/app/assets/javascripts/storytime/snippets.js.coffee +6 -3
- data/app/assets/javascripts/storytime/tags.js.coffee +17 -0
- data/app/assets/javascripts/storytime/users.js.coffee +10 -0
- data/app/assets/javascripts/storytime/wysiwyg.js.coffee +183 -0
- data/app/assets/stylesheets/storytime/_buttons.scss +70 -0
- data/app/assets/stylesheets/storytime/_dropdowns.scss +5 -0
- data/app/assets/stylesheets/storytime/_forms.scss +3 -0
- data/app/assets/stylesheets/storytime/_list-group.scss +13 -0
- data/app/assets/stylesheets/storytime/_pagination.scss +14 -0
- data/app/assets/stylesheets/storytime/_panels.scss +8 -0
- data/app/assets/stylesheets/storytime/_tabs.scss +38 -0
- data/app/assets/stylesheets/storytime/_type.scss +13 -0
- data/app/assets/stylesheets/storytime/_wells.scss +14 -0
- data/app/assets/stylesheets/storytime/admin.scss +42 -0
- data/app/assets/stylesheets/storytime/application.scss +75 -0
- data/app/assets/stylesheets/storytime/{comments.css.scss → comments.scss} +0 -0
- data/app/assets/stylesheets/storytime/icons.scss +79 -0
- data/app/assets/stylesheets/storytime/layout.scss +21 -0
- data/app/assets/stylesheets/storytime/media.scss +65 -0
- data/app/assets/stylesheets/storytime/modals.scss +46 -0
- data/app/assets/stylesheets/storytime/navigation.scss +137 -0
- data/app/assets/stylesheets/storytime/posts.scss +76 -0
- data/app/assets/stylesheets/storytime/scroll-panels.scss +19 -0
- data/app/assets/stylesheets/storytime/snippets.scss +11 -0
- data/app/assets/stylesheets/storytime/{sites.css.scss → subscriptions.scss} +0 -0
- data/app/assets/stylesheets/storytime/versions.scss +21 -0
- data/app/controllers/storytime/application_controller.rb +36 -16
- data/app/controllers/storytime/blog_homepage_controller.rb +10 -0
- data/app/controllers/storytime/blogs_controller.rb +56 -0
- data/app/controllers/storytime/comments_controller.rb +5 -1
- data/app/controllers/storytime/dashboard/autosaves_controller.rb +7 -3
- data/app/controllers/storytime/dashboard/blog_posts_controller.rb +60 -0
- data/app/controllers/storytime/dashboard/blogs_controller.rb +66 -0
- data/app/controllers/storytime/dashboard/custom_posts_controller.rb +51 -0
- data/app/controllers/storytime/dashboard/media_controller.rb +9 -7
- data/app/controllers/storytime/dashboard/memberships_controller.rb +49 -0
- data/app/controllers/storytime/dashboard/pages_controller.rb +24 -0
- data/app/controllers/storytime/dashboard/posts_controller.rb +29 -38
- data/app/controllers/storytime/dashboard/roles_controller.rb +16 -2
- data/app/controllers/storytime/dashboard/sites_controller.rb +25 -11
- data/app/controllers/storytime/dashboard/snippets_controller.rb +19 -14
- data/app/controllers/storytime/dashboard/subscriptions_controller.rb +9 -5
- data/app/controllers/storytime/dashboard/users_controller.rb +24 -22
- data/app/controllers/storytime/dashboard_controller.rb +9 -3
- data/app/controllers/storytime/homepage_controller.rb +10 -0
- data/app/controllers/storytime/pages_controller.rb +30 -13
- data/app/controllers/storytime/posts_controller.rb +22 -53
- data/app/controllers/storytime/subscriptions_controller.rb +5 -4
- data/app/helpers/storytime/application_helper.rb +28 -7
- data/app/helpers/storytime/dashboard/sites_helper.rb +2 -5
- data/app/helpers/storytime/subscriptions_helper.rb +0 -7
- data/app/inputs/date_time_picker_input.rb +1 -1
- data/app/mailers/storytime/subscription_mailer.rb +1 -3
- data/app/models/concerns/storytime/post_comments.rb +17 -0
- data/app/models/concerns/storytime/post_excerpt.rb +14 -0
- data/app/models/concerns/storytime/post_featured_images.rb +8 -0
- data/app/models/concerns/storytime/post_partial_inheritance.rb +29 -0
- data/app/models/concerns/storytime/post_tags.rb +41 -0
- data/app/models/concerns/storytime/scoped_to_site.rb +11 -0
- data/app/models/storytime/action.rb +1 -0
- data/app/models/storytime/autosave.rb +7 -1
- data/app/models/storytime/blog.rb +16 -0
- data/app/models/storytime/blog_post.rb +12 -1
- data/app/models/storytime/comment.rb +4 -1
- data/app/models/storytime/media.rb +2 -0
- data/app/models/storytime/membership.rb +17 -0
- data/app/models/storytime/page.rb +0 -5
- data/app/models/storytime/permission.rb +26 -20
- data/app/models/storytime/post.rb +29 -82
- data/app/models/storytime/role.rb +12 -0
- data/app/models/storytime/site.rb +42 -12
- data/app/models/storytime/snippet.rb +3 -0
- data/app/models/storytime/subscription.rb +2 -1
- data/app/models/storytime/tag.rb +5 -1
- data/app/models/storytime/tagging.rb +1 -0
- data/app/models/storytime/version.rb +1 -0
- data/app/policies/admin_policy.rb +30 -0
- data/app/policies/storytime/comment_policy.rb +5 -1
- data/app/policies/storytime/membership_policy.rb +32 -0
- data/app/policies/storytime/post_policy.rb +6 -4
- data/app/policies/storytime/site_policy.rb +7 -2
- data/app/policies/storytime/snippet_policy.rb +3 -2
- data/app/policies/storytime/subscription_policy.rb +3 -2
- data/app/policies/user_policy.rb +2 -5
- data/app/views/kaminari/_first_page.html.erb +13 -0
- data/app/views/kaminari/_gap.html.erb +8 -0
- data/app/views/kaminari/_last_page.html.erb +13 -0
- data/app/views/kaminari/_next_page.html.erb +13 -0
- data/app/views/kaminari/_page.html.erb +12 -0
- data/app/views/kaminari/_paginator.html.erb +24 -0
- data/app/views/kaminari/_prev_page.html.erb +13 -0
- data/app/views/layouts/storytime/application.html.erb +1 -1
- data/app/views/layouts/storytime/dashboard.html.erb +22 -6
- data/app/views/storytime/application/storytime/_disqus_comment_counts.html.erb +14 -0
- data/app/views/storytime/application/storytime/_header.html.erb +3 -4
- data/app/views/storytime/application/storytime/_navigation.html.erb +14 -1
- data/app/views/storytime/blogs/_tags.html.erb +3 -0
- data/app/views/storytime/{posts/index.atom.builder → blogs/show.atom.builder} +1 -1
- data/app/views/storytime/{posts/index.html.erb → blogs/show.html.erb} +1 -1
- data/app/views/storytime/comments/_discourse.html.erb +18 -0
- data/app/views/storytime/comments/_disqus.html.erb +2 -2
- data/app/views/storytime/comments/_form.html.erb +2 -2
- data/app/views/storytime/dashboard/_navigation.html.erb +109 -41
- data/app/views/storytime/dashboard/_settings_tabs.html.erb +32 -0
- data/app/views/storytime/dashboard/autosaves/_autosave_info.html.erb +7 -4
- data/app/views/storytime/dashboard/blog_posts/_form.html.erb +157 -0
- data/app/views/storytime/dashboard/blog_posts/edit.html.erb +55 -0
- data/app/views/storytime/dashboard/blog_posts/new.html.erb +31 -0
- data/app/views/storytime/dashboard/blogs/_blog.html.erb +3 -0
- data/app/views/storytime/dashboard/blogs/_form.html.erb +25 -0
- data/app/views/storytime/dashboard/blogs/edit.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/blogs/index.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/blogs/new.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/media/_form.html.erb +3 -3
- data/app/views/storytime/dashboard/media/{_gallery.html → _gallery.html.erb} +7 -4
- data/app/views/storytime/dashboard/media/_media.html.erb +6 -13
- data/app/views/storytime/dashboard/media/_modal.html.erb +3 -3
- data/app/views/storytime/dashboard/media/index.html.erb +15 -5
- data/app/views/storytime/dashboard/memberships/_form.html.erb +12 -0
- data/app/views/storytime/dashboard/memberships/_index.html.erb +39 -0
- data/app/views/storytime/dashboard/memberships/_membership.html.erb +12 -0
- data/app/views/storytime/dashboard/memberships/index.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/memberships/save.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/pages/_form.html.erb +88 -0
- data/app/views/storytime/dashboard/pages/_index_title.html.erb +1 -0
- data/app/views/storytime/dashboard/pages/_new_button.html.erb +1 -0
- data/app/views/storytime/dashboard/pages/edit.html.erb +49 -0
- data/app/views/storytime/dashboard/pages/new.html.erb +28 -0
- data/app/views/storytime/dashboard/posts/_form.html.erb +128 -122
- data/app/views/storytime/dashboard/posts/_image_toolbar.html.erb +32 -0
- data/app/views/storytime/dashboard/posts/_index_title.html.erb +1 -0
- data/app/views/storytime/dashboard/posts/_list.html.erb +23 -24
- data/app/views/storytime/dashboard/posts/_new_button.html.erb +10 -0
- data/app/views/storytime/dashboard/posts/edit.html.erb +56 -13
- data/app/views/storytime/dashboard/posts/index.html.erb +56 -7
- data/app/views/storytime/dashboard/posts/new.html.erb +29 -8
- data/app/views/storytime/dashboard/roles/_form.html.erb +41 -0
- data/app/views/storytime/dashboard/roles/edit.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/sites/_form.html.erb +31 -15
- data/app/views/storytime/dashboard/sites/new.html.erb +21 -8
- data/app/views/storytime/dashboard/sites/site.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/snippets/_form.html.erb +26 -12
- data/app/views/storytime/dashboard/snippets/_index.html.erb +17 -0
- data/app/views/storytime/dashboard/snippets/_snippet.html.erb +12 -0
- data/app/views/storytime/dashboard/snippets/edit.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/snippets/index.json.jbuilder +4 -0
- data/app/views/storytime/dashboard/snippets/new.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/subscriptions/_form.html.erb +19 -0
- data/app/views/storytime/dashboard/subscriptions/_index.html.erb +19 -0
- data/app/views/storytime/dashboard/subscriptions/_subscription.html.erb +9 -10
- data/app/views/storytime/dashboard/subscriptions/form.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/subscriptions/index.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/users/_edit.html.erb +26 -0
- data/app/views/storytime/dashboard/users/_new.html.erb +25 -0
- data/app/views/storytime/dashboard/users/edit.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/users/new.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/versions/_version.html.erb +14 -0
- data/app/views/storytime/dashboard/versions/_versions_info.html.erb +1 -16
- data/app/views/storytime/pages/show.html.erb +1 -1
- data/app/views/storytime/posts/_post.html.erb +8 -0
- data/app/views/storytime/posts/_tags.html.erb +1 -1
- data/app/views/storytime/posts/show.html.erb +1 -1
- data/app/views/storytime/sites/_google_analytics_code.html.erb +2 -2
- data/app/views/storytime/snippets/_snippet.html.erb +9 -0
- data/app/views/storytime/subscription_mailer/new_post_email.html.erb +2 -2
- data/app/views/storytime/subscription_mailer/new_post_email.text.erb +2 -2
- data/app/views/storytime/subscriptions/_form.html.erb +0 -1
- data/app/views/storytime/subscriptions/_modal.html.erb +18 -10
- data/bin/rails +12 -0
- data/bin/storytime +4 -0
- data/circle.yml +3 -0
- data/config/initializers/storytime_admin.rb +3 -0
- data/config/initializers/url_for_patch.rb +2 -37
- data/config/locales/en.yml +33 -13
- data/config/routes.rb +47 -19
- data/db/migrate/20150128185746_seed_new_actions_and_permissions.rb +9 -0
- data/db/migrate/20150206201847_add_site_id_to_storytime_post.rb +7 -0
- data/db/migrate/20150206201919_add_site_id_to_storytime_snippet.rb +7 -0
- data/db/migrate/20150206201931_add_site_id_to_storytime_tag.rb +7 -0
- data/db/migrate/20150206205256_add_notification_fields_to_storytime_post.rb +6 -0
- data/db/migrate/20150216211257_add_subdomain_to_storytime_sites.rb +5 -0
- data/db/migrate/20150216225045_add_site_to_storytime_media.rb +6 -0
- data/db/migrate/20150219210528_remove_root_page_content_from_storytime_sites.rb +12 -0
- data/db/migrate/20150220184902_add_blog_id_to_posts.rb +6 -0
- data/db/migrate/20150224192138_add_homepage_path_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224193151_add_subscription_email_from_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224193551_add_layout_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224194559_add_disqus_forum_shortname_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224212453_remove_homepage_path_from_storytime_sites.rb +5 -0
- data/db/migrate/20150225143516_add_site_id_to_storytime_autosaves.rb +6 -0
- data/db/migrate/20150225143826_add_site_id_to_storytime_comments.rb +6 -0
- data/db/migrate/20150225145119_add_site_id_to_storytime_versions.rb +6 -0
- data/db/migrate/20150225145316_add_site_id_to_storytime_taggings.rb +6 -0
- data/db/migrate/20150225145608_update_storytime_site_id_columns.rb +11 -0
- data/db/migrate/20150225164232_add_site_id_to_storytime_permissions.rb +6 -0
- data/db/migrate/20150225212917_create_storytime_memberships.rb +11 -0
- data/db/migrate/20150225213535_create_memberships_for_storytime_users.rb +8 -0
- data/db/migrate/20150226201739_add_custom_domain_to_storytime_sites.rb +5 -0
- data/db/migrate/20150302171500_add_site_id_to_storytime_media.rb +8 -0
- data/db/migrate/20150302171722_set_site_layout.rb +8 -0
- data/db/migrate/20150302185138_remove_storytime_role_id_from_users.rb +5 -0
- data/db/migrate/20150302192525_transfer_posts_to_blogs.rb +8 -0
- data/db/migrate/20150302192759_seed_permissions.rb +9 -0
- data/db/migrate/20150331162329_add_discourse_name_to_storytime_sites.rb +5 -0
- data/db/migrate/20150402161427_remove_subdomain_from_storytime_site.rb +5 -0
- data/lib/generators/storytime/install_generator.rb +17 -0
- data/lib/generators/storytime/views_generator.rb +21 -9
- data/lib/generators/templates/storytime.rb +70 -27
- data/lib/storytime/cli/install.rb +274 -0
- data/lib/storytime/cli.rb +28 -0
- data/lib/storytime/concerns/current_site.rb +10 -0
- data/lib/storytime/concerns/has_versions.rb +22 -3
- data/lib/storytime/concerns/storytime_user.rb +31 -7
- data/lib/storytime/constraints/blog_constraint.rb +11 -0
- data/lib/storytime/constraints/blog_homepage_constraint.rb +11 -0
- data/lib/storytime/constraints/page_constraint.rb +13 -0
- data/lib/storytime/constraints/page_homepage_constraint.rb +11 -0
- data/lib/storytime/engine.rb +43 -14
- data/lib/storytime/generators/initializer.rb +45 -0
- data/lib/storytime/migrators/v1.rb +122 -0
- data/lib/storytime/post_notifier.rb +19 -0
- data/lib/storytime/post_url_handler.rb +47 -0
- data/lib/storytime/storytime_helpers.rb +12 -0
- data/lib/storytime/version.rb +1 -1
- data/lib/storytime.rb +57 -56
- data/screenshots/admin.png +0 -0
- data/screenshots/media.png +0 -0
- data/screenshots/page-list.png +0 -0
- data/screenshots/post-editor.png +0 -0
- data/screenshots/site-settings.png +0 -0
- data/screenshots/text-snippets.png +0 -0
- data/screenshots/user-management.png +0 -0
- data/spec/controllers/dashboard_controller_spec.rb +3 -1
- data/{app/assets/stylesheets/storytime/subscriptions.css.scss → spec/dummy/app/assets/images/.keep} +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +3 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -1
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/storytime_admin/widgets_controller.rb +5 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +5 -1
- data/spec/dummy/app/models/video_post.rb +2 -0
- data/spec/dummy/app/models/widget.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +1 -1
- data/spec/dummy/app/views/storytime/dashboard/posts/_video_post_fields.html.erb +1 -0
- data/spec/dummy/app/views/widgets/storytime/dashboard/admin/_headers.html.erb +1 -0
- data/spec/dummy/app/views/widgets/storytime/dashboard/admin/_row.html.erb +1 -0
- data/spec/dummy/config/database.yml +9 -5
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/config/initializers/devise.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/initializers/storytime.rb +7 -14
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150127172846_create_widgets.rb +9 -0
- data/spec/dummy/db/migrate/20150206203824_add_video_url_to_storytime_posts.rb +5 -0
- data/spec/dummy/db/schema.rb +76 -21
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/factories/comment_factories.rb +1 -0
- data/spec/factories/membership_factories.rb +7 -0
- data/spec/factories/site_factories.rb +3 -2
- data/spec/factories/user_factories.rb +3 -3
- data/spec/factories/widget_factories.rb +5 -0
- data/spec/features/blogs_spec.rb +28 -0
- data/spec/features/comments_spec.rb +8 -9
- data/spec/features/dashboard/media_spec.rb +14 -30
- data/spec/features/dashboard/memberships_spec.rb +58 -0
- data/spec/features/dashboard/pages_spec.rb +67 -44
- data/spec/features/dashboard/posts_spec.rb +84 -62
- data/spec/features/dashboard/sites_spec.rb +28 -23
- data/spec/features/dashboard/snippets_spec.rb +44 -44
- data/spec/features/dashboard/subscription_spec.rb +36 -28
- data/spec/features/dashboard/users_spec.rb +48 -29
- data/spec/features/pages_spec.rb +2 -2
- data/spec/features/posts_spec.rb +2 -20
- data/spec/features/subscription_spec.rb +4 -4
- data/spec/models/post_spec.rb +26 -17
- data/spec/policies/comment_policy_spec.rb +22 -6
- data/spec/policies/post_policy_spec.rb +21 -3
- data/spec/requests/routings_spec.rb +27 -17
- data/spec/spec_helper.rb +12 -1
- data/spec/support/database_cleaner.rb +5 -5
- data/spec/support/domains.rb +18 -0
- data/spec/support/feature_macros.rb +18 -9
- data/storytime.gemspec +59 -0
- data/vendor/assets/javascripts/.DS_Store +0 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +717 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +120 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +686 -0
- data/vendor/assets/javascripts/codemirror/modes/liquid.js +40 -0
- data/vendor/assets/javascripts/codemirror/modes/overlay.js +85 -0
- data/vendor/assets/javascripts/codemirror/{xml.js → modes/xml.js} +2 -2
- data/vendor/assets/javascripts/medium-editor.min.js +2450 -0
- data/vendor/assets/javascripts/phantom_js_bind_polyfill.js +24 -0
- data/vendor/assets/javascripts/tidy.js +30 -0
- data/vendor/assets/stylesheets/.DS_Store +0 -0
- data/vendor/assets/stylesheets/chosen-bootstrap-3.css +148 -0
- data/vendor/assets/stylesheets/{chosen.css.scss → chosen.scss} +1 -1
- data/vendor/assets/stylesheets/disable-transitions-for-test-env.css +7 -0
- data/vendor/assets/stylesheets/medium-editor-default.min.css +1 -0
- data/vendor/assets/stylesheets/medium-editor.min.css +1 -0
- metadata +297 -47
- data/app/assets/stylesheets/storytime/admin.css.scss +0 -121
- data/app/assets/stylesheets/storytime/application.css.scss +0 -22
- data/app/assets/stylesheets/storytime/layout.css.scss +0 -17
- data/app/assets/stylesheets/storytime/media.css.scss +0 -68
- data/app/assets/stylesheets/storytime/pagination.css.scss +0 -4
- data/app/assets/stylesheets/storytime/posts.css.scss +0 -30
- data/app/assets/stylesheets/storytime/versions.css.scss +0 -21
- data/app/helpers/storytime/dashboard/posts_helper.rb +0 -21
- data/app/views/storytime/blog_posts/_blog_post.html.erb +0 -8
- data/app/views/storytime/dashboard/posts/_basic_new_post_button.html.erb +0 -3
- data/app/views/storytime/dashboard/posts/_new_post_dropdown_button.html.erb +0 -10
- data/app/views/storytime/dashboard/sites/edit.html.erb +0 -25
- data/app/views/storytime/dashboard/snippets/_list.html.erb +0 -21
- data/app/views/storytime/dashboard/snippets/edit.html.erb +0 -13
- data/app/views/storytime/dashboard/snippets/index.html.erb +0 -13
- data/app/views/storytime/dashboard/snippets/new.html.erb +0 -12
- data/app/views/storytime/dashboard/subscriptions/edit.html.erb +0 -10
- data/app/views/storytime/dashboard/subscriptions/index.html.erb +0 -19
- data/app/views/storytime/dashboard/subscriptions/new.html.erb +0 -9
- data/app/views/storytime/dashboard/users/_user.html.erb +0 -11
- data/app/views/storytime/dashboard/users/edit.html.erb +0 -10
- data/app/views/storytime/dashboard/users/index.html.erb +0 -22
- data/app/views/storytime/dashboard/users/new.html.erb +0 -11
- data/spec/lib/storytime_spec.rb +0 -23
- data/vendor/assets/javascripts/codemirror/codemirror.js +0 -7831
- data/vendor/assets/javascripts/summernote.js +0 -5338
- data/vendor/assets/stylesheets/codemirror/codemirror.css +0 -309
- data/vendor/assets/stylesheets/codemirror/monokai.css +0 -31
- data/vendor/assets/stylesheets/summernote.css +0 -1
@@ -4,44 +4,63 @@ describe "In the dashboard, Users" do
|
|
4
4
|
context "as Admin" do
|
5
5
|
before{ login_admin }
|
6
6
|
|
7
|
-
it "
|
8
|
-
|
9
|
-
visit
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
it "edits own profile", js: true do
|
8
|
+
u = User.last
|
9
|
+
visit storytime.dashboard_path
|
10
|
+
click_link "utility-menu-toggle"
|
11
|
+
click_link "profile-link"
|
12
|
+
fill_in "user_email", with: "new_email@example.com"
|
13
|
+
click_button "Save"
|
14
|
+
|
15
|
+
within "#storytime-modal" do
|
16
|
+
storytime_name_field = find_field('user_storytime_name').value
|
17
|
+
storytime_email_field = find_field('user_email').value
|
18
|
+
|
19
|
+
expect(storytime_name_field).to eq u.storytime_name
|
20
|
+
expect(storytime_email_field).to eq "new_email@example.com"
|
13
21
|
end
|
14
22
|
end
|
15
23
|
|
16
|
-
it "edits
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
24
|
+
it "edits another user's profile", js: true do
|
25
|
+
FactoryGirl.create :membership, site: @current_site
|
26
|
+
u = User.last
|
27
|
+
|
28
|
+
visit storytime.dashboard_path
|
29
|
+
click_link "utility-menu-toggle"
|
30
|
+
click_link "users-link"
|
31
|
+
|
32
|
+
click_link u.storytime_name
|
33
|
+
|
34
|
+
fill_in "user_email", with: "change_email@example.com"
|
35
|
+
click_button "Save"
|
36
|
+
|
37
|
+
within "#storytime-modal" do
|
38
|
+
storytime_name_field = find_field('user_storytime_name').value
|
39
|
+
storytime_email_field = find_field('user_email').value
|
40
|
+
|
41
|
+
expect(storytime_name_field).to eq u.storytime_name
|
42
|
+
expect(storytime_email_field).to eq "change_email@example.com"
|
43
|
+
end
|
22
44
|
end
|
23
45
|
|
24
|
-
it "creates a user" do
|
25
|
-
visit
|
46
|
+
it "creates a user", js: true do
|
47
|
+
visit storytime.dashboard_path
|
48
|
+
click_link "utility-menu-toggle"
|
49
|
+
click_link "users-link"
|
50
|
+
|
51
|
+
click_link "new-user-link"
|
52
|
+
|
53
|
+
fill_in "user_storytime_name", with: "New Storytime Username"
|
26
54
|
fill_in "user_email", with: "new_user@example.com"
|
55
|
+
select "Editor", from: "Storytime role"
|
27
56
|
fill_in "user_password", with: "password"
|
28
57
|
fill_in "user_password_confirmation", with: "password"
|
29
|
-
click_button "
|
30
|
-
|
31
|
-
|
58
|
+
click_button "Save"
|
59
|
+
|
60
|
+
within "#storytime-modal" do
|
61
|
+
expect(page).to have_content "New Storytime Username"
|
62
|
+
end
|
32
63
|
end
|
33
64
|
|
34
|
-
it "deletes a user", js: true do
|
35
|
-
FactoryGirl.create_list(:user, 3)
|
36
|
-
visit dashboard_users_path
|
37
|
-
p1 = Storytime.user_class.first
|
38
|
-
p2 = Storytime.user_class.last
|
39
|
-
click_link("delete_user_#{p2.id}")
|
40
|
-
|
41
|
-
page.should_not have_content(p2.email)
|
42
|
-
page.should have_content(p1.email)
|
43
|
-
|
44
|
-
expect{ p2.reload }.to raise_error
|
45
|
-
end
|
46
65
|
end
|
47
66
|
end
|
data/spec/features/pages_spec.rb
CHANGED
@@ -2,11 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Pages" do
|
4
4
|
before do
|
5
|
-
setup_site
|
5
|
+
setup_site(FactoryGirl.create(:admin))
|
6
6
|
end
|
7
7
|
|
8
8
|
it "shows a page" do
|
9
|
-
pg = FactoryGirl.create(:page)
|
9
|
+
pg = FactoryGirl.create(:page, site: @current_site)
|
10
10
|
visit url_for([pg, only_path: true])
|
11
11
|
page.should have_content(pg.content)
|
12
12
|
end
|
data/spec/features/posts_spec.rb
CHANGED
@@ -1,30 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'pry'
|
3
2
|
|
4
3
|
describe "Posts" do
|
5
4
|
before do
|
6
|
-
setup_site
|
7
|
-
end
|
8
|
-
|
9
|
-
it "lists posts" do
|
10
|
-
3.times{ FactoryGirl.create(:post) }
|
11
|
-
static_page = FactoryGirl.create(:page)
|
12
|
-
visit url_for([Storytime::BlogPost, only_path: true])
|
13
|
-
|
14
|
-
within ".post-list" do
|
15
|
-
Storytime::Post.primary_feed.each do |p|
|
16
|
-
page.should have_content(p.title)
|
17
|
-
page.should have_content(p.excerpt)
|
18
|
-
page.should_not have_content(p.content)
|
19
|
-
end
|
20
|
-
|
21
|
-
expect(page).not_to have_content(static_page.title)
|
22
|
-
expect(page).not_to have_content(static_page.excerpt)
|
23
|
-
end
|
5
|
+
setup_site(FactoryGirl.create(:admin))
|
24
6
|
end
|
25
7
|
|
26
8
|
it "shows a post" do
|
27
|
-
post = FactoryGirl.create(:post)
|
9
|
+
post = FactoryGirl.create(:post, blog: @current_site.blogs.first, site: @current_site)
|
28
10
|
visit url_for([post, only_path: true])
|
29
11
|
|
30
12
|
expect(page).to have_content(post.title)
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Subscriptions" do
|
4
4
|
before do
|
5
|
-
setup_site
|
5
|
+
setup_site(FactoryGirl.create(:admin))
|
6
6
|
end
|
7
7
|
|
8
8
|
it "allows users to subscribe to a site" do
|
@@ -14,7 +14,7 @@ describe "Subscriptions" do
|
|
14
14
|
visit "/"
|
15
15
|
click_link "#{I18n.t('layout.subscribe_to', site_name: site.title)}"
|
16
16
|
fill_in "subscription_email", with: email_address
|
17
|
-
click_button "
|
17
|
+
click_button "Subscribe"
|
18
18
|
|
19
19
|
expect(Storytime::Subscription.count).to eq(1)
|
20
20
|
subscription = Storytime::Subscription.first
|
@@ -25,10 +25,10 @@ describe "Subscriptions" do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "only allows users to unsubscribe with a proper token" do
|
28
|
-
subscription_1 = FactoryGirl.create(:subscription)
|
28
|
+
subscription_1 = FactoryGirl.create(:subscription, site: @current_site)
|
29
29
|
token_1 = subscription_1.token
|
30
30
|
|
31
|
-
subscription_2 = FactoryGirl.create(:subscription)
|
31
|
+
subscription_2 = FactoryGirl.create(:subscription, site: @current_site)
|
32
32
|
token_2 = subscription_2.token
|
33
33
|
|
34
34
|
visit url_for([:unsubscribe_mailing_list, {:email => subscription_1.email, :t => token_2}])
|
data/spec/models/post_spec.rb
CHANGED
@@ -1,6 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Storytime::Post do
|
4
|
+
|
5
|
+
describe "#to_partial_path" do
|
6
|
+
before{ Storytime::BlogPost.instance_variable_set "@_to_partial_path", nil }
|
7
|
+
after{ Storytime::BlogPost.instance_variable_set "@_to_partial_path", nil }
|
8
|
+
|
9
|
+
it "includes site in the path" do
|
10
|
+
allow(File).to receive(:exists?).and_return(true)
|
11
|
+
|
12
|
+
site = FactoryGirl.create(:site, title: "Test Site")
|
13
|
+
blog_post = FactoryGirl.create(:post, site: site)
|
14
|
+
|
15
|
+
partial_path = blog_post.to_partial_path
|
16
|
+
expect(partial_path).to eq("storytime/test-site/blog_posts/blog_post")
|
17
|
+
Storytime::BlogPost.instance_variable_set "@_to_partial_path", nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it "looks up the inheritance chain" do
|
21
|
+
allow(File).to receive(:exists?).and_return(false)
|
22
|
+
|
23
|
+
site = FactoryGirl.build(:site, title: "Test Site")
|
24
|
+
video_post = VideoPost.new(site: site)
|
25
|
+
partial_path = video_post.to_partial_path
|
26
|
+
expect(partial_path).to eq("storytime/posts/post")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
4
30
|
it "sets the page slug on create" do
|
5
31
|
post = FactoryGirl.create(:post)
|
6
32
|
post.slug.should == post.title.parameterize
|
@@ -58,21 +84,4 @@ describe Storytime::Post do
|
|
58
84
|
Storytime::Post.tag_counts.find_by(name: "tag1").count.should == 2
|
59
85
|
Storytime::Post.tag_counts.find_by(name: "tag2").count.should == 1
|
60
86
|
end
|
61
|
-
|
62
|
-
context "#primary_feed" do
|
63
|
-
it "shows posts where post type is not excluded from the main feed" do
|
64
|
-
post_1 = FactoryGirl.create(:post)
|
65
|
-
post_2 = FactoryGirl.create(:post)
|
66
|
-
|
67
|
-
post_3 = FactoryGirl.create(:page)
|
68
|
-
post_4 = FactoryGirl.create(:page)
|
69
|
-
|
70
|
-
feed = Storytime::Post.primary_feed
|
71
|
-
expect(feed).to include(post_1)
|
72
|
-
expect(feed).to include(post_2)
|
73
|
-
|
74
|
-
expect(feed).to_not include(post_3)
|
75
|
-
expect(feed).to_not include(post_4)
|
76
|
-
end
|
77
|
-
end
|
78
87
|
end
|
@@ -2,20 +2,27 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Storytime::CommentPolicy do
|
4
4
|
subject { Storytime::CommentPolicy.new(user, comment) }
|
5
|
+
let(:site) { FactoryGirl.create(:site) }
|
5
6
|
let(:post) { FactoryGirl.create(:post) }
|
6
7
|
|
7
8
|
context "as a normal user" do
|
9
|
+
before do
|
10
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_admin?).and_return(false)
|
11
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_editor?).and_return(false)
|
12
|
+
end
|
13
|
+
|
8
14
|
let(:user) { FactoryGirl.create(:user) }
|
9
15
|
|
10
16
|
context "a comment owned by the user" do
|
11
|
-
let(:comment) { FactoryGirl.build(:comment, user: user, post: post) }
|
17
|
+
let(:comment) { FactoryGirl.build(:comment, user: user, post: post, site: site) }
|
12
18
|
|
13
19
|
it { should permit!(:create) }
|
14
20
|
it { should permit!(:destroy) }
|
15
21
|
end
|
16
22
|
|
23
|
+
|
17
24
|
context "a comment not owned by the user" do
|
18
|
-
let(:comment) { FactoryGirl.build(:comment, post: post) }
|
25
|
+
let(:comment) { FactoryGirl.build(:comment, post: post, site: site) }
|
19
26
|
|
20
27
|
it { should_not permit!(:create) }
|
21
28
|
it { should_not permit!(:destroy) }
|
@@ -23,17 +30,22 @@ describe Storytime::CommentPolicy do
|
|
23
30
|
end
|
24
31
|
|
25
32
|
context "as an editor" do
|
33
|
+
before do
|
34
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_admin?).and_return(false)
|
35
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_editor?).and_return(true)
|
36
|
+
end
|
37
|
+
|
26
38
|
let(:user){ FactoryGirl.create(:editor) }
|
27
39
|
|
28
40
|
context "a comment owned by the user" do
|
29
|
-
let(:comment) { FactoryGirl.build(:comment, user: user, post: post) }
|
41
|
+
let(:comment) { FactoryGirl.build(:comment, user: user, post: post, site: site) }
|
30
42
|
|
31
43
|
it { should permit!(:create) }
|
32
44
|
it { should permit!(:destroy) }
|
33
45
|
end
|
34
46
|
|
35
47
|
context "a comment not owned by the user" do
|
36
|
-
let(:comment) { FactoryGirl.build(:comment, post: post) }
|
48
|
+
let(:comment) { FactoryGirl.build(:comment, post: post, site: site) }
|
37
49
|
|
38
50
|
it { should_not permit!(:create) }
|
39
51
|
it { should permit!(:destroy) }
|
@@ -41,17 +53,21 @@ describe Storytime::CommentPolicy do
|
|
41
53
|
end
|
42
54
|
|
43
55
|
context "as an admin" do
|
56
|
+
before do
|
57
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_admin?).and_return(true)
|
58
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_editor?).and_return(false)
|
59
|
+
end
|
44
60
|
let(:user){ FactoryGirl.create(:admin) }
|
45
61
|
|
46
62
|
context "a comment owned by the user" do
|
47
|
-
let(:comment) { FactoryGirl.build(:comment, user: user, post: post) }
|
63
|
+
let(:comment) { FactoryGirl.build(:comment, user: user, post: post, site: site) }
|
48
64
|
|
49
65
|
it { should permit!(:create) }
|
50
66
|
it { should permit!(:destroy) }
|
51
67
|
end
|
52
68
|
|
53
69
|
context "a comment not owned by the user" do
|
54
|
-
let(:comment) { FactoryGirl.build(:comment, post: post) }
|
70
|
+
let(:comment) { FactoryGirl.build(:comment, post: post, site: site) }
|
55
71
|
|
56
72
|
it { should_not permit!(:create) }
|
57
73
|
it { should permit!(:destroy) }
|
@@ -5,8 +5,18 @@ require 'spec_helper'
|
|
5
5
|
describe Storytime::PostPolicy do
|
6
6
|
subject { Storytime::PostPolicy.new(user, post) }
|
7
7
|
|
8
|
+
let(:site) { FactoryGirl.create(:site) }
|
9
|
+
before do
|
10
|
+
site.save_with_seeds(user)
|
11
|
+
allow(Storytime::Site).to receive(:current).and_return(site)
|
12
|
+
end
|
13
|
+
|
8
14
|
context "for a writer" do
|
9
|
-
before
|
15
|
+
before do
|
16
|
+
allow_any_instance_of(Storytime.user_class).to receive(:assign_first_admin).and_return(true)
|
17
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_role_in_site).and_return(Storytime::Role.find_by(name: "writer"))
|
18
|
+
end
|
19
|
+
|
10
20
|
let(:user) { FactoryGirl.create(:writer) }
|
11
21
|
|
12
22
|
context "creating a new post" do
|
@@ -33,7 +43,11 @@ describe Storytime::PostPolicy do
|
|
33
43
|
end
|
34
44
|
end
|
35
45
|
|
36
|
-
context "for an editor" do
|
46
|
+
context "for an editor" do
|
47
|
+
before do
|
48
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_role).and_return(Storytime::Role.find_by(name: "editor"))
|
49
|
+
end
|
50
|
+
|
37
51
|
let(:user) { FactoryGirl.create(:editor) }
|
38
52
|
|
39
53
|
context "creating a new post" do
|
@@ -60,7 +74,11 @@ describe Storytime::PostPolicy do
|
|
60
74
|
end
|
61
75
|
end
|
62
76
|
|
63
|
-
context "for an admin" do
|
77
|
+
context "for an admin" do
|
78
|
+
before do
|
79
|
+
allow_any_instance_of(Storytime.user_class).to receive(:storytime_role).and_return(Storytime::Role.find_by(name: "admin"))
|
80
|
+
end
|
81
|
+
|
64
82
|
let(:user) { FactoryGirl.create(:admin) }
|
65
83
|
|
66
84
|
context "creating a new post" do
|
@@ -1,20 +1,29 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Root path" do
|
4
|
-
it "routes to
|
5
|
-
FactoryGirl.create(:site
|
4
|
+
it "routes to blog_homepage#show when site homepage is a blog" do
|
5
|
+
site = FactoryGirl.create(:site)
|
6
|
+
user = FactoryGirl.create(:admin)
|
7
|
+
site.save_with_seeds(user)
|
8
|
+
site.homepage = site.blogs.first
|
9
|
+
|
6
10
|
get "/"
|
7
11
|
|
8
|
-
expect(request.params[:controller]).to eq("storytime/
|
9
|
-
expect(request.params[:action]).to eq("
|
12
|
+
expect(request.params[:controller]).to eq("storytime/blog_homepage")
|
13
|
+
expect(request.params[:action]).to eq("show")
|
10
14
|
end
|
11
15
|
|
12
|
-
it "routes to pages#show when site
|
13
|
-
|
14
|
-
FactoryGirl.create(:
|
16
|
+
it "routes to pages#show when site homepage is page" do
|
17
|
+
site = FactoryGirl.create(:site)
|
18
|
+
user = FactoryGirl.create(:admin)
|
19
|
+
home_page = FactoryGirl.create(:page, site: site)
|
20
|
+
site.save_with_seeds(user)
|
21
|
+
site.homepage = home_page
|
22
|
+
site.save
|
23
|
+
|
15
24
|
get "/"
|
16
25
|
|
17
|
-
expect(request.params[:controller]).to eq("storytime/
|
26
|
+
expect(request.params[:controller]).to eq("storytime/homepage")
|
18
27
|
expect(request.params[:action]).to eq("show")
|
19
28
|
expect(response.body).to match(home_page.title)
|
20
29
|
end
|
@@ -22,9 +31,9 @@ end
|
|
22
31
|
|
23
32
|
describe "Post path" do
|
24
33
|
it "uses /posts/post-slug when site#post_slug_style is default" do
|
25
|
-
FactoryGirl.create(:site, post_slug_style: :default)
|
26
|
-
post = FactoryGirl.create(:post)
|
27
|
-
expect(
|
34
|
+
site = FactoryGirl.create(:site, post_slug_style: :default, custom_domain: "www.example.com")
|
35
|
+
post = FactoryGirl.create(:post, site: site)
|
36
|
+
expect(storytime.post_path(post)).to eq("/posts/#{post.slug}")
|
28
37
|
|
29
38
|
get url_for([post, only_path: true])
|
30
39
|
|
@@ -34,9 +43,10 @@ describe "Post path" do
|
|
34
43
|
end
|
35
44
|
|
36
45
|
it "uses /year/month/day/post-slug when site#post_slug_style is day_and_name" do
|
37
|
-
FactoryGirl.create(:site, post_slug_style: :day_and_name)
|
38
|
-
post = FactoryGirl.create(:post)
|
46
|
+
site = FactoryGirl.create(:site, post_slug_style: :day_and_name, custom_domain: "www.example.com")
|
47
|
+
post = FactoryGirl.create(:post, site: site)
|
39
48
|
date = post.created_at.to_date
|
49
|
+
|
40
50
|
expect(url_for([post, only_path: true])).to eq("/#{date.year}/#{date.strftime('%m')}/#{date.strftime('%d')}/#{post.slug}")
|
41
51
|
|
42
52
|
get url_for([post, only_path: true])
|
@@ -47,8 +57,8 @@ describe "Post path" do
|
|
47
57
|
end
|
48
58
|
|
49
59
|
it "uses /year/month/post-slug when site#post_slug_style is month_and_name" do
|
50
|
-
FactoryGirl.create(:site, post_slug_style: :month_and_name)
|
51
|
-
post = FactoryGirl.create(:post)
|
60
|
+
site = FactoryGirl.create(:site, post_slug_style: :month_and_name, custom_domain: "www.example.com")
|
61
|
+
post = FactoryGirl.create(:post, site: site)
|
52
62
|
date = post.created_at.to_date
|
53
63
|
expect(url_for([post, only_path: true])).to eq("/#{date.year}/#{date.strftime('%m')}/#{post.slug}")
|
54
64
|
|
@@ -60,8 +70,8 @@ describe "Post path" do
|
|
60
70
|
end
|
61
71
|
|
62
72
|
it "uses /post-id when site#post_slug_style is post_id" do
|
63
|
-
FactoryGirl.create(:site, post_slug_style: :post_id)
|
64
|
-
post = FactoryGirl.create(:post)
|
73
|
+
site = FactoryGirl.create(:site, post_slug_style: :post_id, custom_domain: "www.example.com")
|
74
|
+
post = FactoryGirl.create(:post, site: site)
|
65
75
|
expect(url_for([post, only_path: true])).to eq("/posts/#{post.id}")
|
66
76
|
|
67
77
|
get url_for([post, only_path: true])
|
data/spec/spec_helper.rb
CHANGED
@@ -15,8 +15,16 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
15
15
|
# If you are not using ActiveRecord, you can remove this line.
|
16
16
|
ActiveRecord::Migration.maintain_test_schema!
|
17
17
|
|
18
|
+
poltergeist_options = {
|
19
|
+
phantomjs_logger: Logger.new('/dev/null'),
|
20
|
+
# inspector: true,
|
21
|
+
# debug: true,
|
22
|
+
phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes', '--ssl-protocol=TLSv1'],
|
23
|
+
js_errors: false
|
24
|
+
}
|
25
|
+
|
18
26
|
Capybara.register_driver :poltergeist_st do |app|
|
19
|
-
Capybara::Poltergeist::Driver.new(app,
|
27
|
+
Capybara::Poltergeist::Driver.new(app, poltergeist_options)
|
20
28
|
end
|
21
29
|
|
22
30
|
Capybara.javascript_driver = :poltergeist_st
|
@@ -72,6 +80,9 @@ RSpec.configure do |config|
|
|
72
80
|
config.include FeatureMacros, type: :feature
|
73
81
|
config.include Storytime::Engine.routes.url_helpers
|
74
82
|
config.include Devise::TestHelpers, type: :controller
|
83
|
+
|
84
|
+
config.filter_run focus: true
|
85
|
+
config.run_all_when_everything_filtered = true
|
75
86
|
end
|
76
87
|
|
77
88
|
def have_image(url)
|
@@ -6,19 +6,19 @@ RSpec.configure do |config|
|
|
6
6
|
end
|
7
7
|
|
8
8
|
config.before(:each) do
|
9
|
-
DatabaseCleaner.strategy = :transaction
|
10
|
-
end
|
11
|
-
|
12
|
-
config.before(:each, :js => true) do
|
13
9
|
DatabaseCleaner.strategy = :deletion
|
14
10
|
end
|
15
11
|
|
12
|
+
# config.before(:each, :js => true) do
|
13
|
+
# DatabaseCleaner.strategy = :deletion
|
14
|
+
# end
|
15
|
+
|
16
16
|
config.before(:each) do
|
17
17
|
DatabaseCleaner.start
|
18
18
|
end
|
19
19
|
|
20
20
|
config.after(:each) do
|
21
|
-
Capybara.reset_sessions!
|
21
|
+
# Capybara.reset_sessions!
|
22
22
|
DatabaseCleaner.clean
|
23
23
|
end
|
24
24
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
Capybara.always_include_port = true
|
3
|
+
|
4
|
+
config.before(type: :feature) do
|
5
|
+
@current_site ||= FactoryGirl.build(:site)
|
6
|
+
set_domain @current_site.custom_domain
|
7
|
+
end
|
8
|
+
|
9
|
+
config.before(type: :controller) do
|
10
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
11
|
+
@current_site ||= FactoryGirl.create(:site)
|
12
|
+
@request.host = @current_site.custom_domain
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def set_domain(domain)
|
17
|
+
default_url_options[:host] = Capybara.app_host = "http://#{domain}"
|
18
|
+
end
|
@@ -1,14 +1,19 @@
|
|
1
1
|
module FeatureMacros
|
2
2
|
def login(user = nil, skip_site = false)
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
user ||= FactoryGirl.create(:user)
|
4
|
+
unless skip_site
|
5
|
+
setup_site(user)
|
6
|
+
set_domain(@current_site.custom_domain)
|
7
|
+
end
|
6
8
|
|
9
|
+
visit main_app.new_user_session_path
|
10
|
+
|
7
11
|
fill_in "user_email", :with => user.email
|
8
12
|
fill_in "user_password", :with => user.password
|
9
13
|
|
10
|
-
click_on "
|
11
|
-
|
14
|
+
click_on "Log in"
|
15
|
+
|
16
|
+
expect(page).to have_content("Signed in successfully.")
|
12
17
|
@current_user = user
|
13
18
|
end
|
14
19
|
|
@@ -32,11 +37,15 @@ module FeatureMacros
|
|
32
37
|
@current_site
|
33
38
|
end
|
34
39
|
|
35
|
-
def setup_site
|
36
|
-
@current_site
|
40
|
+
def setup_site(user)
|
41
|
+
@current_site ||= FactoryGirl.create(:site)
|
42
|
+
@current_site.save_with_seeds(user)
|
43
|
+
@current_site.homepage = @current_site.blogs.first
|
44
|
+
@current_site.save
|
37
45
|
end
|
38
46
|
|
39
|
-
def
|
40
|
-
|
47
|
+
def have_link_to_post(post)
|
48
|
+
have_link(post.title, href: url_for([:edit, :dashboard, post, only_path: true]))
|
41
49
|
end
|
50
|
+
|
42
51
|
end
|
data/storytime.gemspec
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "storytime/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "storytime"
|
9
|
+
s.version = Storytime::VERSION
|
10
|
+
s.authors = ["Ben Roesch, David Van Der Beek, Brandon Robins"]
|
11
|
+
s.email = ["ben@flyoverworks.com, david@flyoverworks.com, brandon@flyoverworks.com"]
|
12
|
+
s.summary = "A simple cms and blogging engine for rails apps."
|
13
|
+
s.description = "A simple cms and blogging engine for rails apps."
|
14
|
+
s.license = "MIT"
|
15
|
+
|
16
|
+
s.files = `git ls-files -z`.split("\x0")
|
17
|
+
s.executables << 'storytime'
|
18
|
+
s.test_files = Dir["spec/**/*"] - Dir["spec/dummy/tmp/**/*"] - Dir["spec/dummy/log/*"] - Dir["spec/dummy/public/uploads/**/*"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_dependency "rails", ">= 4.0"
|
22
|
+
s.add_dependency "pundit", ">= 0.2"
|
23
|
+
s.add_dependency "kaminari", ">= 0.15"
|
24
|
+
s.add_dependency "jbuilder", ">= 1.5"
|
25
|
+
s.add_dependency "sass-rails", ">= 4.0"
|
26
|
+
s.add_dependency "bootstrap-sass", ">= 3.1"
|
27
|
+
s.add_dependency "coffee-rails", ">= 4.0"
|
28
|
+
s.add_dependency "jquery-rails", ">= 3.0"
|
29
|
+
s.add_dependency "simple_form", ">= 3.0"
|
30
|
+
s.add_dependency "friendly_id", ">= 5.0"
|
31
|
+
s.add_dependency "fog", ">= 1.18"
|
32
|
+
s.add_dependency "carrierwave", ">= 0.9"
|
33
|
+
s.add_dependency "mini_magick", ">= 3.7"
|
34
|
+
s.add_dependency "nokogiri", ">= 1.6"
|
35
|
+
s.add_dependency "font-awesome-sass", ">= 4.0.3"
|
36
|
+
s.add_dependency "jquery-ui-rails", "~> 5.0"
|
37
|
+
s.add_dependency "thor", "~> 0.19.1"
|
38
|
+
s.add_dependency "leather", "~> 3.3.3.2"
|
39
|
+
s.add_dependency "codemirror-rails", "~> 4.8"
|
40
|
+
s.add_dependency "storytime-admin", "~> 0.1.0"
|
41
|
+
s.add_dependency "devise", ">= 3.2"
|
42
|
+
|
43
|
+
s.add_development_dependency "pg"
|
44
|
+
s.add_development_dependency "rspec-rails"
|
45
|
+
s.add_development_dependency "capybara"
|
46
|
+
s.add_development_dependency "poltergeist", "~>1.5"
|
47
|
+
s.add_development_dependency "factory_girl_rails"
|
48
|
+
s.add_development_dependency "guard-rspec", "~> 4.2.8"
|
49
|
+
s.add_development_dependency "spring-commands-rspec"
|
50
|
+
s.add_development_dependency "spring", "1.1.3"
|
51
|
+
s.add_development_dependency "rb-fsevent"
|
52
|
+
s.add_development_dependency "pry-nav"
|
53
|
+
s.add_development_dependency "pry-stack_explorer"
|
54
|
+
s.add_development_dependency "database_cleaner"
|
55
|
+
s.add_development_dependency "better_errors"
|
56
|
+
s.add_development_dependency "binding_of_caller"
|
57
|
+
s.add_development_dependency "launchy"
|
58
|
+
s.add_development_dependency "thin"
|
59
|
+
end
|
Binary file
|