This file contains 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 'test_app' | |
use Rack::ContentType | |
use Rack::ContentLength | |
run TestApp |
This file contains 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 MyClass | |
def old_method | |
"my_method" | |
end | |
alias new_method old_method | |
# alias_method :new_method, :old_method | |
end | |
obj = MyClass.new |
This file contains 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
each_context { | |
'Aの場合' => { :key => 'a' }, | |
'Bの場合' => { :key => 'b' }, | |
} do | |
it { ... } | |
end | |
__EOF__ | |
{ |
This file contains 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
FFF | |
Failures: | |
1) embedde many object making two grandsons failed childs is one | |
Failure/Error: Parent.where(:foo => 'foo').first.sons.should have(1).items | |
expected 1 items, got 2 | |
# ./embedded_object_id_spec.rb:55:in `block (3 levels) in <top (required)>' | |
2) embedde many object making two grandsons failed grandsons is two |
This file contains 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
request_json 'POST /users/:user_id/articles' do # request_json is nicer than describe_jsonapi? | |
let(:user_id) { 1 } | |
let(:article_id) { 'hello' } | |
before(:all) { User.make!(:id => :user_id) } | |
after(:all) { DatabaseCleaner.clean } | |
context 'when user posts valid article' do | |
request_json do | |
Article.make(:user_id => id, :article_id => article_id) |
This file contains 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_jsonapi 'GET /users/:id' do | |
let(:id) { 1 } | |
context 'when user exists' do | |
before(:all) do | |
User.make(:id => id) | |
Article.make(:user_id => id, :article_id => 1) | |
end | |
after(:all) { DatabaseCleaner.clean } |
This file contains 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 'ruby_gntp' | |
def your_app | |
#TODO: | |
end | |
def your_host | |
#TODO: | |
end |
This file contains 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
[auto-props] | |
### The format of the entries is: | |
### file-name-pattern = propname[=value][;propname[=value]...] | |
### The file-name-pattern can contain wildcards (such as '*' and | |
### '?'). All entries which match (case-insensitively) will be | |
### applied to the file. Note that auto-props functionality | |
### must be enabled, which is typically done by setting the | |
### 'enable-auto-props' option. | |
# *.c = svn:eol-style=native | |
# *.cpp = svn:eol-style=native |
This file contains 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 [ $rvm_ruby_home ] ; then | |
alias gem='gem --config-file ~/.gemrc_for_rvm' | |
echo `type gem` | |
else | |
[ `type gem | awk '{print $4}'` = 'alias' ] && unalias gem | |
fi |
This file contains 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 MyController, '#index' do | |
include PureControllerTestHelper | |
let(:user) { MyModel.make_unsaved } | |
before do | |
mock(MyModel).find { user } | |
end | |
it 'should assign @user' |