/test/integration/students/access_test.rb

https://github.com/kenan-memis/university-web · Ruby · 50 lines · 39 code · 11 blank · 0 comment · 0 complexity · 7fe4de7ab24e4266350cf6268c5a9cb7 MD5 · raw file

  1. require 'test_helper'
  2. module Students
  3. class AccessTest < ActionDispatch::IntegrationTest
  4. story "As a Student I want to access the application" do
  5. setup do
  6. @user = Factory(:user, :email => "rmu@test.com",
  7. :password => "123456", :password_confirmation => "123456")
  8. end
  9. scenario "sign in" do
  10. visit root_path
  11. assert_content "Learning Ruby, one conversation at a time"
  12. click_link "University Web"
  13. assert_current_path new_user_session_path
  14. fill_in "Email", :with => "rmu@test.com"
  15. fill_in "Password", :with => "123456"
  16. click_button "Sign in"
  17. assert_current_path dashboard_path
  18. assert_flash "Signed in successfully"
  19. assert_content "IRC Channels"
  20. assert_link "Sign Out"
  21. end
  22. scenario "attempt to sign in with invalid credentials" do
  23. visit new_user_session_path
  24. fill_in "Email", :with => "rmu@test.com"
  25. fill_in "Password", :with => "654321"
  26. click_button "Sign in"
  27. assert_current_path new_user_session_path
  28. assert_content "Invalid email or password"
  29. assert_no_link "Sign Out"
  30. end
  31. scenario "sign out" do
  32. sign_user_in @user
  33. assert_current_path dashboard_path
  34. click_link "Sign Out"
  35. assert_content "Learning Ruby, one conversation at a time"
  36. end
  37. end
  38. end
  39. end