catarse_full 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +19 -0
- data/README.rdoc +3 -0
- data/Rakefile +45 -0
- data/app/assets/fonts/icomoon.eot +0 -0
- data/app/assets/fonts/icomoon.json +1 -0
- data/app/assets/fonts/icomoon.svg +30 -0
- data/app/assets/fonts/icomoon.ttf +0 -0
- data/app/assets/fonts/icomoon.woff +0 -0
- data/app/assets/images/.gitkeep +0 -0
- data/app/assets/images/auth/facebook_64.png +0 -0
- data/app/assets/images/auth/twitter_64.png +0 -0
- data/app/assets/images/catarse/ProjectUpdate.jpg +0 -0
- data/app/assets/images/catarse/back_icons.png +0 -0
- data/app/assets/images/catarse/back_statistics.gif +0 -0
- data/app/assets/images/catarse/backed_icon.png +0 -0
- data/app/assets/images/catarse/backer_city.png +0 -0
- data/app/assets/images/catarse/backer_info.gif +0 -0
- data/app/assets/images/catarse/backer_info.png +0 -0
- data/app/assets/images/catarse/background.png +0 -0
- data/app/assets/images/catarse/background_full.jpg +0 -0
- data/app/assets/images/catarse/banner-10-milhoes.png +0 -0
- data/app/assets/images/catarse/bg64x64_s3.png +0 -0
- data/app/assets/images/catarse/bg_air.jpg +0 -0
- data/app/assets/images/catarse/bg_explore.jpg +0 -0
- data/app/assets/images/catarse/bg_finish.jpg +0 -0
- data/app/assets/images/catarse/bg_guardian.jpg +0 -0
- data/app/assets/images/catarse/bg_heartbacker.jpg +0 -0
- data/app/assets/images/catarse/bg_money.jpg +0 -0
- data/app/assets/images/catarse/bg_moneytag.jpg +0 -0
- data/app/assets/images/catarse/bg_requirements.png +0 -0
- data/app/assets/images/catarse/bg_rewards.jpg +0 -0
- data/app/assets/images/catarse/bg_s3.png +0 -0
- data/app/assets/images/catarse/bg_send.png +0 -0
- data/app/assets/images/catarse/bg_steps.png +0 -0
- data/app/assets/images/catarse/bg_tips.png +0 -0
- data/app/assets/images/catarse/bg_tips1.png +0 -0
- data/app/assets/images/catarse/bg_tips2.png +0 -0
- data/app/assets/images/catarse/bg_tips3.png +0 -0
- data/app/assets/images/catarse/bg_tips4.png +0 -0
- data/app/assets/images/catarse/bg_tips5.png +0 -0
- data/app/assets/images/catarse/bg_tips6.png +0 -0
- data/app/assets/images/catarse/bg_tips7.png +0 -0
- data/app/assets/images/catarse/bg_tips8.png +0 -0
- data/app/assets/images/catarse/blog_icon17x14.png +0 -0
- data/app/assets/images/catarse/boleto_icon.png +0 -0
- data/app/assets/images/catarse/bot_guidelines.gif +0 -0
- data/app/assets/images/catarse/bot_profileUser.png +0 -0
- data/app/assets/images/catarse/box_alert.png +0 -0
- data/app/assets/images/catarse/box_download.png +0 -0
- data/app/assets/images/catarse/box_en.jpg +0 -0
- data/app/assets/images/catarse/box_pt.jpg +0 -0
- data/app/assets/images/catarse/bullet-green.png +0 -0
- data/app/assets/images/catarse/button_explore.png +0 -0
- data/app/assets/images/catarse/button_send.png +0 -0
- data/app/assets/images/catarse/category_icon14x14.png +0 -0
- data/app/assets/images/catarse/cc_icon.png +0 -0
- data/app/assets/images/catarse/comments_icon28x18.png +0 -0
- data/app/assets/images/catarse/comum_logo127x27.png +0 -0
- data/app/assets/images/catarse/confirmed_icon.png +0 -0
- data/app/assets/images/catarse/delete_16.png +0 -0
- data/app/assets/images/catarse/embed_icon19x9.png +0 -0
- data/app/assets/images/catarse/expiring_icon20x22.png +0 -0
- data/app/assets/images/catarse/explore_icon21x14.png +0 -0
- data/app/assets/images/catarse/explore_icon23x15.png +0 -0
- data/app/assets/images/catarse/facebook_black_icon.png +0 -0
- data/app/assets/images/catarse/facebook_icon13x26.png +0 -0
- data/app/assets/images/catarse/faq_icon18x18.png +0 -0
- data/app/assets/images/catarse/faq_video.png +0 -0
- data/app/assets/images/catarse/flagCity.png +0 -0
- data/app/assets/images/catarse/flagCityMg.png +0 -0
- data/app/assets/images/catarse/flagCityPoa.png +0 -0
- data/app/assets/images/catarse/flagCityRJ.png +0 -0
- data/app/assets/images/catarse/flagName.png +0 -0
- data/app/assets/images/catarse/flagNameMg.png +0 -0
- data/app/assets/images/catarse/flagNamePoa.png +0 -0
- data/app/assets/images/catarse/flagNameRJ.png +0 -0
- data/app/assets/images/catarse/flagNameSP.png +0 -0
- data/app/assets/images/catarse/gift-reward.png +0 -0
- data/app/assets/images/catarse/gift.png +0 -0
- data/app/assets/images/catarse/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/catarse/glyphicons-halflings.png +0 -0
- data/app/assets/images/catarse/goal_icon36x17.png +0 -0
- data/app/assets/images/catarse/grey.png +0 -0
- data/app/assets/images/catarse/heart_icon17x14.png +0 -0
- data/app/assets/images/catarse/icon-fb.png +0 -0
- data/app/assets/images/catarse/icon-moip.png +0 -0
- data/app/assets/images/catarse/icon-paypal.png +0 -0
- data/app/assets/images/catarse/icon-tw.png +0 -0
- data/app/assets/images/catarse/icon_about.png +0 -0
- data/app/assets/images/catarse/icon_backerstep1.png +0 -0
- data/app/assets/images/catarse/icon_backerstep2.png +0 -0
- data/app/assets/images/catarse/icon_backerstep3.png +0 -0
- data/app/assets/images/catarse/icon_backerstep4.png +0 -0
- data/app/assets/images/catarse/icon_backerstep5.png +0 -0
- data/app/assets/images/catarse/icon_backersucessfull.png +0 -0
- data/app/assets/images/catarse/icon_backproject.png +0 -0
- data/app/assets/images/catarse/icon_bold.png +0 -0
- data/app/assets/images/catarse/icon_calc.png +0 -0
- data/app/assets/images/catarse/icon_colective.png +0 -0
- data/app/assets/images/catarse/icon_creative.png +0 -0
- data/app/assets/images/catarse/icon_credits.png +0 -0
- data/app/assets/images/catarse/icon_creditsmoney.png +0 -0
- data/app/assets/images/catarse/icon_datestart.png +0 -0
- data/app/assets/images/catarse/icon_donation.png +0 -0
- data/app/assets/images/catarse/icon_faq.png +0 -0
- data/app/assets/images/catarse/icon_gift.png +0 -0
- data/app/assets/images/catarse/icon_guidebacker.png +0 -0
- data/app/assets/images/catarse/icon_guidelinesstart.png +0 -0
- data/app/assets/images/catarse/icon_heart.png +0 -0
- data/app/assets/images/catarse/icon_italic.png +0 -0
- data/app/assets/images/catarse/icon_licosts.png +0 -0
- data/app/assets/images/catarse/icon_limagic.png +0 -0
- data/app/assets/images/catarse/icon_limoney.png +0 -0
- data/app/assets/images/catarse/icon_link.png +0 -0
- data/app/assets/images/catarse/icon_linktext.png +0 -0
- data/app/assets/images/catarse/icon_liwork.png +0 -0
- data/app/assets/images/catarse/icon_logo.png +0 -0
- data/app/assets/images/catarse/icon_media.png +0 -0
- data/app/assets/images/catarse/icon_new.png +0 -0
- data/app/assets/images/catarse/icon_nonprofit.png +0 -0
- data/app/assets/images/catarse/icon_projectnotfunded.png +0 -0
- data/app/assets/images/catarse/icon_projectsuccess.png +0 -0
- data/app/assets/images/catarse/icon_refreshproject.png +0 -0
- data/app/assets/images/catarse/icon_rewards.png +0 -0
- data/app/assets/images/catarse/icon_social.png +0 -0
- data/app/assets/images/catarse/icon_soldout.png +0 -0
- data/app/assets/images/catarse/icon_step1.png +0 -0
- data/app/assets/images/catarse/icon_step2.png +0 -0
- data/app/assets/images/catarse/icon_step3.png +0 -0
- data/app/assets/images/catarse/icon_step4.png +0 -0
- data/app/assets/images/catarse/icon_submitbacker.png +0 -0
- data/app/assets/images/catarse/icon_tag.png +0 -0
- data/app/assets/images/catarse/icon_time.png +0 -0
- data/app/assets/images/catarse/icon_url.png +0 -0
- data/app/assets/images/catarse/icon_video.png +0 -0
- data/app/assets/images/catarse/icon_vimeo.png +0 -0
- data/app/assets/images/catarse/institutional_video_icon16x16.png +0 -0
- data/app/assets/images/catarse/label_green.png +0 -0
- data/app/assets/images/catarse/label_green_list.png +0 -0
- data/app/assets/images/catarse/label_orange.png +0 -0
- data/app/assets/images/catarse/label_orange_list.png +0 -0
- data/app/assets/images/catarse/link_icon14x14.png +0 -0
- data/app/assets/images/catarse/logo-fb.jpg +0 -0
- data/app/assets/images/catarse/logo.png +0 -0
- data/app/assets/images/catarse/min_star12x11.png +0 -0
- data/app/assets/images/catarse/moip-choice.png +0 -0
- data/app/assets/images/catarse/multide_logo55x36.png +0 -0
- data/app/assets/images/catarse/newsletter_icon18x15.png +0 -0
- data/app/assets/images/catarse/opendata_icon26x26.png +0 -0
- data/app/assets/images/catarse/partners_icon26x26.png +0 -0
- data/app/assets/images/catarse/payment_account.jpg +0 -0
- data/app/assets/images/catarse/payment_boleto.jpg +0 -0
- data/app/assets/images/catarse/payment_cards.jpg +0 -0
- data/app/assets/images/catarse/paypal-choice.png +0 -0
- data/app/assets/images/catarse/pencil_16.png +0 -0
- data/app/assets/images/catarse/play89x89.png +0 -0
- data/app/assets/images/catarse/post_title_image.png +0 -0
- data/app/assets/images/catarse/power_logo200x43.png +0 -0
- data/app/assets/images/catarse/profile_icon19x14.png +0 -0
- data/app/assets/images/catarse/project_about.png +0 -0
- data/app/assets/images/catarse/recents_icon18x23.png +0 -0
- data/app/assets/images/catarse/recents_icon31x17.png +0 -0
- data/app/assets/images/catarse/recompensa24x20.png +0 -0
- data/app/assets/images/catarse/reward_box.png +0 -0
- data/app/assets/images/catarse/reward_count_icon18x17.png +0 -0
- data/app/assets/images/catarse/reward_icon.png +0 -0
- data/app/assets/images/catarse/schedule_icon19x22.png +0 -0
- data/app/assets/images/catarse/search_submit15x15.png +0 -0
- data/app/assets/images/catarse/sidebar_backers_icon26x19.png +0 -0
- data/app/assets/images/catarse/social_big_icons.png +0 -0
- data/app/assets/images/catarse/social_icons.png +0 -0
- data/app/assets/images/catarse/submit_back_icon25x22.png +0 -0
- data/app/assets/images/catarse/submit_project_icon25x13.png +0 -0
- data/app/assets/images/catarse/team_adriano.jpg +0 -0
- data/app/assets/images/catarse/team_diego.jpg +0 -0
- data/app/assets/images/catarse/team_diogo.jpg +0 -0
- data/app/assets/images/catarse/team_evelise.jpg +0 -0
- data/app/assets/images/catarse/team_luciana.jpg +0 -0
- data/app/assets/images/catarse/team_luis.jpg +0 -0
- data/app/assets/images/catarse/team_renato.jpg +0 -0
- data/app/assets/images/catarse/team_rodrigo.jpg +0 -0
- data/app/assets/images/catarse/team_ton.jpg +0 -0
- data/app/assets/images/catarse/thumb_step.jpg +0 -0
- data/app/assets/images/catarse/thumbs_up_icon16x16.png +0 -0
- data/app/assets/images/catarse/tick_16.png +0 -0
- data/app/assets/images/catarse/time_icon19x30.png +0 -0
- data/app/assets/images/catarse/title_component149x40.png +0 -0
- data/app/assets/images/catarse/title_component241x40.png +0 -0
- data/app/assets/images/catarse/twitter_black_icon.png +0 -0
- data/app/assets/images/catarse/twitter_icon28x24.png +0 -0
- data/app/assets/images/catarse/video_sample_cover477x330.jpg +0 -0
- data/app/assets/images/catarse_bootstrap/botao_bemvindo_EN_big.png +0 -0
- data/app/assets/images/catarse_bootstrap/botao_bemvindo_PT_big.png +0 -0
- data/app/assets/images/catarse_bootstrap/catarse-assets.png +0 -0
- data/app/assets/images/catarse_bootstrap/feedback-close.png +0 -0
- data/app/assets/images/catarse_bootstrap/feedback-key.png +0 -0
- data/app/assets/images/catarse_bootstrap/feedback-open.png +0 -0
- data/app/assets/images/catarse_bootstrap/logo_icon_catarse.png +0 -0
- data/app/assets/images/catarse_full/.gitkeep +0 -0
- data/app/assets/images/channels/avatar.png +0 -0
- data/app/assets/images/channels/banner.png +0 -0
- data/app/assets/images/channels/banner_tile.jpg +0 -0
- data/app/assets/images/channels/capa_asas.jpg +0 -0
- data/app/assets/images/channels/header_system.png +0 -0
- data/app/assets/images/channels/logo_asas_notificacao.png +0 -0
- data/app/assets/images/channels/successful.png +0 -0
- data/app/assets/images/delete_16.png +0 -0
- data/app/assets/images/dropdown.png +0 -0
- data/app/assets/images/facebook_share.png +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/gravatar.png +0 -0
- data/app/assets/images/icon_alertheader.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_95_ffdc2e_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_30_285c00_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_33_3a8104_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_50_4eb305_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_60_4ca20b_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_10_285c00_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_4eb305_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_72b42d_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/images/list_cards.jpg +0 -0
- data/app/assets/images/loading.gif +0 -0
- data/app/assets/images/locales/en.png +0 -0
- data/app/assets/images/locales/es.png +0 -0
- data/app/assets/images/locales/list.txt +278 -0
- data/app/assets/images/locales/pt.png +0 -0
- data/app/assets/images/login_with_facebook_button310x60.png +0 -0
- data/app/assets/images/login_with_facebook_button356x60.png +0 -0
- data/app/assets/images/logo.png +0 -0
- data/app/assets/images/not_successful.en.png +0 -0
- data/app/assets/images/not_successful.es.png +0 -0
- data/app/assets/images/not_successful.pt.png +0 -0
- data/app/assets/images/pencil_16.png +0 -0
- data/app/assets/images/project_about.png +0 -0
- data/app/assets/images/project_menu_selected.png +0 -0
- data/app/assets/images/rewards_left_border.png +0 -0
- data/app/assets/images/rewards_right_border.png +0 -0
- data/app/assets/images/successful.en.png +0 -0
- data/app/assets/images/successful.es.png +0 -0
- data/app/assets/images/successful.pt.png +0 -0
- data/app/assets/images/tick_16.png +0 -0
- data/app/assets/images/tick_32.png +0 -0
- data/app/assets/images/twitter_share.png +0 -0
- data/app/assets/images/user.png +0 -0
- data/app/assets/images/waiting_confirmation.en.png +0 -0
- data/app/assets/images/waiting_confirmation.es.png +0 -0
- data/app/assets/images/waiting_confirmation.pt.png +0 -0
- data/app/assets/javascripts/.gitkeep +0 -0
- data/app/assets/javascripts/app/.gitkeep +1 -0
- data/app/assets/javascripts/app/adm/users.js +50 -0
- data/app/assets/javascripts/app/app.js +50 -0
- data/app/assets/javascripts/app/backer.js +60 -0
- data/app/assets/javascripts/app/devise/feedback_support.js +23 -0
- data/app/assets/javascripts/app/explore.js +65 -0
- data/app/assets/javascripts/app/mix_panel.js +76 -0
- data/app/assets/javascripts/app/payment.js +23 -0
- data/app/assets/javascripts/app/project.js +47 -0
- data/app/assets/javascripts/app/project/project_backers.js +27 -0
- data/app/assets/javascripts/app/project/project_comments.js +14 -0
- data/app/assets/javascripts/app/project/project_sidebar.js +74 -0
- data/app/assets/javascripts/app/project/updates.js +44 -0
- data/app/assets/javascripts/app/project_form.js +60 -0
- data/app/assets/javascripts/app/registration.js +23 -0
- data/app/assets/javascripts/app/review_form.js +48 -0
- data/app/assets/javascripts/app/user.js +21 -0
- data/app/assets/javascripts/app/user/user_backers.js +15 -0
- data/app/assets/javascripts/app/user/user_projects.js +20 -0
- data/app/assets/javascripts/application.js +23 -0
- data/app/assets/javascripts/catarse_full/.gitkeep +0 -0
- data/app/assets/javascripts/lib/backbone.js +1571 -0
- data/app/assets/javascripts/lib/bootstrap.min.js +7 -0
- data/app/assets/javascripts/lib/form.js +24 -0
- data/app/assets/javascripts/lib/infinite_scroll.js +43 -0
- data/app/assets/javascripts/lib/jquery-ui.js +2252 -0
- data/app/assets/javascripts/lib/jquery.js +8842 -0
- data/app/assets/javascripts/lib/jquery.maskedinput.js +338 -0
- data/app/assets/javascripts/lib/modal.js +43 -0
- data/app/assets/javascripts/lib/skull.js +78 -0
- data/app/assets/javascripts/lib/tabs.js +27 -0
- data/app/assets/javascripts/lib/timed_input.js +18 -0
- data/app/assets/javascripts/lib/twitter.js +1 -0
- data/app/assets/javascripts/lib/underscore.js +1227 -0
- data/app/assets/stylesheets/.gitkeep +0 -0
- data/app/assets/stylesheets/animate.min.css +1 -0
- data/app/assets/stylesheets/application.css.sass +47 -0
- data/app/assets/stylesheets/catarse.css.sass +26 -0
- data/app/assets/stylesheets/catarse.sass +26 -0
- data/app/assets/stylesheets/catarse_bootstrap/_alerts.sass +16 -0
- data/app/assets/stylesheets/catarse_bootstrap/_buttons.sass +35 -0
- data/app/assets/stylesheets/catarse_bootstrap/_colors.sass +39 -0
- data/app/assets/stylesheets/catarse_bootstrap/_dropdown.sass +29 -0
- data/app/assets/stylesheets/catarse_bootstrap/_elements.sass +43 -0
- data/app/assets/stylesheets/catarse_bootstrap/_fonts.sass +46 -0
- data/app/assets/stylesheets/catarse_bootstrap/_header.sass +101 -0
- data/app/assets/stylesheets/catarse_bootstrap/_main_sidebar.sass +91 -0
- data/app/assets/stylesheets/catarse_bootstrap/_notices.sass +27 -0
- data/app/assets/stylesheets/catarse_bootstrap/_project_box.sass +104 -0
- data/app/assets/stylesheets/catarse_bootstrap/_settings.sass +72 -0
- data/app/assets/stylesheets/catarse_bootstrap/grid/foundation.sass +667 -0
- data/app/assets/stylesheets/catarse_bootstrap/grid/normalize.sass +327 -0
- data/app/assets/stylesheets/catarse_bootstrap/pages/devise.sass +102 -0
- data/app/assets/stylesheets/catarse_bootstrap/pages/passwords/new.sass +3 -0
- data/app/assets/stylesheets/catarse_full/.gitkeep +0 -0
- data/app/assets/stylesheets/content/_body.sass +82 -0
- data/app/assets/stylesheets/content/_explore.sass +68 -0
- data/app/assets/stylesheets/content/_footer.sass +88 -0
- data/app/assets/stylesheets/content/_header.sass +102 -0
- data/app/assets/stylesheets/content/_recommended_header.sass +174 -0
- data/app/assets/stylesheets/content/_sessions.sass +111 -0
- data/app/assets/stylesheets/content/_sidebar.sass +179 -0
- data/app/assets/stylesheets/jquery-ui.css.scss +572 -0
- data/app/assets/stylesheets/miv/_alert.scss +57 -0
- data/app/assets/stylesheets/miv/_bootstrap.scss +4652 -0
- data/app/assets/stylesheets/miv/_buttons.sass +41 -0
- data/app/assets/stylesheets/miv/_colors.sass +75 -0
- data/app/assets/stylesheets/miv/_dropdown.sass +28 -0
- data/app/assets/stylesheets/miv/_embed.sass +112 -0
- data/app/assets/stylesheets/miv/_flash.sass +18 -0
- data/app/assets/stylesheets/miv/_form.scss +626 -0
- data/app/assets/stylesheets/miv/_index.sass +151 -0
- data/app/assets/stylesheets/miv/_locales.sass +34 -0
- data/app/assets/stylesheets/miv/_modal.sass +38 -0
- data/app/assets/stylesheets/miv/_overlay.sass +10 -0
- data/app/assets/stylesheets/miv/_projects.sass +159 -0
- data/app/assets/stylesheets/miv/_projects_land.sass +177 -0
- data/app/assets/stylesheets/miv/_table.scss +134 -0
- data/app/assets/stylesheets/miv/_tabs.sass +31 -0
- data/app/assets/stylesheets/resources/adm/adm.sass +109 -0
- data/app/assets/stylesheets/resources/backers/_create.sass +432 -0
- data/app/assets/stylesheets/resources/backers/_new.sass +237 -0
- data/app/assets/stylesheets/resources/backers/_thank_you.sass +83 -0
- data/app/assets/stylesheets/resources/channels/_about.sass +67 -0
- data/app/assets/stylesheets/resources/channels/_general.sass +60 -0
- data/app/assets/stylesheets/resources/channels/_icomoon.sass +47 -0
- data/app/assets/stylesheets/resources/channels/_profile.sass +120 -0
- data/app/assets/stylesheets/resources/projects/_index.sass +43 -0
- data/app/assets/stylesheets/resources/projects/_new.sass +117 -0
- data/app/assets/stylesheets/resources/projects/_pending_backers.sass +80 -0
- data/app/assets/stylesheets/resources/projects/_rewards.sass +22 -0
- data/app/assets/stylesheets/resources/projects/_show.sass +749 -0
- data/app/assets/stylesheets/resources/projects/_start.sass +191 -0
- data/app/assets/stylesheets/resources/static/_about.sass +125 -0
- data/app/assets/stylesheets/resources/static/_default.sass +576 -0
- data/app/assets/stylesheets/resources/users/_show.sass +284 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/controllers/adm/backers_controller.rb +40 -0
- data/app/controllers/adm/base_controller.rb +37 -0
- data/app/controllers/adm/financials_controller.rb +49 -0
- data/app/controllers/adm/projects_controller.rb +32 -0
- data/app/controllers/adm/reports/backer_reports_controller.rb +6 -0
- data/app/controllers/adm/reports/base_controller.rb +6 -0
- data/app/controllers/adm/statistics_controller.rb +6 -0
- data/app/controllers/adm/users_controller.rb +26 -0
- data/app/controllers/application_controller.rb +118 -0
- data/app/controllers/channels/adm/projects_controller.rb +36 -0
- data/app/controllers/channels/adm/reports/subscriber_reports_controller.rb +7 -0
- data/app/controllers/channels/adm/statistics_controller.rb +13 -0
- data/app/controllers/channels/base_controller.rb +6 -0
- data/app/controllers/channels/channels_subscribers_controller.rb +35 -0
- data/app/controllers/channels/profiles_controller.rb +11 -0
- data/app/controllers/channels/projects_controller.rb +22 -0
- data/app/controllers/explore_controller.rb +6 -0
- data/app/controllers/omniauth_callbacks_controller.rb +28 -0
- data/app/controllers/passwords_controller.rb +21 -0
- data/app/controllers/projects/backers_controller.rb +85 -0
- data/app/controllers/projects/updates_controller.rb +28 -0
- data/app/controllers/projects_controller.rb +84 -0
- data/app/controllers/reports/backer_reports_for_project_owners_controller.rb +36 -0
- data/app/controllers/reports/base_controller.rb +6 -0
- data/app/controllers/rewards_controller.rb +36 -0
- data/app/controllers/static_controller.rb +28 -0
- data/app/controllers/unsubscribes_controller.rb +18 -0
- data/app/controllers/users/backers_controller.rb +29 -0
- data/app/controllers/users/projects_controller.rb +13 -0
- data/app/controllers/users_controller.rb +63 -0
- data/app/decorators/channel_decorator.rb +7 -0
- data/app/decorators/project_decorator.rb +69 -0
- data/app/decorators/user_decorator.rb +34 -0
- data/app/helpers/.gitkeep +0 -0
- data/app/helpers/channels/base_helper.rb +2 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/mailers/credits_mailer.rb +9 -0
- data/app/mailers/notifications_mailer.rb +21 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/ability.rb +129 -0
- data/app/models/authorization.rb +4 -0
- data/app/models/backer.rb +242 -0
- data/app/models/backer_report.rb +3 -0
- data/app/models/backer_reports_for_project_owner.rb +2 -0
- data/app/models/backers_by_period.rb +9 -0
- data/app/models/category.rb +17 -0
- data/app/models/channel.rb +22 -0
- data/app/models/channels_subscriber.rb +5 -0
- data/app/models/configuration.rb +36 -0
- data/app/models/notification.rb +35 -0
- data/app/models/notification_type.rb +4 -0
- data/app/models/oauth_provider.rb +6 -0
- data/app/models/payment_notification.rb +4 -0
- data/app/models/project.rb +335 -0
- data/app/models/project_total.rb +2 -0
- data/app/models/projects_by_period.rb +9 -0
- data/app/models/projects_for_home.rb +11 -0
- data/app/models/reward.rb +70 -0
- data/app/models/state.rb +13 -0
- data/app/models/statistics.rb +2 -0
- data/app/models/subscriber_report.rb +3 -0
- data/app/models/unsubscribe.rb +10 -0
- data/app/models/update.rb +57 -0
- data/app/models/user.rb +250 -0
- data/app/models/user_total.rb +3 -0
- data/app/observers/backer_observer.rb +61 -0
- data/app/observers/notification_observer.rb +7 -0
- data/app/observers/payment_notification_observer.rb +16 -0
- data/app/observers/project_observer.rb +113 -0
- data/app/observers/update_observer.rb +7 -0
- data/app/observers/user_observer.rb +16 -0
- data/app/uploaders/image_uploader.rb +24 -0
- data/app/uploaders/project_uploader.rb +29 -0
- data/app/uploaders/user_uploader.rb +12 -0
- data/app/views/.gitkeep +0 -0
- data/app/views/adm/backers/index.html.slim +170 -0
- data/app/views/adm/financials/index.html.slim +99 -0
- data/app/views/adm/projects/index.html.slim +128 -0
- data/app/views/adm/statistics/index.html.slim +40 -0
- data/app/views/adm/users/index.html.slim +74 -0
- data/app/views/catarse_bootstrap/devise/mailer/reset_password_instructions.en.html.slim +15 -0
- data/app/views/catarse_bootstrap/devise/mailer/reset_password_instructions.pt.html.slim +16 -0
- data/app/views/catarse_bootstrap/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/catarse_bootstrap/devise/passwords/edit.html.slim +26 -0
- data/app/views/catarse_bootstrap/devise/passwords/new.html.slim +21 -0
- data/app/views/catarse_bootstrap/devise/registrations/new.html.slim +48 -0
- data/app/views/catarse_bootstrap/devise/sessions/new.html.slim +40 -0
- data/app/views/catarse_bootstrap/devise/shared/_alert.html.slim +11 -0
- data/app/views/catarse_bootstrap/devise/shared/_header.html.slim +5 -0
- data/app/views/catarse_bootstrap/layouts/_login_feedback_support.html.slim +16 -0
- data/app/views/catarse_bootstrap/layouts/_mailer_styles.html.erb +22 -0
- data/app/views/catarse_bootstrap/layouts/_uservoice.html.slim +2 -0
- data/app/views/catarse_bootstrap/layouts/catarse_bootstrap.html.slim +21 -0
- data/app/views/catarse_bootstrap/layouts/email.html.slim +39 -0
- data/app/views/catarse_bootstrap/notifications_mailer/new_user_registration.en.html.slim +44 -0
- data/app/views/catarse_bootstrap/notifications_mailer/new_user_registration.pt.html.slim +45 -0
- data/app/views/catarse_bootstrap/notifications_mailer/updates.en.html.slim +4 -0
- data/app/views/catarse_bootstrap/notifications_mailer/updates.pt.html.slim +4 -0
- data/app/views/channels/adm/projects/index.html.slim +121 -0
- data/app/views/channels/adm/statistics/index.html.slim +21 -0
- data/app/views/channels/base/index.html.slim +2 -0
- data/app/views/channels/profiles/_footer.html.slim +13 -0
- data/app/views/channels/profiles/how_it_works.html.slim +67 -0
- data/app/views/channels/profiles/show.html.slim +47 -0
- data/app/views/channels/projects/_banner.html.slim +8 -0
- data/app/views/channels/projects/_project.html.slim +12 -0
- data/app/views/channels/projects/new.html.slim +128 -0
- data/app/views/credits_mailer/request_refund_from.text.erb +11 -0
- data/app/views/custom/.gitkeep +0 -0
- data/app/views/explore/index.html.slim +47 -0
- data/app/views/layouts/_analytics.html.slim +9 -0
- data/app/views/layouts/_announcement.html.slim +4 -0
- data/app/views/layouts/_catarse_bootstrap_notices.html.slim +4 -0
- data/app/views/layouts/_classic_uservoice.html.slim +31 -0
- data/app/views/layouts/_facebook_like.html.slim +2 -0
- data/app/views/layouts/_facebook_sdk.html.slim +20 -0
- data/app/views/layouts/_flash.html.slim +6 -0
- data/app/views/layouts/_header.html.slim +49 -0
- data/app/views/layouts/_locales.html.slim +7 -0
- data/app/views/layouts/_new_uservoice.html.slim +20 -0
- data/app/views/layouts/_twitter.html.erb +1 -0
- data/app/views/layouts/application.html.slim +71 -0
- data/app/views/layouts/channel_email.html.slim +23 -0
- data/app/views/layouts/email.html.slim +26 -0
- data/app/views/layouts/embed.html.slim +13 -0
- data/app/views/notifications_mailer/adm_project_deadline.en.html.slim +3 -0
- data/app/views/notifications_mailer/adm_project_deadline.pt.html.slim +3 -0
- data/app/views/notifications_mailer/backer_canceled_after_confirmed.html.slim +12 -0
- data/app/views/notifications_mailer/backer_confirmed_after_project_was_closed.en.html.slim +8 -0
- data/app/views/notifications_mailer/backer_confirmed_after_project_was_closed.pt.html.slim +8 -0
- data/app/views/notifications_mailer/backer_project_successful.en.html.slim +48 -0
- data/app/views/notifications_mailer/backer_project_successful.pt.html.slim +50 -0
- data/app/views/notifications_mailer/backer_project_unsuccessful.en.html.slim +39 -0
- data/app/views/notifications_mailer/backer_project_unsuccessful.pt.html.slim +41 -0
- data/app/views/notifications_mailer/confirm_backer.en.html.slim +43 -0
- data/app/views/notifications_mailer/confirm_backer.pt.html.slim +45 -0
- data/app/views/notifications_mailer/credits_warning.en.html.slim +41 -0
- data/app/views/notifications_mailer/credits_warning.pt.html.slim +40 -0
- data/app/views/notifications_mailer/new_draft_project.en.html.slim +34 -0
- data/app/views/notifications_mailer/new_draft_project.pt.html.slim +34 -0
- data/app/views/notifications_mailer/new_draft_project_channel.en.html.slim +34 -0
- data/app/views/notifications_mailer/new_draft_project_channel.pt.html.slim +34 -0
- data/app/views/notifications_mailer/new_features.en.html.slim +30 -0
- data/app/views/notifications_mailer/new_features.pt.html.slim +30 -0
- data/app/views/notifications_mailer/payment_slip.en.html.slim +19 -0
- data/app/views/notifications_mailer/payment_slip.pt.html.slim +24 -0
- data/app/views/notifications_mailer/pending_backer_project_unsuccessful.en.html.slim +44 -0
- data/app/views/notifications_mailer/pending_backer_project_unsuccessful.pt.html.slim +44 -0
- data/app/views/notifications_mailer/processing_payment.en.html.slim +24 -0
- data/app/views/notifications_mailer/processing_payment.pt.html.slim +29 -0
- data/app/views/notifications_mailer/project_in_wainting_funds.en.html.slim +35 -0
- data/app/views/notifications_mailer/project_in_wainting_funds.pt.html.slim +35 -0
- data/app/views/notifications_mailer/project_owner_backer_confirmed.en.html.slim +33 -0
- data/app/views/notifications_mailer/project_owner_backer_confirmed.pt.html.slim +34 -0
- data/app/views/notifications_mailer/project_received.en.html.slim +38 -0
- data/app/views/notifications_mailer/project_received.pt.html.slim +50 -0
- data/app/views/notifications_mailer/project_received_channel.en.html.slim +52 -0
- data/app/views/notifications_mailer/project_received_channel.pt.html.slim +52 -0
- data/app/views/notifications_mailer/project_rejected.en.html.slim +33 -0
- data/app/views/notifications_mailer/project_rejected.pt.html.slim +33 -0
- data/app/views/notifications_mailer/project_success.en.html.slim +30 -0
- data/app/views/notifications_mailer/project_success.pt.html.slim +30 -0
- data/app/views/notifications_mailer/project_unsuccessful.en.html.slim +42 -0
- data/app/views/notifications_mailer/project_unsuccessful.pt.html.slim +42 -0
- data/app/views/notifications_mailer/project_visible.en.html.slim +65 -0
- data/app/views/notifications_mailer/project_visible.pt.html.slim +65 -0
- data/app/views/projects/_admin_fields.html.slim +15 -0
- data/app/views/projects/_draft_warning.html.slim +23 -0
- data/app/views/projects/_failed_warning.html.slim +21 -0
- data/app/views/projects/_formatting_tips.en.html.slim +19 -0
- data/app/views/projects/_formatting_tips.pt.html.slim +20 -0
- data/app/views/projects/_online_warning.html.slim +33 -0
- data/app/views/projects/_project.html.slim +23 -0
- data/app/views/projects/_project_about.html.slim +20 -0
- data/app/views/projects/_project_edit.html.slim +32 -0
- data/app/views/projects/_project_header.html.slim +34 -0
- data/app/views/projects/_project_reports.html.slim +22 -0
- data/app/views/projects/_project_templates.html.slim +3 -0
- data/app/views/projects/_recommended_header.html.slim +19 -0
- data/app/views/projects/_rejected_warning.html.slim +10 -0
- data/app/views/projects/_successful_warning.html.slim +29 -0
- data/app/views/projects/_twitter_timeline.html.slim +2 -0
- data/app/views/projects/_waiting_funds_warning.html.slim +34 -0
- data/app/views/projects/backers/_anonymous_warning.en.html.slim +5 -0
- data/app/views/projects/backers/_anonymous_warning.pt.html.slim +5 -0
- data/app/views/projects/backers/_back_text.en.html.slim +11 -0
- data/app/views/projects/backers/_back_text.pt.html.slim +11 -0
- data/app/views/projects/backers/_backer.html.slim +42 -0
- data/app/views/projects/backers/create.html.slim +75 -0
- data/app/views/projects/backers/new.html.slim +40 -0
- data/app/views/projects/backers/show.html.slim +26 -0
- data/app/views/projects/embed.html.slim +2 -0
- data/app/views/projects/embed_panel.html.slim +11 -0
- data/app/views/projects/index.html.slim +70 -0
- data/app/views/projects/new.html.slim +134 -0
- data/app/views/projects/show.html.slim +169 -0
- data/app/views/projects/start.html.slim +121 -0
- data/app/views/projects/updates/_update.html.slim +17 -0
- data/app/views/projects/updates/new.html.slim +22 -0
- data/app/views/projects/video_embed.html.slim +8 -0
- data/app/views/projects_mailer/start_project_email.html.slim +29 -0
- data/app/views/rewards/_form.html.slim +19 -0
- data/app/views/rewards/edit.html.slim +1 -0
- data/app/views/rewards/index.html.slim +55 -0
- data/app/views/rewards/new.html.slim +1 -0
- data/app/views/static/_guidelines_text.pt.html.slim +17 -0
- data/app/views/static/_how_it_works.en.html.slim +11 -0
- data/app/views/static/_how_it_works.pt.html.slim +11 -0
- data/app/views/static/_more_tips.pt.html.slim +20 -0
- data/app/views/static/about.html.slim +79 -0
- data/app/views/static/guidelines.html.slim +22 -0
- data/app/views/static/guidelines_backers.html.slim +94 -0
- data/app/views/static/guidelines_start.html.slim +90 -0
- data/app/views/static/guidelines_tips.html.slim +68 -0
- data/app/views/static/sitemap.builder +61 -0
- data/app/views/users/_credits.html.slim +44 -0
- data/app/views/users/_current_user_fields.html.slim +76 -0
- data/app/views/users/_project.html.slim +60 -0
- data/app/views/users/_unsubscribes.html.slim +23 -0
- data/app/views/users/backers/index.html.slim +2 -0
- data/app/views/users/projects/index.html.slim +3 -0
- data/app/views/users/set_email.html.slim +16 -0
- data/app/views/users/show.html.slim +72 -0
- data/app/views/users/uservoice_gadget.html.slim +45 -0
- data/app/workers/notify_update_worker.rb +9 -0
- data/config/boot.rb +13 -0
- data/config/compass.rb +5 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +46 -0
- data/config/environments/production.rb +70 -0
- data/config/environments/test.rb +44 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/capybara.rb +5 -0
- data/config/initializers/carrierwave.rb +13 -0
- data/config/initializers/default_url_options.rb +6 -0
- data/config/initializers/devise.rb +252 -0
- data/config/initializers/formtastic.rb +9 -0
- data/config/initializers/google_analytics.rb +3 -0
- data/config/initializers/http_accept_language.rb +7 -0
- data/config/initializers/inflections.rb +13 -0
- data/config/initializers/locale.rb +9 -0
- data/config/initializers/mailchimp.rb +1 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/pluralize.rb +5 -0
- data/config/initializers/schema_associations.rb +3 -0
- data/config/initializers/secret_token.rb +16 -0
- data/config/initializers/sendgrid.rb +15 -0
- data/config/initializers/session_store.rb +15 -0
- data/config/initializers/statistics_loader_development.rb +4 -0
- data/config/initializers/timeout.rb +1 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/.wti.sample +14 -0
- data/config/locales/adm.en.yml +107 -0
- data/config/locales/adm.pt.yml +150 -0
- data/config/locales/catarse_bootstrap/models/user.en.yml +13 -0
- data/config/locales/catarse_bootstrap/models/user.pt.yml +13 -0
- data/config/locales/catarse_bootstrap/pages/forgot_password.en.yml +14 -0
- data/config/locales/catarse_bootstrap/pages/forgot_password.pt.yml +14 -0
- data/config/locales/catarse_bootstrap/pages/login.en.yml +16 -0
- data/config/locales/catarse_bootstrap/pages/login.pt.yml +16 -0
- data/config/locales/catarse_bootstrap/pages/reset_password.en.yml +14 -0
- data/config/locales/catarse_bootstrap/pages/reset_password.pt.yml +14 -0
- data/config/locales/catarse_bootstrap/pages/sign_up.en.yml +18 -0
- data/config/locales/catarse_bootstrap/pages/sign_up.pt.yml +17 -0
- data/config/locales/channels.pt.yml +100 -0
- data/config/locales/devise.en.yml +99 -0
- data/config/locales/devise.pt.yml +98 -0
- data/config/locales/en.yml +872 -0
- data/config/locales/notifications.en.yml +74 -0
- data/config/locales/notifications.pt.yml +74 -0
- data/config/locales/pt.yml +896 -0
- data/config/locales/rails.en.yml +209 -0
- data/config/locales/rails.pt.yml +211 -0
- data/config/locales/will_paginate.en.yml +5 -0
- data/config/locales/will_paginate.pt.yml +5 -0
- data/config/newrelic.yml +227 -0
- data/config/routes.rb +150 -0
- data/config/sidekiq.yml +1 -0
- data/config/unicorn.rb +38 -0
- data/db/migrate/20121226120921_initial_schema.rb +1836 -0
- data/db/migrate/20121227012003_user_totals_back_to_state_machine.rb +53 -0
- data/db/migrate/20121227012324_statistics_back_to_state_machine.rb +47 -0
- data/db/migrate/20121230111351_add_online_date_to_projects.rb +5 -0
- data/db/migrate/20130102180139_update_projects_to_state_machine_again.rb +25 -0
- data/db/migrate/20130104005632_add_moip_login_to_users.rb +5 -0
- data/db/migrate/20130104104501_add_how_know_and_more_links_to_projects.rb +6 -0
- data/db/migrate/20130105123546_add_first_backers_to_projects.rb +5 -0
- data/db/migrate/20130110191750_add_uploaded_image_to_projects.rb +5 -0
- data/db/migrate/20130117205659_alter_projects_drop_video_url_constraint.rb +15 -0
- data/db/migrate/20130118193907_fix_statistics_view.rb +45 -0
- data/db/migrate/20130121162447_create_backer_reports.rb +41 -0
- data/db/migrate/20130121204224_fix_projects_states.rb +11 -0
- data/db/migrate/20130121212325_fix_statistcs_again.rb +45 -0
- data/db/migrate/20130131121553_add_cpf_to_backer_report.rb +75 -0
- data/db/migrate/20130201200604_remove_curated_pages.rb +9 -0
- data/db/migrate/20130201202648_remove_projects_managers.rb +9 -0
- data/db/migrate/20130201202829_remove_active_admin_comments.rb +9 -0
- data/db/migrate/20130201205659_remove_institutional_videos.rb +9 -0
- data/db/migrate/20130204192704_create_backer_reports_for_project_owner.rb +33 -0
- data/db/migrate/20130205143533_remove_credits_from_users.rb +9 -0
- data/db/migrate/20130206121758_fix_view_backer_reports_for_project_owner.rb +34 -0
- data/db/migrate/20130211174609_add_name_en_to_categories.rb +5 -0
- data/db/migrate/20130212145115_rename_name_to_name_pt.rb +5 -0
- data/db/migrate/20130213184141_change_permalink_to_not_null.rb +17 -0
- data/db/migrate/20130218201312_create_users_oauth_providers.rb +10 -0
- data/db/migrate/20130218201751_migrate_user_data_to_users_oath_providers.rb +12 -0
- data/db/migrate/20130221171018_rename_users_oath_providers.rb +21 -0
- data/db/migrate/20130221172840_populate_authorizations.rb +12 -0
- data/db/migrate/20130221175717_remove_static_contents.rb +13 -0
- data/db/migrate/20130221184144_update_oauth_provider_name_to_lower.rb +8 -0
- data/db/migrate/20130221185532_recreate_statistics_with_new_users.rb +62 -0
- data/db/migrate/20130221201732_remove_secondary_users.rb +82 -0
- data/db/migrate/20130222163633_add_state_inscription_to_user.rb +5 -0
- data/db/migrate/20130225135512_update_user_emails_from_backers.rb +15 -0
- data/db/migrate/20130225141802_alter_user_drop_provider_uid_constraints.rb +15 -0
- data/db/migrate/20130228141234_add_unique_index_to_configuration.rb +5 -0
- data/db/migrate/20130304193806_create_channel_profiles.rb +12 -0
- data/db/migrate/20130307074614_create_versions.rb +24 -0
- data/db/migrate/20130307090153_add_reindex_versions_to_rewards.rb +5 -0
- data/db/migrate/20130308200907_add_user_name_on_backer_report_for_project_owner.rb +62 -0
- data/db/migrate/20130311191444_drop_uid_and_provider_constraint_on_users.rb +13 -0
- data/db/migrate/20130311192846_remove_unnecessary_user_indexes.rb +14 -0
- data/db/migrate/20130312001021_fix_duplicate_emails.rb +26 -0
- data/db/migrate/20130313032607_rename_channels_profiles_to_channels.rb +9 -0
- data/db/migrate/20130313034356_create_channels_projects.rb +8 -0
- data/db/migrate/20130319131919_create_channels_trustees.rb +12 -0
- data/db/migrate/20130410181958_add_twitter_and_facebook_and_email_to_channels.rb +7 -0
- data/db/migrate/20130410190247_add_image_to_channels.rb +5 -0
- data/db/migrate/20130410191240_add_website_to_channels.rb +5 -0
- data/db/migrate/20130411193016_create_channels_subscribers.rb +13 -0
- data/db/migrate/20130419184530_add_state_to_backers.rb +5 -0
- data/db/migrate/20130422071805_add_notification_type_draft_channel.rb +13 -0
- data/db/migrate/20130422072051_add_notification_type_project_received_channel.rb +13 -0
- data/db/migrate/20130423162359_update_user_total_to_backer_state_machine.rb +59 -0
- data/db/migrate/20130424173128_add_backer_state_machine_into_statistics.rb +61 -0
- data/db/migrate/20130426204503_add_row_order_to_rewards.rb +7 -0
- data/db/migrate/20130429142823_rename_categories.rb +12 -0
- data/db/migrate/20130429144749_add_new_categories.rb +27 -0
- data/db/migrate/20130429153115_move_projects_to_art_and_remove_old_categories.rb +15 -0
- data/db/migrate/20130430203333_add_layout_to_notification_type.rb +5 -0
- data/db/migrate/20130502175814_add_anonymous_to_reports_to_project_owner.rb +37 -0
- data/db/migrate/20130505013655_update_backers_state_machine.rb +35 -0
- data/db/migrate/20130506191243_update_backer_reports_to_project_owner_view_to_backer_state_machine.rb +65 -0
- data/db/migrate/20130506191508_update_backer_reports_to_backer_state_machine.rb +74 -0
- data/db/migrate/20130514132519_add_waiting_confirmation_on_statistics_view.rb +63 -0
- data/db/migrate/20130514185010_drop_views.rb +35 -0
- data/db/migrate/20130514185116_fix_project_owner_view.rb +66 -0
- data/db/migrate/20130514185926_remove_boolean_fields_from_projects.rb +18 -0
- data/db/migrate/20130515192404_remove_boolean_fields_from_backers.rb +14 -0
- data/db/migrate/20130523144013_fix_project_total_to_use_refunded_and_requested_refund_too.rb +15 -0
- data/db/migrate/20130523173609_fix_project_total_again_some_regex_error.rb +15 -0
- data/db/migrate/20130527204639_add_video_embed_url_to_projects.rb +5 -0
- data/db/migrate/20130529171845_update_backers_that_are_in_refunded_when_project_is_online.rb +17 -0
- data/db/migrate/20130604171730_add_index_to_payment_notification_on_backer_id.rb +5 -0
- data/db/migrate/20130604172253_update_online_date_for_legacy_projects.rb +10 -0
- data/db/migrate/20130604175953_remove_expires_at_from_views.rb +11 -0
- data/db/migrate/20130604180503_remove_expires_at_from_projects.rb +11 -0
- data/db/migrate/20130607222330_remove_image_url_from_projects.rb +9 -0
- data/db/migrate/20130617175402_create_projects_chart_view.rb +51 -0
- data/db/migrate/20130618175432_create_backers_by_period_view.rb +57 -0
- data/db/migrate/20130626122439_add_expires_at_function.rb +12 -0
- data/db/migrate/20130626124055_drop_payment_logs.rb +8 -0
- data/db/migrate/20130702192659_update_backers_by_period_view_with_deleted_backer_state.rb +107 -0
- data/db/migrate/20130703171547_add_exclusive_to_updates.rb +5 -0
- data/db/migrate/20130705131825_replace_expires_at_to_include_timezone.rb +18 -0
- data/db/migrate/20130705184845_alter_statistics_view_add_deleted_backer_state.rb +61 -0
- data/db/migrate/20130710122804_add_days_to_delivery_into_rewards.rb +5 -0
- data/db/migrate/20130722222945_remove_legacy_columns_from_users.rb +10 -0
- data/db/migrate/20130730232043_add_total_payments_service_fee_into_project_totals.rb +27 -0
- data/db/migrate/20130805230126_add_total_backed_projects_to_user_total.rb +60 -0
- data/db/migrate/20130812191450_show_refunded_on_backers_report.rb +74 -0
- data/db/migrate/20130814174329_alter_timestamp_to_include_timezone.rb +17 -0
- data/db/migrate/20130815161926_create_recommendations_view.rb +64 -0
- data/db/migrate/20130818015857_add_projects_home_view.rb +37 -0
- data/db/migrate/20130822215532_fix_credits_into_user_totals_view.rb +67 -0
- data/db/migrate/20130827210414_revert_expires_at.rb +12 -0
- data/db/migrate/20130828160026_use_expires_at_in_view.rb +11 -0
- data/db/migrate/20130829180232_use_timezone_instead_of_hardcoded_3.rb +12 -0
- data/db/migrate/20130905153553_add_sessions_table.rb +12 -0
- data/db/migrate/20130911180657_create_subscriber_reports.rb +8 -0
- data/db/seeds.rb +122 -0
- data/db/seeds/add-users.rb +40 -0
- data/db/seeds/my-seeds-local.example.rb +85 -0
- data/lib/blog.rb +14 -0
- data/lib/calendar.rb +19 -0
- data/lib/catarse_auto_html.rb +23 -0
- data/lib/catarse_full.rb +4 -0
- data/lib/catarse_full/engine.rb +77 -0
- data/lib/catarse_full/version.rb +3 -0
- data/lib/payment_engines.rb +26 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/catarse_full_tasks.rake +4 -0
- data/lib/tasks/config.rake +56 -0
- data/lib/tasks/cron.rake +76 -0
- data/lib/tasks/db_seed.rake +15 -0
- data/lib/tasks/jasmine.rake +8 -0
- data/lib/tasks/send_old_posts_to_tumblr.rake +14 -0
- data/lib/tasks/users.rake +82 -0
- data/lib/uservoice_sso.rb +20 -0
- data/spec/abilities/trustee_ability_spec.rb +53 -0
- data/spec/config/initializers/secret_token_spec.rb +19 -0
- data/spec/controllers/adm/backers_controller_spec.rb +119 -0
- data/spec/controllers/adm/statistics_controller.rb +17 -0
- data/spec/controllers/adm/users_controller_spec.rb +29 -0
- data/spec/controllers/channels/adm/reports/subscriber_reports_controller_spec.rb +24 -0
- data/spec/controllers/channels/base_controller_spec.rb +5 -0
- data/spec/controllers/channels/channels_subscribers_controller_spec.rb +59 -0
- data/spec/controllers/channels/profiles_controller_spec.rb +16 -0
- data/spec/controllers/omniauth_callbacks_controller_spec.rb +113 -0
- data/spec/controllers/projects/backers_controller_spec.rb +198 -0
- data/spec/controllers/projects/updates_controller_spec.rb +57 -0
- data/spec/controllers/projects_controller_spec.rb +178 -0
- data/spec/controllers/rewards_controller_spec.rb +107 -0
- data/spec/controllers/static_controller_spec.rb +37 -0
- data/spec/controllers/unsubscribes_controller_spec.rb +31 -0
- data/spec/controllers/users/backers_controller_spec.rb +86 -0
- data/spec/controllers/users/projects_controller_spec.rb +19 -0
- data/spec/controllers/users_controller_spec.rb +92 -0
- data/spec/decorators/project_decorator_spec.rb +146 -0
- data/spec/decorators/user_decorator_spec.rb +87 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -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/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +69 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.sample.yml +50 -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/devise_secret_key.rb +3 -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 +58 -0
- data/spec/dummy/db/structure.sql +2434 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -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/script/rails +6 -0
- data/spec/factories.rb +125 -0
- data/spec/factories/users_oauth_providers.rb +9 -0
- data/spec/features/channel_moderation_spec.rb +27 -0
- data/spec/features/projects_spec.rb +95 -0
- data/spec/features/users_spec.rb +43 -0
- data/spec/fixtures/image.png +0 -0
- data/spec/helpers/channels/base_helper_spec.rb +15 -0
- data/spec/javascripts/app_spec.js +85 -0
- data/spec/javascripts/backer_spec.js +74 -0
- data/spec/javascripts/explore_spec.js +211 -0
- data/spec/javascripts/feedback_support_spec.js +41 -0
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/mix_panel_spec.js +101 -0
- data/spec/javascripts/permalink_spec.js +50 -0
- data/spec/javascripts/project_comments_spec.js +66 -0
- data/spec/javascripts/project_sidebar_spec.js +105 -0
- data/spec/javascripts/project_spec.js +175 -0
- data/spec/javascripts/registration_spec.js +38 -0
- data/spec/javascripts/review_form_spec.js +140 -0
- data/spec/javascripts/skull_spec.js +103 -0
- data/spec/javascripts/support/jasmine.yml +93 -0
- data/spec/javascripts/timed_input_spec.js +64 -0
- data/spec/javascripts/updates_spec.js +49 -0
- data/spec/javascripts/video_url_spec.js +42 -0
- data/spec/lib/blog_spec.rb +12 -0
- data/spec/lib/payment_engines_spec.rb +61 -0
- data/spec/mailers/notifications_mailer_spec.rb +20 -0
- data/spec/models/ability_spec.rb +123 -0
- data/spec/models/authorizations_spec.rb +6 -0
- data/spec/models/backer_report_spec.rb +5 -0
- data/spec/models/backer_spec.rb +459 -0
- data/spec/models/category_spec.rb +13 -0
- data/spec/models/channel_spec.rb +47 -0
- data/spec/models/channels_subscriber_spec.rb +13 -0
- data/spec/models/configuration_spec.rb +31 -0
- data/spec/models/notification_spec.rb +105 -0
- data/spec/models/oauth_provider_spec.rb +7 -0
- data/spec/models/payment_notification_spec.rb +17 -0
- data/spec/models/project_spec.rb +771 -0
- data/spec/models/project_total_spec.rb +26 -0
- data/spec/models/projects_for_home_spec.rb +44 -0
- data/spec/models/reward_spec.rb +141 -0
- data/spec/models/statistics_spec.rb +46 -0
- data/spec/models/subscriber_report_spec.rb +42 -0
- data/spec/models/unsubscribe_spec.rb +27 -0
- data/spec/models/update_spec.rb +95 -0
- data/spec/models/user_spec.rb +357 -0
- data/spec/models/user_total_spec.rb +5 -0
- data/spec/observers/backer_observer_spec.rb +119 -0
- data/spec/observers/notification_observer_spec.rb +13 -0
- data/spec/observers/payment_notification_observer_spec.rb +34 -0
- data/spec/observers/project_observer_spec.rb +224 -0
- data/spec/observers/update_observer_spec.rb +17 -0
- data/spec/observers/user_observer_spec.rb +23 -0
- data/spec/spec_helper.rb +82 -0
- data/spec/support/devise.rb +3 -0
- data/spec/support/factory_girl.rb +2 -0
- data/spec/support/feature_helpers.rb +19 -0
- data/spec/uploaders/image_uploader_spec.rb +58 -0
- data/spec/uploaders/project_uploader_spec.rb +37 -0
- data/spec/uploaders/user_uploader_spec.rb +23 -0
- data/spec/views/channels/base/index.html.slim_spec.rb +5 -0
- metadata +1915 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Category do
|
4
|
+
describe "Associations" do
|
5
|
+
before do
|
6
|
+
FactoryGirl.create :category
|
7
|
+
end
|
8
|
+
|
9
|
+
it{ should have_many :projects }
|
10
|
+
it{ should validate_presence_of :name_pt }
|
11
|
+
it{ should validate_uniqueness_of :name_pt }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Channel do
|
4
|
+
describe "Validations & Assoaciations" do
|
5
|
+
|
6
|
+
[:name, :description, :permalink].each do |attribute|
|
7
|
+
it { should validate_presence_of attribute }
|
8
|
+
it { should allow_mass_assignment_of attribute }
|
9
|
+
end
|
10
|
+
|
11
|
+
it "validates uniqueness of permalink" do
|
12
|
+
# Creating a channel profile before, to check its uniqueness
|
13
|
+
# Because permalink is also being validated on Database with not
|
14
|
+
# NULL constraint
|
15
|
+
create(:channel)
|
16
|
+
should validate_uniqueness_of :permalink
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
it { should have_many :subscriber_reports }
|
21
|
+
it { should have_many :channels_subscribers }
|
22
|
+
it { should have_and_belong_to_many :projects }
|
23
|
+
it { should have_and_belong_to_many :trustees }
|
24
|
+
it { should have_and_belong_to_many :subscribers }
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
describe "#to_param" do
|
29
|
+
let(:channel) { create(:channel) }
|
30
|
+
it "should return the permalink" do
|
31
|
+
expect(channel.to_param).to eq(channel.permalink)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
describe "#projects" do
|
37
|
+
let(:channel) { create(:channel) }
|
38
|
+
let(:project1) { create(:project, online_date: (Time.now - 21.days)) }
|
39
|
+
let(:project2) { create(:project, online_date: (Time.now - 20.days)) }
|
40
|
+
before { channel.projects << project1 }
|
41
|
+
before { channel.projects << project2 }
|
42
|
+
|
43
|
+
it "should projects in more days online ascending order" do
|
44
|
+
expect(channel.projects).to eq([project2, project1])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ChannelsSubscriber do
|
4
|
+
describe "associations" do
|
5
|
+
it{ should belong_to :user }
|
6
|
+
it{ should belong_to :channel }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "validations" do
|
10
|
+
it{ should validate_presence_of :user_id }
|
11
|
+
it{ should validate_presence_of :channel_id }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Configuration do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@config = FactoryGirl.build(:configuration, name: 'a_config', value: 'a_value')
|
7
|
+
end
|
8
|
+
|
9
|
+
it{ should validate_presence_of :name }
|
10
|
+
it "should be valid from factory" do
|
11
|
+
@config.should be_valid
|
12
|
+
end
|
13
|
+
|
14
|
+
context "#get" do
|
15
|
+
before do
|
16
|
+
@config.save
|
17
|
+
FactoryGirl.create(:configuration, name: 'other_config', value: 'another_value')
|
18
|
+
end
|
19
|
+
it "should get config" do
|
20
|
+
::Configuration[:a_config].should == 'a_value'
|
21
|
+
end
|
22
|
+
it "should return nil when not founf" do
|
23
|
+
::Configuration[:not_found_config].should be(nil)
|
24
|
+
end
|
25
|
+
it "should return array" do
|
26
|
+
expected= ['a_value', 'another_value']
|
27
|
+
::Configuration[:a_config, :other_config].should == ['a_value', 'another_value']
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Notification do
|
4
|
+
let(:backer){ create(:backer) }
|
5
|
+
let(:notification_type){ create(:notification_type, name: 'confirm_backer') }
|
6
|
+
|
7
|
+
before do
|
8
|
+
Notification.unstub(:create_notification)
|
9
|
+
Notification.unstub(:create_notification_once)
|
10
|
+
ActionMailer::Base.deliveries.clear
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "Associations" do
|
14
|
+
it{ should belong_to :user }
|
15
|
+
it{ should belong_to :project }
|
16
|
+
it{ should belong_to :notification_type }
|
17
|
+
it{ should belong_to :backer }
|
18
|
+
it{ should belong_to :project_update }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#send_email" do
|
22
|
+
let(:deliver_exception){ nil }
|
23
|
+
let(:notification){ create(:notification, dismissed: false, notification_type: notification_type) }
|
24
|
+
|
25
|
+
before do
|
26
|
+
deliver_exception
|
27
|
+
notification.send_email
|
28
|
+
end
|
29
|
+
|
30
|
+
#temporarily disabled
|
31
|
+
#context "when deliver raises and exception" do
|
32
|
+
#let(:deliver_exception){ NotificationsMailer.stub(:notify).and_raise('fake error') }
|
33
|
+
#it("should not dismiss the notification"){ notification.dismissed.should be_false }
|
34
|
+
#end
|
35
|
+
|
36
|
+
context "when dismissed is true" do
|
37
|
+
let(:notification){ create(:notification, dismissed: true, notification_type: notification_type) }
|
38
|
+
it("should not send email"){ ActionMailer::Base.deliveries.should be_empty }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when dismissed is false" do
|
42
|
+
it("should send email"){ ActionMailer::Base.deliveries.should_not be_empty }
|
43
|
+
it("should dismiss the notification"){ notification.dismissed.should be_true }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe ".create_notification_once" do
|
48
|
+
let(:create_notification_once){ Notification.create_notification_once(:confirm_backer, backer.user, {user_id: backer.user.id, backer_id: backer.id}, backer: backer, project_name: backer.project.name) }
|
49
|
+
before{ notification_type }
|
50
|
+
|
51
|
+
context "when I have not created the notification with the same type and filters" do
|
52
|
+
before do
|
53
|
+
Notification.should_receive(:create_notification)
|
54
|
+
end
|
55
|
+
it("should call create_notification"){ create_notification_once }
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when I have already created the notification with the same type but a partially different filter" do
|
59
|
+
before do
|
60
|
+
create_notification_once
|
61
|
+
Notification.should_receive(:create_notification)
|
62
|
+
end
|
63
|
+
it("should call create_notification"){ Notification.create_notification_once(:confirm_backer, backer.user, {user_id: backer.user.id, backer_id: 0}, backer: backer, project_name: backer.project.name) }
|
64
|
+
end
|
65
|
+
context "when I have already created the notification with the same type and filters" do
|
66
|
+
before do
|
67
|
+
create_notification_once
|
68
|
+
Notification.should_receive(:create_notification).never
|
69
|
+
end
|
70
|
+
it("should never call create_notification"){ create_notification_once }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe ".create_notification" do
|
75
|
+
subject{ Notification.create_notification(:confirm_backer, backer.user, backer: backer, project_name: backer.project.name) }
|
76
|
+
|
77
|
+
context "when NotificationType with the provided name exists" do
|
78
|
+
before{ notification_type }
|
79
|
+
it{ should be_persisted }
|
80
|
+
its(:class){ should == Notification }
|
81
|
+
end
|
82
|
+
|
83
|
+
context "when NotificationType with the provided name does not exist" do
|
84
|
+
it{ should be_nil }
|
85
|
+
end
|
86
|
+
|
87
|
+
context "when an update is provided" do
|
88
|
+
let(:update){ create(:update) }
|
89
|
+
before{ notification_type }
|
90
|
+
subject{ Notification.create_notification(:confirm_backer, backer.user, update: update, backer: backer, project_name: backer.project.name) }
|
91
|
+
it{ should be_persisted }
|
92
|
+
its(:project_update){ should == update }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe ".notify_backer" do
|
97
|
+
before{ notification_type }
|
98
|
+
|
99
|
+
context "when NotificationType with the provided name exists" do
|
100
|
+
subject{ Notification.create_notification(:confirm_backer, backer.user, backer: backer, project_name: backer.project.name) }
|
101
|
+
its(:dismissed){ should be_true }
|
102
|
+
its(:backer){ should == backer }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PaymentNotification do
|
4
|
+
describe "Associations" do
|
5
|
+
it{ should belong_to :backer }
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#extra_data" do
|
9
|
+
let(:test_hash){{"test_hash" => 1}}
|
10
|
+
before do
|
11
|
+
@p = PaymentNotification.new(backer_id: FactoryGirl.create(:backer).id, extra_data: test_hash)
|
12
|
+
@p.save!
|
13
|
+
end
|
14
|
+
subject{ @p.extra_data }
|
15
|
+
it{ should == test_hash }
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,771 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Project do
|
5
|
+
let(:project){ build(:project, goal: 3000) }
|
6
|
+
let(:user){ create(:user) }
|
7
|
+
let(:channel){ create(:channel, email: user.email, trustees: [ user ]) }
|
8
|
+
let(:channel_project){ create(:project, channels: [ channel ]) }
|
9
|
+
|
10
|
+
describe "associations" do
|
11
|
+
it{ should belong_to :user }
|
12
|
+
it{ should belong_to :category }
|
13
|
+
it{ should have_many :backers }
|
14
|
+
it{ should have_one :project_total }
|
15
|
+
it{ should have_many :rewards }
|
16
|
+
it{ should have_many :updates }
|
17
|
+
it{ should have_many :notifications }
|
18
|
+
it{ should have_and_belong_to_many :channels }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "validations" do
|
22
|
+
%w[name user category about headline goal permalink].each do |field|
|
23
|
+
it{ should validate_presence_of field }
|
24
|
+
end
|
25
|
+
it{ should ensure_length_of(:headline).is_at_most(140) }
|
26
|
+
it{ should allow_value('http://vimeo.com/12111').for(:video_url) }
|
27
|
+
it{ should allow_value('https://vimeo.com/12111').for(:video_url) }
|
28
|
+
it{ should_not allow_value('http://www.foo.bar').for(:video_url) }
|
29
|
+
it{ should allow_value('testproject').for(:permalink) }
|
30
|
+
it{ should_not allow_value('users').for(:permalink) }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.state_names' do
|
34
|
+
let(:states) { [:draft, :rejected, :online, :successful, :waiting_funds, :failed] }
|
35
|
+
|
36
|
+
subject { Project.state_names }
|
37
|
+
|
38
|
+
it { should == states }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '.near_of' do
|
42
|
+
before do
|
43
|
+
mg_user = create(:user, address_state: 'MG')
|
44
|
+
sp_user = create(:user, address_state: 'SP')
|
45
|
+
3.times { create(:project, user: mg_user) }
|
46
|
+
6.times { create(:project, user: sp_user) }
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:state) { 'MG' }
|
50
|
+
|
51
|
+
subject { Project.near_of(state) }
|
52
|
+
|
53
|
+
it { should have(3).itens }
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "by_permalink" do
|
57
|
+
context "when project is deleted" do
|
58
|
+
before do
|
59
|
+
@p = create(:project, permalink: 'foo', state: 'deleted')
|
60
|
+
create(:project, permalink: 'bar')
|
61
|
+
end
|
62
|
+
subject{ Project.by_permalink('foo') }
|
63
|
+
it{ should == [] }
|
64
|
+
end
|
65
|
+
context "when project is not deleted" do
|
66
|
+
before do
|
67
|
+
@p = create(:project, permalink: 'foo')
|
68
|
+
create(:project, permalink: 'bar')
|
69
|
+
end
|
70
|
+
subject{ Project.by_permalink('foo') }
|
71
|
+
it{ should == [@p] }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '.not_deleted_projects' do
|
76
|
+
before do
|
77
|
+
create(:project, state: 'online')
|
78
|
+
create(:project, state: 'draft')
|
79
|
+
create(:project, state: 'deleted')
|
80
|
+
end
|
81
|
+
|
82
|
+
subject { Project.not_deleted_projects }
|
83
|
+
|
84
|
+
it { should have(2).itens }
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '.by_state' do
|
88
|
+
before do
|
89
|
+
@project_01 = create(:project, state: 'online')
|
90
|
+
@project_02 = create(:project, state: 'failed')
|
91
|
+
@project_03 = create(:project, state: 'successful')
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'get all projects that is online' do
|
95
|
+
subject { Project.by_state('online') }
|
96
|
+
|
97
|
+
it { should == [@project_01] }
|
98
|
+
end
|
99
|
+
|
100
|
+
context 'get all projects that is failed' do
|
101
|
+
subject { Project.by_state('failed') }
|
102
|
+
|
103
|
+
it { should == [@project_02] }
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'get all projects that is successful' do
|
107
|
+
subject { Project.by_state('successful') }
|
108
|
+
|
109
|
+
it { should == [@project_03] }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe '.by_progress' do
|
114
|
+
subject { Project.by_progress(20) }
|
115
|
+
|
116
|
+
before do
|
117
|
+
@project_01 = create(:project, goal: 100)
|
118
|
+
@project_02 = create(:project, goal: 100)
|
119
|
+
@project_03 = create(:project, goal: 100)
|
120
|
+
|
121
|
+
create(:backer, value: 10, project: @project_01)
|
122
|
+
create(:backer, value: 10, project: @project_01)
|
123
|
+
create(:backer, value: 30, project: @project_02)
|
124
|
+
create(:backer, value: 10, project: @project_03)
|
125
|
+
end
|
126
|
+
|
127
|
+
it { should have(2).itens }
|
128
|
+
end
|
129
|
+
|
130
|
+
describe '.between_created_at' do
|
131
|
+
let(:start_at) { '17/01/2013' }
|
132
|
+
let(:ends_at) { '20/01/2013' }
|
133
|
+
subject { Project.between_created_at(start_at, ends_at) }
|
134
|
+
|
135
|
+
before do
|
136
|
+
@project_01 = create(:project, created_at: '19/01/2013')
|
137
|
+
@project_02 = create(:project, created_at: '23/01/2013')
|
138
|
+
@project_03 = create(:project, created_at: '26/01/2013')
|
139
|
+
end
|
140
|
+
|
141
|
+
it { should == [@project_01] }
|
142
|
+
end
|
143
|
+
|
144
|
+
describe '.between_expires_at' do
|
145
|
+
let(:start_at) { '17/01/2013' }
|
146
|
+
let(:ends_at) { '21/01/2013' }
|
147
|
+
subject { Project.between_expires_at(start_at, ends_at) }
|
148
|
+
|
149
|
+
let(:project_01) { create(:project) }
|
150
|
+
let(:project_02) { create(:project) }
|
151
|
+
let(:project_03) { create(:project) }
|
152
|
+
|
153
|
+
before do
|
154
|
+
project_01.update_attributes({ online_date: '19/01/2013'.to_time, online_days: 0 })
|
155
|
+
project_02.update_attributes({ online_date: '23/01/2013'.to_time, online_days: 0 })
|
156
|
+
project_03.update_attributes({ online_date: '26/01/2013'.to_time, online_days: 0 })
|
157
|
+
end
|
158
|
+
|
159
|
+
it { should == [project_01] }
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '.to_finish' do
|
163
|
+
before do
|
164
|
+
Project.should_receive(:expired).and_call_original
|
165
|
+
Project.should_receive(:with_states).with(['online', 'waiting_funds']).and_call_original
|
166
|
+
end
|
167
|
+
it "should call scope expired and filter states that can be finished" do
|
168
|
+
Project.to_finish
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '.finish_projects!' do
|
173
|
+
let(:project){ double('project', id: 1, name: 'test') }
|
174
|
+
before do
|
175
|
+
Project.should_receive(:to_finish).and_return([project])
|
176
|
+
project.should_receive(:finish)
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should iterate through to_finish projects and call finish to each one" do
|
180
|
+
Project.finish_projects!
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
describe ".backed_by" do
|
185
|
+
before do
|
186
|
+
backer = create(:backer, state: 'confirmed')
|
187
|
+
@user = backer.user
|
188
|
+
@project = backer.project
|
189
|
+
# Another backer with same project and user should not create duplicate results
|
190
|
+
create(:backer, user: @user, project: @project, state: 'confirmed')
|
191
|
+
# Another backer with other project and user should not be in result
|
192
|
+
create(:backer, state: 'confirmed')
|
193
|
+
# Another backer with different project and same user but not confirmed should not be in result
|
194
|
+
create(:backer, user: @user, state: 'pending')
|
195
|
+
end
|
196
|
+
subject{ Project.backed_by(@user.id) }
|
197
|
+
it{ should == [@project] }
|
198
|
+
end
|
199
|
+
|
200
|
+
describe ".expired" do
|
201
|
+
before do
|
202
|
+
@p = create(:project, online_days: -1)
|
203
|
+
create(:project, online_days: 1)
|
204
|
+
end
|
205
|
+
subject{ Project.expired}
|
206
|
+
it{ should == [@p] }
|
207
|
+
end
|
208
|
+
|
209
|
+
describe ".not_expired" do
|
210
|
+
before do
|
211
|
+
@p = create(:project, online_days: 1)
|
212
|
+
create(:project, online_days: -1)
|
213
|
+
end
|
214
|
+
subject{ Project.not_expired }
|
215
|
+
it{ should == [@p] }
|
216
|
+
end
|
217
|
+
|
218
|
+
describe ".expiring" do
|
219
|
+
before do
|
220
|
+
@p = create(:project, online_date: Time.now, online_days: 13)
|
221
|
+
create(:project, online_date: Time.now, online_days: -1)
|
222
|
+
end
|
223
|
+
subject{ Project.expiring }
|
224
|
+
it{ should == [@p] }
|
225
|
+
end
|
226
|
+
|
227
|
+
describe ".not_expiring" do
|
228
|
+
before do
|
229
|
+
@p = create(:project, online_days: 15)
|
230
|
+
create(:project, online_days: -1)
|
231
|
+
end
|
232
|
+
subject{ Project.not_expiring }
|
233
|
+
it{ should == [@p] }
|
234
|
+
end
|
235
|
+
|
236
|
+
describe ".recent" do
|
237
|
+
before do
|
238
|
+
@p = create(:project, online_date: (Time.now - 4.days))
|
239
|
+
create(:project, online_date: (Time.now - 15.days))
|
240
|
+
end
|
241
|
+
subject{ Project.recent }
|
242
|
+
it{ should == [@p] }
|
243
|
+
end
|
244
|
+
|
245
|
+
describe ".online" do
|
246
|
+
before do
|
247
|
+
@p = create(:project, state: 'online')
|
248
|
+
create(:project, state: 'draft')
|
249
|
+
end
|
250
|
+
subject{ Project.online}
|
251
|
+
it{ should == [@p] }
|
252
|
+
end
|
253
|
+
|
254
|
+
describe ".from_channels" do
|
255
|
+
before do
|
256
|
+
@p = create(:project, channels: [create(:channel)])
|
257
|
+
create(:project, channels: [])
|
258
|
+
end
|
259
|
+
subject{ Project.from_channels }
|
260
|
+
it{ should == [@p] }
|
261
|
+
end
|
262
|
+
|
263
|
+
describe '#can_go_to_second_chance?' do
|
264
|
+
let(:project) { create(:project, goal: 100, online_days: -3) }
|
265
|
+
subject { project.can_go_to_second_chance? }
|
266
|
+
|
267
|
+
before { create(:backer, value: 20, state: 'confirmed', project: project) }
|
268
|
+
|
269
|
+
context 'when confirmed and pending backers reached 30% of the goal and in time to wait to wait' do
|
270
|
+
before { create(:backer, value: 10, state: 'waiting_confirmation', project: project) }
|
271
|
+
|
272
|
+
it { should be_true }
|
273
|
+
end
|
274
|
+
|
275
|
+
context 'when confirmed and pending backers reached less of 30% of the goal' do
|
276
|
+
it { should be_false }
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
describe '#reached_goal?' do
|
281
|
+
let(:project) { create(:project, goal: 3000) }
|
282
|
+
subject { project.reached_goal? }
|
283
|
+
|
284
|
+
context 'when sum of all backers hit the goal' do
|
285
|
+
before do
|
286
|
+
create(:backer, value: 4000, project: project)
|
287
|
+
end
|
288
|
+
it { should be_true }
|
289
|
+
end
|
290
|
+
|
291
|
+
context "when sum of all backers don't hit the goal" do
|
292
|
+
it { should be_false }
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
describe '#in_time_to_wait?' do
|
297
|
+
let(:backer) { create(:backer, state: 'waiting_confirmation') }
|
298
|
+
subject { backer.project.in_time_to_wait? }
|
299
|
+
|
300
|
+
context 'when project expiration is in time to wait' do
|
301
|
+
it { should be_true }
|
302
|
+
end
|
303
|
+
|
304
|
+
context 'when project expiration time is not more on time to wait' do
|
305
|
+
let(:backer) { create(:backer, created_at: 1.week.ago) }
|
306
|
+
it {should be_false}
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
|
311
|
+
describe "#pg_search" do
|
312
|
+
before { @p = create(:project, name: 'foo') }
|
313
|
+
context "when project exists" do
|
314
|
+
subject{ [Project.pg_search('foo'), Project.pg_search('fóõ')] }
|
315
|
+
it{ should == [[@p],[@p]] }
|
316
|
+
end
|
317
|
+
context "when project is not found" do
|
318
|
+
subject{ Project.pg_search('lorem') }
|
319
|
+
it{ should == [] }
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
describe "#progress" do
|
324
|
+
subject{ project.progress }
|
325
|
+
let(:pledged){ 0.0 }
|
326
|
+
let(:goal){ 0.0 }
|
327
|
+
before do
|
328
|
+
project.stub(:pledged).and_return(pledged)
|
329
|
+
project.stub(:goal).and_return(goal)
|
330
|
+
end
|
331
|
+
|
332
|
+
context "when goal == pledged > 0" do
|
333
|
+
let(:goal){ 10.0 }
|
334
|
+
let(:pledged){ 10.0 }
|
335
|
+
it{ should == 100 }
|
336
|
+
end
|
337
|
+
|
338
|
+
context "when goal is > 0 and pledged is 0.0" do
|
339
|
+
let(:goal){ 10.0 }
|
340
|
+
it{ should == 0 }
|
341
|
+
end
|
342
|
+
|
343
|
+
context "when goal is 0.0 and pledged > 0.0" do
|
344
|
+
let(:pledged){ 10.0 }
|
345
|
+
it{ should == 100 }
|
346
|
+
end
|
347
|
+
|
348
|
+
context "when goal is 0.0 and pledged is 0.0" do
|
349
|
+
it{ should == 0 }
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
describe "#pledged" do
|
354
|
+
subject{ project.pledged }
|
355
|
+
context "when project_total is nil" do
|
356
|
+
before do
|
357
|
+
project.stub(:project_total).and_return(nil)
|
358
|
+
end
|
359
|
+
it{ should == 0 }
|
360
|
+
end
|
361
|
+
context "when project_total exists" do
|
362
|
+
before do
|
363
|
+
project_total = mock()
|
364
|
+
project_total.stub(:pledged).and_return(10.0)
|
365
|
+
project.stub(:project_total).and_return(project_total)
|
366
|
+
end
|
367
|
+
it{ should == 10.0 }
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
describe "#total_payment_service_fee" do
|
372
|
+
subject { project.total_payment_service_fee }
|
373
|
+
|
374
|
+
context "when project_total is nil" do
|
375
|
+
before { project.stub(:project_total).and_return(nil) }
|
376
|
+
it { should == 0 }
|
377
|
+
end
|
378
|
+
|
379
|
+
context "when project_total exists" do
|
380
|
+
before do
|
381
|
+
project_total = mock()
|
382
|
+
project_total.stub(:total_payment_service_fee).and_return(4.0)
|
383
|
+
project.stub(:project_total).and_return(project_total)
|
384
|
+
end
|
385
|
+
|
386
|
+
it { should == 4.0 }
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
describe "#total_backers" do
|
391
|
+
subject{ project.total_backers }
|
392
|
+
context "when project_total is nil" do
|
393
|
+
before do
|
394
|
+
project.stub(:project_total).and_return(nil)
|
395
|
+
end
|
396
|
+
it{ should == 0 }
|
397
|
+
end
|
398
|
+
context "when project_total exists" do
|
399
|
+
before do
|
400
|
+
project_total = mock()
|
401
|
+
project_total.stub(:total_backers).and_return(1)
|
402
|
+
project.stub(:project_total).and_return(project_total)
|
403
|
+
end
|
404
|
+
it{ should == 1 }
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
describe "#video" do
|
409
|
+
subject { project }
|
410
|
+
|
411
|
+
context "video_url is blank" do
|
412
|
+
before { project.video_url = ''}
|
413
|
+
|
414
|
+
its(:video){ should be_nil}
|
415
|
+
end
|
416
|
+
|
417
|
+
context 'video_url is defined' do
|
418
|
+
before { project.video_url = "http://vimeo.com/17298435" }
|
419
|
+
|
420
|
+
context 'video_url is a Vimeo url' do
|
421
|
+
its(:video){ should be_an_instance_of(VideoInfo::Providers::Vimeo) }
|
422
|
+
end
|
423
|
+
|
424
|
+
context 'video_url is an YouTube url' do
|
425
|
+
before { project.video_url = "http://www.youtube.com/watch?v=Brw7bzU_t4c" }
|
426
|
+
|
427
|
+
its(:video){ should be_an_instance_of(VideoInfo::Providers::Youtube) }
|
428
|
+
end
|
429
|
+
|
430
|
+
it 'caches the response object' do
|
431
|
+
video_obj = VideoInfo.get(project.video_url)
|
432
|
+
VideoInfo.should_receive(:get).once.and_return(video_obj)
|
433
|
+
5.times { project.video }
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
context 'video_url changes' do
|
438
|
+
before { project.video_url = 'http://vimeo.com/17298435' }
|
439
|
+
|
440
|
+
it 'maintain cached version' do
|
441
|
+
project.video_url = 'http://vimeo.com/59205360'
|
442
|
+
project.video.video_id = '17298435'
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
describe "#expired?" do
|
448
|
+
subject{ project.expired? }
|
449
|
+
|
450
|
+
context "when online_date is nil" do
|
451
|
+
let(:project){ Project.new online_date: nil, online_days: 0 }
|
452
|
+
it{ should be_false }
|
453
|
+
end
|
454
|
+
|
455
|
+
context "when expires_at is in the future" do
|
456
|
+
let(:project){ Project.new online_date: 2.days.from_now, online_days: 0 }
|
457
|
+
it{ should be_false }
|
458
|
+
end
|
459
|
+
|
460
|
+
context "when expires_at is in the past" do
|
461
|
+
let(:project){ Project.new online_date: 2.days.ago, online_days: 0 }
|
462
|
+
it{ should be_true }
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
describe "#in_time?" do
|
467
|
+
subject{ project.in_time? }
|
468
|
+
context "when expires_at is in the future" do
|
469
|
+
let(:project){ Project.new online_date: 2.days.from_now, online_days: 0 }
|
470
|
+
it{ should be_true }
|
471
|
+
end
|
472
|
+
|
473
|
+
context "when expires_at is in the past" do
|
474
|
+
let(:project){ Project.new online_date: 2.days.ago, online_days: 0 }
|
475
|
+
it{ should be_false }
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
describe "#expires_at" do
|
480
|
+
subject{ project.expires_at }
|
481
|
+
context "when we do not have an online_date" do
|
482
|
+
let(:project){ build(:project, online_date: nil, online_days: 0) }
|
483
|
+
it{ should be_nil }
|
484
|
+
end
|
485
|
+
context "when we have an online_date" do
|
486
|
+
let(:project){ build(:project, online_date: Time.now, online_days: 0) }
|
487
|
+
it{ should == Time.zone.now.end_of_day }
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
describe "#time_to_go" do
|
492
|
+
let(:project){ build(:project) }
|
493
|
+
let(:expires_at){ Time.zone.parse("23:00:00") }
|
494
|
+
subject{ project.time_to_go }
|
495
|
+
before do
|
496
|
+
I18n.locale = :pt
|
497
|
+
project.stub(:expires_at).and_return(expires_at)
|
498
|
+
end
|
499
|
+
|
500
|
+
context "when there is more than 1 day to go" do
|
501
|
+
let(:expires_at){ Time.zone.now + 2.days }
|
502
|
+
it{ should == {:time=>2, :unit=>"dias"} }
|
503
|
+
end
|
504
|
+
|
505
|
+
context "when there is less than 1 day to go" do
|
506
|
+
let(:expires_at){ Time.zone.now + 13.hours }
|
507
|
+
it{ should == {:time=>13, :unit=>"horas"} }
|
508
|
+
end
|
509
|
+
|
510
|
+
context "when there is less than 1 hour to go" do
|
511
|
+
let(:expires_at){ Time.zone.now + 59.minutes }
|
512
|
+
it{ should == {:time=>59, :unit=>"minutos"} }
|
513
|
+
end
|
514
|
+
end
|
515
|
+
|
516
|
+
describe '#selected_rewards' do
|
517
|
+
let(:project){ create(:project) }
|
518
|
+
let(:reward_01) { create(:reward, project: project) }
|
519
|
+
let(:reward_02) { create(:reward, project: project) }
|
520
|
+
let(:reward_03) { create(:reward, project: project) }
|
521
|
+
|
522
|
+
before do
|
523
|
+
create(:backer, state: 'confirmed', project: project, reward: reward_01)
|
524
|
+
create(:backer, state: 'confirmed', project: project, reward: reward_03)
|
525
|
+
end
|
526
|
+
|
527
|
+
subject { project.selected_rewards }
|
528
|
+
it { should == [reward_01, reward_03] }
|
529
|
+
end
|
530
|
+
|
531
|
+
describe "#download_video_thumbnail" do
|
532
|
+
let(:project){ build(:project) }
|
533
|
+
before do
|
534
|
+
project.should_receive(:download_video_thumbnail).and_call_original
|
535
|
+
project.should_receive(:open).and_return(File.open("#{Catarse::Engine.root}/spec/fixtures/image.png"))
|
536
|
+
project.save!
|
537
|
+
end
|
538
|
+
|
539
|
+
it "should open the video_url and store it in video_thumbnail" do
|
540
|
+
project.video_thumbnail.url.should == "/uploads/project/video_thumbnail/#{project.id}/image.png"
|
541
|
+
end
|
542
|
+
|
543
|
+
end
|
544
|
+
|
545
|
+
describe '#pending_backers_reached_the_goal?' do
|
546
|
+
let(:project) { create(:project, goal: 200) }
|
547
|
+
|
548
|
+
before { project.stub(:pleged) { 100 } }
|
549
|
+
|
550
|
+
subject { project.pending_backers_reached_the_goal? }
|
551
|
+
|
552
|
+
context 'when reached the goal with pending backers' do
|
553
|
+
before { 2.times { create(:backer, project: project, value: 120, state: 'waiting_confirmation') } }
|
554
|
+
|
555
|
+
it { should be_true }
|
556
|
+
end
|
557
|
+
|
558
|
+
context 'when dont reached the goal with pending backers' do
|
559
|
+
before { 2.times { create(:backer, project: project, value: 30, state: 'waiting_confirmation') } }
|
560
|
+
|
561
|
+
it { should be_false }
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
describe "#new_draft_recipient" do
|
566
|
+
subject { project.new_draft_recipient }
|
567
|
+
context "when project does not belong to any channel" do
|
568
|
+
before do
|
569
|
+
Configuration[:email_projects] = 'admin_projects@foor.bar'
|
570
|
+
@user = create(:user, email: Configuration[:email_projects])
|
571
|
+
end
|
572
|
+
it{ should == @user }
|
573
|
+
end
|
574
|
+
|
575
|
+
context "when project does belong to a channel" do
|
576
|
+
let(:project) { channel_project }
|
577
|
+
it{ should == user }
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
581
|
+
describe "#new_draft_project_notification_type" do
|
582
|
+
subject{ project.new_draft_project_notification_type }
|
583
|
+
|
584
|
+
context "when project does not belong to any channel" do
|
585
|
+
it{ should == :new_draft_project }
|
586
|
+
end
|
587
|
+
|
588
|
+
context "when project does belong to a channel" do
|
589
|
+
let(:project) { channel_project }
|
590
|
+
it{ should == :new_draft_project_channel }
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
describe "#new_project_received_notification_type" do
|
595
|
+
subject{ project.new_project_received_notification_type }
|
596
|
+
|
597
|
+
context "when project does not belong to any channel" do
|
598
|
+
it{ should == :project_received }
|
599
|
+
end
|
600
|
+
|
601
|
+
context "when project does belong to a channel" do
|
602
|
+
let(:project) { channel_project }
|
603
|
+
it{ should == :project_received_channel }
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
607
|
+
describe "state machine" do
|
608
|
+
let(:project) { create(:project, state: 'draft') }
|
609
|
+
|
610
|
+
describe '#draft?' do
|
611
|
+
subject { project.draft? }
|
612
|
+
context "when project is new" do
|
613
|
+
it { should be_true }
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
617
|
+
describe '.push_to_draft' do
|
618
|
+
subject do
|
619
|
+
project.reject
|
620
|
+
project.push_to_draft
|
621
|
+
project
|
622
|
+
end
|
623
|
+
its(:draft?){ should be_true }
|
624
|
+
end
|
625
|
+
|
626
|
+
describe '#rejected?' do
|
627
|
+
subject { project.rejected? }
|
628
|
+
before do
|
629
|
+
project.reject
|
630
|
+
end
|
631
|
+
context 'when project is not accepted' do
|
632
|
+
it { should be_true }
|
633
|
+
end
|
634
|
+
end
|
635
|
+
|
636
|
+
describe '#reject' do
|
637
|
+
subject do
|
638
|
+
project.should_receive(:after_transition_of_draft_to_rejected)
|
639
|
+
project.reject
|
640
|
+
project
|
641
|
+
end
|
642
|
+
its(:rejected?){ should be_true }
|
643
|
+
end
|
644
|
+
|
645
|
+
describe '#push_to_trash' do
|
646
|
+
let(:project) { FactoryGirl.create(:project, permalink: 'my_project', state: 'draft') }
|
647
|
+
|
648
|
+
subject do
|
649
|
+
project.push_to_trash
|
650
|
+
project
|
651
|
+
end
|
652
|
+
|
653
|
+
its(:deleted?) { should be_true }
|
654
|
+
its(:permalink) { should == "deleted_project_#{project.id}" }
|
655
|
+
end
|
656
|
+
|
657
|
+
describe '#approve' do
|
658
|
+
subject do
|
659
|
+
project.should_receive(:after_transition_of_draft_to_online)
|
660
|
+
project.approve
|
661
|
+
project
|
662
|
+
end
|
663
|
+
its(:online?){ should be_true }
|
664
|
+
it('should call after transition method to notify the project owner'){ subject }
|
665
|
+
it 'should persist the date of approvation' do
|
666
|
+
project.approve
|
667
|
+
project.online_date.should_not be_nil
|
668
|
+
end
|
669
|
+
end
|
670
|
+
|
671
|
+
describe '#online?' do
|
672
|
+
before { project.approve }
|
673
|
+
subject { project.online? }
|
674
|
+
it { should be_true }
|
675
|
+
end
|
676
|
+
|
677
|
+
describe '#finish' do
|
678
|
+
let(:main_project) { create(:project, goal: 30_000, online_days: -1) }
|
679
|
+
subject { main_project }
|
680
|
+
|
681
|
+
context 'when project is not approved' do
|
682
|
+
before do
|
683
|
+
main_project.update_attributes state: 'draft'
|
684
|
+
end
|
685
|
+
its(:finish) { should be_false }
|
686
|
+
end
|
687
|
+
|
688
|
+
context 'when project is expired and the sum of the pending backers and confirmed backers dont reached the goal' do
|
689
|
+
before do
|
690
|
+
create(:backer, value: 100, project: main_project, created_at: 2.days.ago)
|
691
|
+
main_project.finish
|
692
|
+
end
|
693
|
+
|
694
|
+
its(:failed?) { should be_true }
|
695
|
+
end
|
696
|
+
|
697
|
+
context 'when project is expired and the sum of the pending backers and confirmed backers reached 30% of the goal' do
|
698
|
+
before do
|
699
|
+
create(:backer, value: 100, project: main_project, created_at: 2.days.ago)
|
700
|
+
create(:backer, value: 9_000, project: main_project, state: 'waiting_confirmation')
|
701
|
+
main_project.finish
|
702
|
+
end
|
703
|
+
|
704
|
+
its(:waiting_funds?) { should be_true }
|
705
|
+
end
|
706
|
+
|
707
|
+
context 'when project is expired and have recent backers without confirmation' do
|
708
|
+
before do
|
709
|
+
create(:backer, value: 30_000, project: subject, state: 'waiting_confirmation')
|
710
|
+
main_project.finish
|
711
|
+
end
|
712
|
+
|
713
|
+
its(:waiting_funds?) { should be_true }
|
714
|
+
end
|
715
|
+
|
716
|
+
context 'when project already hit the goal and passed the waiting_funds time' do
|
717
|
+
before do
|
718
|
+
main_project.update_attributes state: 'waiting_funds'
|
719
|
+
subject.stub(:pending_backers_reached_the_goal?).and_return(true)
|
720
|
+
subject.stub(:reached_goal?).and_return(true)
|
721
|
+
subject.online_date = 2.weeks.ago
|
722
|
+
subject.online_days = 0
|
723
|
+
subject.finish
|
724
|
+
end
|
725
|
+
its(:successful?) { should be_true }
|
726
|
+
end
|
727
|
+
|
728
|
+
context 'when project already hit the goal and still is in the waiting_funds time' do
|
729
|
+
before do
|
730
|
+
subject.stub(:pending_backers_reached_the_goal?).and_return(true)
|
731
|
+
subject.stub(:reached_goal?).and_return(true)
|
732
|
+
create(:backer, project: main_project, user: user, value: 20, state: 'waiting_confirmation')
|
733
|
+
main_project.update_attributes state: 'waiting_funds'
|
734
|
+
subject.finish
|
735
|
+
end
|
736
|
+
its(:successful?) { should be_false }
|
737
|
+
end
|
738
|
+
|
739
|
+
context 'when project not hit the goal' do
|
740
|
+
let(:user) { create(:user) }
|
741
|
+
let(:backer) { create(:backer, project: main_project, user: user, value: 20, payment_token: 'ABC') }
|
742
|
+
|
743
|
+
before do
|
744
|
+
backer
|
745
|
+
subject.online_date = 2.weeks.ago
|
746
|
+
subject.online_days = 0
|
747
|
+
subject.finish
|
748
|
+
end
|
749
|
+
|
750
|
+
its(:failed?) { should be_true }
|
751
|
+
|
752
|
+
it "should generate credits for users" do
|
753
|
+
backer.confirm!
|
754
|
+
user.reload
|
755
|
+
user.credits.should == 20
|
756
|
+
end
|
757
|
+
end
|
758
|
+
end
|
759
|
+
|
760
|
+
end
|
761
|
+
|
762
|
+
describe '#permalink_on_routes?' do
|
763
|
+
it 'should allow a unique permalink' do
|
764
|
+
Project.permalink_on_routes?('permalink_test').should be_false
|
765
|
+
end
|
766
|
+
|
767
|
+
it 'should not allow a permalink to be one of catarse\'s routes' do
|
768
|
+
Project.permalink_on_routes?('projects').should be_true
|
769
|
+
end
|
770
|
+
end
|
771
|
+
end
|