パRails🚂
rails s
できない可能性が高いです。
@motohiro-mm
@hiromisugie
2-5-3 109p 「Slim」から
115p 2章終わりまで。
新しいリポジトリ: https://github.com/hiromisugie/Perfect_Ruby_on_Rails_Ch3
116p 第3章から。🚂
@sharoa
@sadanora
@moegi29
@motohiro-mm
rails new アプリ名 --api
:通常のアプリケーションからAPIサーバとして不要な機能を取り除いたアプリケーションを生成できる@hiromisugie
slim
は簡潔かつ高速。簡潔すぎてあまり使いたく無いと思っていたけど、高速とのことなので、がんばって慣れた方が良さそう@cellotak
!
で終わるメソッドには特殊な意味があり、!
で終わらないメソッドはそのままJSONのキーになる@sadanora
@motohiro-mm
第3章あたまから
3-1-2 119pの途中まで。
PR:https://github.com/hiromisugie/Perfect_Ruby_on_Rails_Ch3/pull/3
3-1-2 119p の途中、「実行例では~」から。🚂
@sharoa
@motohiro-mm
@sadanora
@hiromisugie
⌘
+クリックすると、該当するファイルの該当する部分が開くというのを初めて知った!@cellotak
bin/rails test
を実行することでテストを実行できるが、テスト用のDBの設定を反映しておく必要がある@moegi29
@moegi29
@hiromisugie
PR:https://github.com/hiromisugie/Perfect_Ruby_on_Rails_Ch3/pull/4
3-1-8 126p 「Rails 6.0で追加された並列テスト」から。🚂
@sharoa
assert
が多い!fixture
はモデルクラスに対応するテストデータをあらかじめ定義しておくもので、YAML形式で定義できて、定義したデータに対して名前をつけることができる。覚えておこう。setup
とteardown
が用意されている。これも覚えておこう。@hiromisugie
asser_equal
くらいしか記憶がないので色々覚えていきたい。setup
メソッド、実行後にteardown
メソッドが実行されるらしいが、それぞれputsで目印を出したところ以下のようになり、setup
とteardown
の間でテストが行われているのかどうかがよくわからなかった。call setup
call teardown
TodosControllerTest#test_should_show_todo = 0.04 s = .
call setup
call teardown
TodosControllerTest#test_should_get_new = 0.01 s = .
@moegi29
test_the_truth
のように_でつなぐとテスト名を指定して実行できる。@motohiro-mm
assert
はtrueになるとテストが成功する。メソッドの種類もたくさんある@sadanora
Minitest::Test
を継承したクラスが色々あるbin/rails test -v
でテストの実行結果のログの詳細(実行時間など)を出力してくれる。setup
とteardown
でテストの実行前後で行いたい処理を定義できる。teardown
後にされているのが分かって面白かったです。or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing