Difference between its block and the given block in RSpec

What is the difference between a block and an indication block in RSpec?

subject { MovieList.add_new(10) } specify { subject.should have(10).items } it { subject.track_number.should == 10} 

They seem to be doing the same job. Just check to be sure.

+60
ruby ruby-on-rails rspec
Dec 13 2018-11-11T00:
source share
1 answer

The methods are the same ; they are provided so that the readings in English are better based on the test of your test. Consider these two:

 describe Array do describe "with 3 items" do before { @arr = [1, 2, 3] } specify { @arr.should_not be_empty } specify { @arr.count.should eq(3) } end end describe Array do describe "with 3 items" do subject { [1, 2, 3] } it { should_not be_empty } its(:count) { should eq(3) } end end 
+79
Dec 13 '11 at 4:22
source share



All Articles