Sha256: 7878ec93ac4ab24314900a791d58c3378f2edb5f3619c8c6ee486ee97ab7fd0c
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require 'helper' class RedirectControllerTest < ActionController::TestCase tests OrdersController setup do Order.expects(:find).with('1').returns(mock_order) mock_order.expects(:attributes=).with({'code' => '23'}).returns(true) mock_order.expects(:save).returns(true) mock_order.stubs(:id).returns(1) end test "should redirect to :action => :index if commit 'Save'" do mock_order.stubs(:stepper_current_step).returns("step2") mock_order.stubs(:previous_step!) put(:update, {:order => {:code => "23"}, :commit => "Finish later", :id => 1}) assert_response :redirect assert_redirected_to "http://test.host/orders" end test "should redirect to show if commit 'Finish' and option is Proc" do mock_order.stubs(:stepper_current_step).returns("step3") put(:update, {:order => {:code => "23"}, :commit => "Finish form", :id => 1}) assert_response :redirect assert_redirected_to "http://test.host/orders/1" end protected def mock_order(stubs={}) @mock_order ||= mock(stubs) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stepper-0.2.0 | test/controllers/redirect_test.rb |
stepper-0.1.0 | test/controllers/redirect_test.rb |