Sha256: 65b67d5efdb26b66703e24e9d9098e2140cf739864c777382fcad3432b58e39a
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require "helper" class CompaniesInvalidParamsControllerTest < ActionController::TestCase tests CompaniesController setup do @controller.expects(:render).at_least_once end test "should create action render to new action if object.save returns false" do Company.expects(:new).with({'name' => 'Hina'}).returns(mock_company) mock_company.expects(:attributes=).with({'name' => 'Hina'}).returns(true) mock_company.expects(:save).returns(false) mock_company.expects(:previous_step!) post(:create, {:company => {:name => "Hina"}, :commit => "Next step"}) assert_response :success end test "should update action redirect to new action if object.save returns false" do Company.expects(:find).with('1').returns(mock_company) mock_company.expects(:attributes=).with({"name" => "Hina"}).returns(true) mock_company.expects(:save).returns(false) mock_company.expects(:previous_step!) post(:update, {:company => {:name => "Hina"}, :id => 1, :commit => "Next step"}) assert_response :success 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_invalid_params_test.rb |
stepper-0.1.0 | test/controllers/controller_invalid_params_test.rb |