タグ

ブックマーク / maeshima.hateblo.jp (1)

  • Chapter 25 Rails Controllers - maeshimaの日記

    Rails controller の spec の書き方について。 25.1 Controller Specs ModelName.new も疎結合のためにstubを実装したほうがいい。 mock_modelってなんだっけ -> new_record?やidなどの基的なstubがついてるmock adding context specific examples 成功時、失敗時それぞれのspecをかく。 what we just did require 'spec_helper' は忘れずに。 controllerのspecで使われるメソッドは主にActionControlelr::TestCaseで定義されている。例えば assigns[] flash[] とか。使い方は省略。 post postの引数は post :create, {:id => 2}, {:user_id => 99

    Chapter 25 Rails Controllers - maeshimaの日記
    yyamano
    yyamano 2013/08/20
    pplication controllerのspecを書く方法について
  • 1