This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| web: bundle exec unicorn_rails -c config/environments/unicorn-development.rb | |
| worker: bundle exec rake jobs:work | |
| sphinx: bundle exec rake ts:run_in_foreground |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :ts do | |
| # Workaround to make Sphinx run in the foreground | |
| task :run_in_foreground => [ 'ts:conf', 'ts:in' ] do | |
| ts = ThinkingSphinx::Configuration.instance | |
| $kill_sphinx_on_exit = false | |
| unless pid = fork | |
| exec "#{ts.bin_path}#{ts.searchd_binary_name} --pidfile --config #{ts.config_file} --nodetach" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bundle exec spec $* | |
| playsound --volume 2.0 ~/specs_finished.wav |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use this to stub sphinx like this: | |
| # Product.stub(:search).and_return(MockSphinx::ProductStubber.new(products)) | |
| module MockSphinx | |
| class ProductStubber | |
| def initialize products | |
| @products = products | |
| end | |
| # Swallow all following scope calls | |
| def method_missing name, *args, &block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @products = Product.search(params[:q], :page => paginate_page, :per_page => paginate_per_page). | |
| without_hidden_members. | |
| using_sort_mode(params[:sort]). | |
| with_sphinx_state(:published) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| feature "Image failures" do | |
| background do | |
| @category = Category.make | |
| @product_ok = Product.make(:category => @category) | |
| ensure_test_s3_files! | |
| @product_not_ok = Product.make(:category => @category) | |
| Product.stub(:search).and_return(MockSphinx::ProductStubber.new(Product.all)) | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "guard/guard" | |
| module ::Guard | |
| class Precompile < ::Guard::Guard | |
| def run_on_change(path) | |
| puts "Precompiling assets for test env ...." | |
| puts `bundle exec rake assets:precompile RAILS_ENV=test` | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Require the custom guard | |
| require "./lib/guard/precompile" | |
| guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do | |
| watch('config/application.rb') | |
| watch('config/environment.rb') | |
| watch(%r{^config/environments/.+\.rb$}) | |
| watch(%r{^config/initializers/.+\.rb$}) | |
| watch('Gemfile') | |
| watch('Gemfile.lock') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # routes.rb | |
| TestApp::Application.routes.draw do | |
| resources :logins | |
| resource :session | |
| resources :accounts do | |
| resources :things | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # routes.rb is the same | |
| # app/controllers/application_controller.rb | |
| class ApplicationController < ActionController::Base | |
| include ApplicationHelper # Force it to be present in all controllers | |
| before_filter :find_login_and_account | |
| end | |
| # app/helpers/application_helper.rb | |
| module ApplicationHelper |