Created
March 6, 2011 07:07
-
-
Save jamesbrink/857097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class PatientsControllerTest < ActionController::TestCase | |
setup do | |
@patient = patients(:one) | |
activate_authlogic | |
end | |
test "patient actions without user" do | |
PatientsController.action_methods.each do |action| | |
if action == "index" | |
get action.to_sym | |
assert_redirected_to :login | |
else | |
get action.to_sym, :id => @patient.to_param | |
assert_redirected_to :login | |
end | |
end | |
end | |
test "patient index as admin" do | |
UserSession.create(users(:admin)) | |
get :index | |
assert_response :success | |
end | |
test "patient new as admin" do | |
UserSession.create(users(:admin)) | |
get :new | |
assert_response :success | |
end | |
test "patient create as admin" do | |
UserSession.create(users(:admin)) | |
assert_difference('patients.count') do | |
post :create, :patient => @patient.attributes | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment