Below is an example on how to use Stubs in RSpec 2:
context “percentage of review” do
it “should be able to return the percentage of review” do
section=Section.create(:section_config=>@section_config, :review => @review)
item=Item.create(:section=>section)
item.stub(:component_of_score_met).and_return(3.5)
item.stub(:weighting_of_review).and_return(5.5)
item.percentage_of_review.should==19.25
end
end
Leave a Reply