ホーム > 今日のテストコード > rspecのincludeマッチャ

rspecのincludeマッチャ

rspecのincludeマッチャ。Hashの場合の挙動はバージョン間で色々と違いがありますね。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'rubygems'
gem 'rspec', '>= 1.1.12'
require 'spec'
 
describe 'includeマッチャ' do
 
  before :each do
    @lang_authors = { 
      :ruby => 'まつもとゆきひろ',
      :python => 'Guido van Rossum',
      :perl => 'Larry Wall'
    }
  end
 
  it 'Hashが指定されたキーを持つか' do
    # 以下はrspec 1.1.10, 1.1.11 でエラーになる
    @lang_authors.should include(:ruby)
    @lang_authors.should include(:python)
    @lang_authors.should_not include(:vb)
  end
 
  it 'Hashが指定されたキーと値の組み合わせを持つか' do
    # 以下はrspec 1.1.10より前だと失敗する
    @lang_authors.should include(:ruby => 'まつもとゆきひろ')
    @lang_authors.should_not include(:ruby => 'まつもとひろゆき')
  end
 
  it 'その他はinclude?による評価' do
    @lang_authors[:python].should include('os')
    @lang_authors.keys.should include(:perl)
  end
 
end

参考:

  1. 2020 年 5 月 30 日 13:35 | #1

    Very good article. I will be dealing with many of these issues as well..

  2. 2020 年 5 月 30 日 13:58 | #2

    I really love your website.. Excellent colors & theme. Did you create this site yourself? Please reply back as I’m trying to create my own personal website and would like to know where you got this from or what the theme is named. Thanks!

  3. 2020 年 5 月 30 日 14:46 | #3

    Everything is very open with a precise explanation of the challenges. It was truly informative. Your site is extremely helpful. Thank you for sharing!

  4. 2020 年 5 月 30 日 15:00 | #4

    Pretty! This was an incredibly wonderful article. Thank you for supplying this information.

  5. 2020 年 5 月 30 日 15:12 | #5

    You have made some really good points there. I checked on the net for more info about the issue and found most individuals will go along with your views on this site.

  6. 2020 年 5 月 30 日 15:35 | #6

    This is the perfect website for everyone who hopes to find out about this topic. You realize a whole lot its almost hard to argue with you (not that I really would want to…HaHa). You definitely put a brand new spin on a subject which has been written about for ages. Excellent stuff, just excellent!

  7. 2020 年 5 月 30 日 15:49 | #7

    When I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on every time a comment is added I receive four emails with the same comment. There has to be a means you can remove me from that service? Appreciate it!

  8. 2020 年 5 月 30 日 17:46 | #8

    I like reading through an article that can make men and women think. Also, many thanks for allowing for me to comment!

  9. 2020 年 5 月 30 日 17:54 | #9

    Everything is very open with a really clear explanation of the challenges. It was definitely informative. Your website is extremely helpful. Thank you for sharing!

  10. 2020 年 5 月 30 日 18:26 | #10

    I’m impressed, I have to admit. Seldom do I come across a blog that’s both equally educative and engaging, and let me tell you, you have hit the nail on the head. The issue is an issue that too few folks are speaking intelligently about. I am very happy that I came across this during my hunt for something regarding this.

  11. 2020 年 5 月 30 日 18:55 | #11

    After looking over a number of the blog posts on your web page, I really appreciate your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Please visit my web site as well and tell me your opinion.

  12. 2020 年 5 月 30 日 19:01 | #12

    Spot on with this write-up, I seriously believe that this amazing site needs a great deal more attention. I’ll probably be returning to see more, thanks for the advice!

  13. 2020 年 5 月 30 日 19:24 | #13

    Having read this I believed it was extremely enlightening. I appreciate you taking the time and effort to put this short article together. I once again find myself personally spending way too much time both reading and commenting. But so what, it was still worth it!

  14. 2020 年 5 月 30 日 19:53 | #14

    You’re so interesting! I do not think I have read a single thing like that before. So wonderful to discover another person with a few original thoughts on this topic. Really.. thanks for starting this up. This website is something that’s needed on the web, someone with a bit of originality!

  15. 2020 年 5 月 30 日 19:58 | #15

    Everything is very open with a clear explanation of the issues. It was truly informative. Your site is useful. Many thanks for sharing!

  16. 2020 年 5 月 30 日 20:01 | #16

    I’d like to thank you for the efforts you have put in writing this blog. I’m hoping to see the same high-grade blog posts from you in the future as well. In truth, your creative writing abilities has encouraged me to get my own website now ;)

コメントページ
1 49 50 51 344
  1. 2020 年 4 月 14 日 19:42 | #1
  2. 2020 年 4 月 20 日 11:24 | #2
  3. 2020 年 4 月 26 日 04:06 | #3
  4. 2020 年 4 月 26 日 09:54 | #4
  5. 2020 年 4 月 30 日 00:35 | #5
  6. 2020 年 5 月 5 日 14:56 | #6
  7. 2020 年 5 月 5 日 19:12 | #7
  8. 2020 年 5 月 10 日 00:44 | #8