Slightly flummoxed on this one.
Spec::Mocks::MockExpectationError in 'ChartEventsController handling
GET /chart_events should find all chart_events given a value'
expected: ([:all, {:conditions=>["value LIKE ?", "%chart_event%"]}])
got: ([:all, {:conditions=>["value LIKE ?", "%chart_event%"]}])
In other words it got exactly what it expected, but, er, failed?
Controller:
if params[:q]
@chart_events = ChartEvent.find(:all, :conditions =>['value LIKE
?', "%#{(params[:q])}%"])
else
@chart_events = ChartEvent.all(:order=>'value')
end
controller_spec
before do
@chart_event = mock_model(ChartEvent, :value => "chart_event")
ChartEvent.stub!(:find).and_return([@chart_event])
end
it "should find all chart_events given a value" do
ChartEvent.should_receive(:find).with([:all, {:conditions=>["value
LIKE ?", "%#{@chart_event.value}%"]}]).and_return([@chart_event])
get :index, :q => @chart_event.value
end
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To post to this group, send email to
rs...@googlegroups.com.
To unsubscribe from this group, send email to
rspec+un...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rspec?hl=en.