0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Railsチュートリアル第3章で学んだこと

Posted at

第3章ではこれから作っていくsampleアプリの簡易的なページを作りました。

簡易的なページを作っていく中で簡単なテストも書いていきました

今回はコントローラーのテストを書きました。

test "should get home" do
get static_pages_home_url
assert_response :success
end

これの意味はHomeページのテスト。GETリクエストをhomeアクションに対して発行(=送信)せよ。そうすれば、リクエストに対するレスポンスは[成功]になるはずという意味らしい。

このテストを先に書いてREDになるのであとはルーティング→コントローラー→ビューページを
してGREENにしてこのテストOKみたいな感じらしい

これを各ページやっていきました。

あとは各ページの重複したコードををリファクタリングすることも学びました。

Railsのいいとこはリファクタリングしやすいところなのかもしれない。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?