Below is an example of a behaviours_controller_spec.rb file:
describe ‘#update’ do
it “should allow the rating of an item by the review person” do
item=mock_model(Item)
review=mock_model(Review)
get :update, rating_id: review.id, id: item.id, rating: 4
response.status.should==302
end
it “should allow the rating of an item by the review manager” do
item=mock_model(Item)
review=mock_model(Review)
put :update, rating_id: review.id, id: item.id, rating: 4
response.status.should==302
end
end
Leave a Reply