Sha256: 2881e6e3608bab9cbe64c2f21671aae8f37b4e26e8ebf2798eaa4b7926f237b0
Contents?: true
Size: 985 Bytes
Versions: 2
Compression:
Stored size: 985 Bytes
Contents
require "helper" class CompaniesCreateControllerTest < ActionController::TestCase tests CompaniesController setup do Company.expects(:new).with({'name' => 'Hina'}).returns(mock_company) mock_company.expects(:attributes=).with({'name' => 'Hina'}).returns(true) mock_company.expects(:save).returns(true) mock_company.stubs(:id).returns(1) end test "should redirect to next step if commit 'Next step'" do mock_company.stubs(:stepper_current_step).returns("step1") post(:create, {:company => {:name => "Hina"}, :commit => "Next step"}) assert_response :redirect assert_redirected_to "http://test.host/companies/1/next_step" end test "should redirect to index if commit 'Finish later'" do post(:create, {:company => {:name => "Hina"}, :commit => "Finish later"}) assert_response :redirect assert_redirected_to "http://test.host/companies" end protected def mock_company(stubs={}) @mock_company ||= mock(stubs) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stepper-0.2.0 | test/controllers/controller_create_test.rb |
stepper-0.1.0 | test/controllers/controller_create_test.rb |