Guest User

Untitled

a guest
Feb 19th, 2018
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. require File.dirname(__FILE__) + '/../test_helper'
  2.  
  3. class EditorActionsTest < ActionController::IntegrationTest
  4. # CNK not sure if we are going to use fixtures
  5. # I would prefer to use factories but am having trouble with that
  6. # fixtures :users, :roles, :roles_users, :pages
  7.  
  8. def setup
  9. @home_page = Factory.create_home_page
  10. @editor = Factory.create_user_with_role('editor', :login => 'abenter', :email => 'abenter@caltech.edu', :password => 'abenter', :password_confirmation => 'abenter')
  11. end
  12.  
  13. def test_editor_editing_pages
  14. # Before logging in, there shouldn't be any edit links
  15. get '/'
  16. assert_response :success
  17. assert_no_tag "a[href=login]"
  18.  
  19. # now login, and we should have edit links
  20. puts "login is #{@editor.login}"
  21. puts "login is #{@editor.password}"
  22. get '/login'
  23. assert_template 'sessions/new'
  24. assert_select "form" do
  25. assert_select "input#password"
  26. end
  27. post '/session', :user => {:login => @editor.login, :password => @editor.password}
  28. # assert_redirected_to '/'
  29. assert_match /Invalid/, flash[:notice]
  30. end
  31. end
Add Comment
Please, Sign In to add comment