Last active
November 27, 2015 09:59
-
-
Save YumaInaura/c9f6e47bf8a151424303 to your computer and use it in GitHub Desktop.
Rspec | メソッドチェーンの検証方法 ( expect_any_instance_of ) ref: http://qiita.com/Yinaura/items/678c5163c0aa6cba6272
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
| { name: 'John' }.to_a.class # => Array |
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
| require 'spec_helper' | |
| describe do | |
| it do | |
| expect_any_instance_of(Hash).to receive(:to_a) | |
| { name: 'John' }.to_a | |
| end | |
| end |
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
| require 'spec_helper' | |
| describe do | |
| it do | |
| expect_any_instance_of(Hash).to receive(:to_a) | |
| expect_any_instance_of(Array).to receive(:to_s) | |
| { name: 'John' }.to_a.to_s | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment