Created
May 21, 2014 11:13
-
-
Save t-oginogin/d4f8399f95a8ed21bec0 to your computer and use it in GitHub Desktop.
Railsでgetやpost経由のテスト時、スタブに渡された引数の値を確認する(MiniTest) ref: http://qiita.com/t_oginogin/items/431ced39fcdb77f0bb48
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
| res = nil | |
| mock = MiniTest::Mock.new | |
| mock.expect(:call, nil) do |arg1| | |
| res = arg1 | |
| end | |
| Foo.stub(:foo, mock) do | |
| get :test # 内部でFoo.fooを呼ぶ処理 | |
| do | |
| assert_equal 'baz', res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment