タグ

ブックマーク / engineerflies.blogspot.com (1)

  • RSpecのequal, eql, eq, be の違い

    Matcherの定義はここ。beに引数があればBeSameAs#matches?がshouldによって呼ばれる仕組みになっている。 整理して実際に試してみよう。以下のようにString, Array, Fixnumの型のインスタンスについてそれぞれeq, eql, equal, beのマッチャでSpecを実施してみた。 # ./tmp_spec.rb require 'rspec' describe 'eq' do it('should find two strings are equal') { "".should eq ""} it('should find two Arrays are equal') { {:a => 1}.should eq :a => 1 } it('should find two Fixnums are equal') { 1.should eq 1 } en

    hoppie
    hoppie 2014/12/04
    Fixnumは即値
  • 1