You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1017 B
49 lines
1017 B
require 'test_helper'
|
|
|
|
class LoadsControllerTest < ActionController::TestCase
|
|
def test_index
|
|
get :index
|
|
assert_template 'index'
|
|
end
|
|
|
|
def test_new
|
|
get :new
|
|
assert_template 'new'
|
|
end
|
|
|
|
def test_create_invalid
|
|
Load.any_instance.stubs(:valid?).returns(false)
|
|
post :create
|
|
assert_template 'new'
|
|
end
|
|
|
|
def test_create_valid
|
|
Load.any_instance.stubs(:valid?).returns(true)
|
|
post :create
|
|
assert_redirected_to loads_url
|
|
end
|
|
|
|
def test_edit
|
|
get :edit, :id => Load.first
|
|
assert_template 'edit'
|
|
end
|
|
|
|
def test_update_invalid
|
|
Load.any_instance.stubs(:valid?).returns(false)
|
|
put :update, :id => Load.first
|
|
assert_template 'edit'
|
|
end
|
|
|
|
def test_update_valid
|
|
Load.any_instance.stubs(:valid?).returns(true)
|
|
put :update, :id => Load.first
|
|
assert_redirected_to loads_url
|
|
end
|
|
|
|
def test_destroy
|
|
load = Load.first
|
|
delete :destroy, :id => load
|
|
assert_redirected_to loads_url
|
|
assert !Load.exists?(load.id)
|
|
end
|
|
end
|