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
| Rehearsal --------------------------------------------------------- | |
| Post.new 0.210000 0.010000 0.220000 ( 0.220546) | |
| Factory.build(:post) 0.280000 0.000000 0.280000 ( 0.278631) | |
| Post.new with save! 3.620000 1.180000 4.800000 ( 6.884482) | |
| Factory.create(:post) 3.710000 1.200000 4.910000 ( 6.995768) | |
| ----------------------------------------------- total: 10.210000sec | |
| user system total real | |
| Post.new 0.180000 0.000000 0.180000 ( 0.178181) | |
| Factory.build(:post) 0.230000 0.000000 0.230000 ( 0.235513) |
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
| CompositeView = function(options) { | |
| this.children = []; | |
| Backbone.View.apply(this, [options]); | |
| }; | |
| _.extend(CompositeView.prototype, Backbone.View.prototype, { | |
| leave: function() { | |
| this.unbind(); | |
| this.remove(); | |
| _(this.children).invoke("leave"); |
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
| bash -c "echo -e 'daemonize yes\npidfile /var/run/redis.pid\nport 6379\ntimeout 300\nloglevel notice\nlogfile stdout\ndatabases 16\nsave 900 1\nsave 300 10\nsave 60 10000\nrdbcompression yes\ndbfilename dump.rdb\ndir /var/redis\nappendonly no\nappendfsync everysec\nvm-enabled no\nvm-swap-file /tmp/redis.swap\nvm-max-memory 0\nvm-page-size 32\nvm-pages 134217728\nvm-max-threads 4\nglueoutputbuf yes\nhash-max-zipmap-entries 64\nhash-max-zipmap-value 512\nactiverehashing yes\n' > /etc/redis/6379.conf |
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
| if defined?(RSpec) | |
| namespace :rcov do | |
| RSpec::Core::RakeTask.new(:rspec_aggregate) do |task| | |
| task.pattern = 'spec/**/*_spec.rb' | |
| task.rspec_opts = "--format progress" | |
| task.rcov = true | |
| task.rcov_opts = "--rails --exclude osx\/objc,spec,gems\/ " + | |
| "--aggregate tmp/coverage.data" | |
| 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
| class UsersController < ApplicationController | |
| def edit | |
| assign_user_form | |
| end | |
| def update | |
| if assign_user_form.commit | |
| redirect_to @user, :flash => "User saved." | |
| else | |
| render 'new' |
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
| Factory.define(:estimate_with_items) do |f| | |
| # ... | |
| f.passing(true).ignore | |
| f.after_create do |e| | |
| e.items << Factory(:estimate_item, :estimate => e, :inspection => true, :op => Factory(:inspection_op, :dealer => e.dealer)).tap do |item| | |
| inspection = item.inspections.first | |
| location = inspection.locations.first | |
| outcome = inspection.failures.detect { |outcome| outcome.performed == passing } | |
| location.create_data!(:inspection_failure_id => outcome.id, :created_by => 'factory') |
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
| # Also make sure that config.action_dispatch.show_exceptions is set to true in config/environments/test.rb | |
| class AllowRescue | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| env['action_dispatch.show_exceptions'] = !!ActionController::Base.allow_rescue | |
| @app.call(env) |
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
| function! RubyTrim(string) | |
| return substitute(a:string, "^\\s\\+\\|\\s\\+$", "", "g") | |
| endfunction | |
| function! RubySplitOneliner() | |
| let lineno = line(".") | |
| let line = getline(lineno) | |
| let leftBrace = stridx(line, "{") | |
| let rightBrace = strridx(line, "}") | |
| let indent = matchstr(line, "^\\s\\+") |
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
| describe Message do | |
| create :account, :name => "My Account" do | |
| create :user | |
| create :project | |
| with :project, :user => :author do | |
| create :message | |
| end | |
| end |