Skip to content

Instantly share code, notes, and snippets.

@k-rudy
k-rudy / multi-parameter_attributes_spec.rb
Last active September 6, 2016 13:02
Multiparameter Attributes support in Mongoid 4 (Rails 4.0.1) Code is taken from https://github.com/mongoid/mongoid/issues/2954 with minor amendments to work with Rails 4.0.1
# This class is needed since Mongoid doesn't support Multi-parameter
# attributes in version 4.0 before it's moved to active model in rails 4
#
# https://github.com/mongoid/mongoid/issues/2954
#
require "spec_helper"
describe Mongoid::MultiParameterAttributes do
@moro
moro / unit_test_spec.rb
Created September 19, 2012 02:31
unit_test_spec.rb
class A
def foo(num)
%w[one two three][num - 1]
end
end
describe A do
describe "#foo" do
RSpec::Matchers.define :do_foo do |args|
match do |instance|
@jak180
jak180 / gist:3402283
Created August 20, 2012 08:37 — forked from rosylilly/gist:3401612
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。 後輩: 頼んでばっかしで役に立たない。 サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。 プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。

@naoty
naoty / .vimrc
Created May 17, 2012 03:14
.vimrc settings for rails tdd
Bundle 'git://github.com/kana/vim-altr.git'
" F2, F3でコードとテストを切り替え
nmap <F2> <Plug>(altr-back)
nmap <F3> <Plug>(altr-forward)
" 切り替えの候補を定義
call altr#define('app/models/%.rb', 'spec/models/%_spec.rb')
call altr#define('app/controllers/%.rb', 'spec/controllers/%_spec.rb')