-
-
Save maxy/9edb5f84df47abc998a4c1ab404645f4 to your computer and use it in GitHub Desktop.
rspec の include で hash 構造をチェックするテスト
This file contains 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
describe "Rspec include test" do | |
it "include" do | |
hash = {:a => 'A', :b => 'B', :c => { :ca => 'CA' }} | |
expect(hash).to include(:c => {:ca => 'CA'}); # | |
expect(hash).to include(:a => 'A', :c => {:ca => 'CA'}); # ならべてもいいっぽい | |
expect(hash).to_not include(:ca => 'CA'); # ちゃんと構造みてくれる | |
expect(hash).to include(:a); # キーだけでもOK | |
expect(hash).to_not include(:d); # キーだけでもOK | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment