2014-10-11 48 views

回答

1

要使用的運營商,使用be

describe :something do 

    it 'works just fine' do 
    expect((1..10)).to be === 5 
    end 

    it 'works fine too' do 
    expect(/[a-z]/).to be === 'a' 
    end 

end 

但也有更具體的選項,對正則表達式:

expect(/[a-z]/).to match('a') 

而對於範圍:

expect(1..10).to cover(5)