I have an action and I am testing it like this:
@event = Evento.new(params[:event])
@event.aproved = false
redirect_to :action => “index”
render :action => “new”
The RSpec test:
@event = mock_model(Event)
it “should register some event and keep it not aproved” do
response.should redirect_to :action => ‘index’
It seems to be working for me and the test is passing, by I think this
test is still ugly or probabily can be improved.
How do you make tests like this?