Skip to content

Instantly share code, notes, and snippets.

@wenbert
Created January 9, 2012 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wenbert/1582749 to your computer and use it in GitHub Desktop.
Save wenbert/1582749 to your computer and use it in GitHub Desktop.
require 'test_helper'
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:one)
end
test "should get index" do
get :index
assert_response :success
#assert_not_nil assigns(:allergies)
end
test "should get new" do
get :new
assert_response :success
end
test "should create allergy" do
assert_difference('Allergy.count') do
post :create, allergy: @allergy.attributes
end
assert_redirected_to allergy_path(assigns(:allergy))
end
test "should show allergy" do
get :show, id: @allergy.to_param
assert_response :success
end
test "should get edit" do
get :edit, id: @allergy.to_param
assert_response :success
end
test "should update allergy" do
put :update, id: @allergy.to_param, allergy: @allergy.attributes
assert_redirected_to allergy_path(assigns(:allergy))
end
test "should destroy allergy" do
assert_difference('Allergy.count', -1) do
delete :destroy, id: @allergy.to_param
end
assert_redirected_to allergies_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment