Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # these tests pass
- require "#{File.dirname(__FILE__)}/../test_helper"
- class DslUserStoriesTest < ActionController::IntegrationTest
- fixtures :roles, :rights, :rights_roles, :users, :roles_users,
- fixtures
- def test_professor_should_be_able_to_add_a_course
- # Course.delete_all
- prof = public_user
- prof.logs_in_successfully_as 'inst1','inst1'
- prof.is_viewing nil # defaults to home i guess
- prof.clicks_on 'course/list'
- prof.clicks_on 'course/new'
- end
- def test_public_should_not_be_able_to_add_a_course
- end
- def test_admin_can_add_course_and_set_professor
- end
- def public_user
- open_session do |user|
- def user.logs_in_successfully_as(name,pass)
- get '/login/login'
- assert_response :success
- assert_template 'login'
- post "login/login", :username=>name, :password=>pass
- assert_response :redirect
- end
- def user.is_logged_in_as(name)
- assert_equal name, current_user.username
- end
- def user.is_viewing(page)
- assert_template page
- end
- def user.clicks_on(path)
- get path
- assert_response :success
- assert_template path
- end
- def user.current_user
- @request.session[:user] if @request
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement