Last active
September 17, 2021 03:45
-
-
Save isseium/5822504 to your computer and use it in GitHub Desktop.
rspec の include で hash 構造をチェックするテスト
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
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