Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

この間のアレにspec追加しました。 #12

Closed
wants to merge 4 commits into from
Closed

Conversation

igrep
Copy link
Owner

@igrep igrep commented Sep 20, 2014

先輩、ようやくRSpecの使い方わかってきたので、
この間作ったGreatClassのspec書きました! 😇
後々になってしまってすみません! 💦


※このPull Requestはフィクションです。実在のgem、エンジニア、アプリケーションなどとは一切関係ありません(ただし、crispy自体を除く)。
※私igrepによく似た後輩がPull Requestを送った、という頭のおかしい設定ですが、ご容赦ください。
※また、specを追加したのにビルドが落ちているのはご愛嬌です。

2014年9月21日 RubyHiroba編

it's shorter

I forgot to define some_other_object, but I don't want to increase the lines, so choose Module, which doesn't need to be initialized by let
end
it 'remembers to do the important thing!' do
expect(SomeModule).to receive(:some_important_method)
subject.some_subject_method
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ ああ、ここDRYじゃない。
beforeブロックのsubject.some_subject_methodと完全にダブってます。
これだけ単純なメソッド呼び出しだから気にならないかもしれませんが、
引数が多かったり、もっと複雑な場合でもこのように書きますか?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

それに、やっぱり他のexampleと違って、
expectationを先に書くのが
なんだかあまりしっくりきませんねぇ。 😕

「対象のメソッドを呼んだ後に〇〇な影響を起こす」
という観点で書くほうが自然じゃありませんか?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まぁ、要するに、私が作ったcrispyを使って #13 のように書き換えてください。

@igrep
Copy link
Owner Author

igrep commented Sep 21, 2014

業務連絡:Ruby Hiroba終わったのでcloseします。

@igrep igrep closed this Sep 21, 2014
@igrep igrep deleted the demo-pr branch September 21, 2014 06:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant