Skip to content
Browse files

[#3922] Test the base case (no-parent, no-student user)

  • Loading branch information...
1 parent 0c99662 commit 103ed874b9a750eb25723740ee6c90986a89a414 @edavis10 committed Mar 21, 2011
Showing with 24 additions and 4 deletions.
  1. +18 −3 test/integration/travel_requests_menu_test.rb
  2. +6 −1 test/test_helper.rb
View
21 test/integration/travel_requests_menu_test.rb
@@ -26,9 +26,24 @@ def setup
end
context "logged in as a normal user (not parent or child)" do
- should "see a top menu item for 'My Page'"
- should "not see a top menu item for 'My Travel Requests'"
- should "not see a top menu item for 'My Students' Requests'"
+ setup do
+ @user = User.generate!(:password => 'test', :password_confirmation => 'test')
+ login_as(@user.login, 'test')
+ visit_home
+ end
+
+ should "see a top menu item for 'My Page'" do
+ assert find("#top-menu li a", :text => "My page")
+ end
+
+ should "not see a top menu item for 'My Travel Requests'" do
+ assert has_no_content?("My Travel Requests")
+ end
+
+ should "not see a top menu item for 'My Students' Requests'" do
+ assert has_no_content?("My Students' Requests")
+ end
+
end
end
View
7 test/test_helper.rb
@@ -17,11 +17,16 @@ def login_as(user="existing", password="existing")
visit "/login"
fill_in 'Login', :with => user
fill_in 'Password', :with => password
- click_button 'login'
+ click_button 'Login'
assert_response :success
assert User.current.logged?
end
+ def visit_home
+ visit '/'
+ assert_response :success
+ end
+
def visit_project(project)
visit '/'
assert_response :success

0 comments on commit 103ed87

Please sign in to comment.
Something went wrong with that request. Please try again.