Advertisement
Guest User

Untitled

a guest
Dec 16th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. ERROR["test_non-signed_in_user_layout_links", SiteLayoutTest, 1.3199719070007632]
  2. test_non-signed_in_user_layout_links#SiteLayoutTest (1.32s)
  3. ActionView::Template::Error: ActionView::Template::Error: undefined method `name' for nil:NilClass
  4. app/views/pins/_pin.html.erb:2:in `_app_views_pins__pin_html_erb___3167554587389080103_47088431630420'
  5. app/views/static_pages/home.html.erb:6:in `_app_views_static_pages_home_html_erb___4092361779176196837_47088431162360'
  6. test/integration/site_layout_test.rb:10:in `block in <class:SiteLayoutTest>'
  7.  
  8. ERROR["test_signed_in_user_layout_links", SiteLayoutTest, 2.0834625150000647]
  9. test_signed_in_user_layout_links#SiteLayoutTest (2.08s)
  10. ActionView::Template::Error: ActionView::Template::Error: undefined method `name' for nil:NilClass
  11. app/views/pins/_pin.html.erb:2:in `_app_views_pins__pin_html_erb___3167554587389080103_47088457226940'
  12. app/views/static_pages/home.html.erb:6:in `_app_views_static_pages_home_html_erb___4092361779176196837_47088457198480'
  13. test/integration/site_layout_test.rb:24:in `block in <class:SiteLayoutTest>'
  14.  
  15. ERROR["test_should_get_home", StaticPagesControllerTest, 2.1026109900003576]
  16. test_should_get_home#StaticPagesControllerTest (2.10s)
  17. ActionView::Template::Error: ActionView::Template::Error: undefined method `name' for nil:NilClass
  18. app/views/pins/_pin.html.erb:2:in `_app_views_pins__pin_html_erb___3167554587389080103_47088457310920'
  19. app/views/static_pages/home.html.erb:6:in `_app_views_static_pages_home_html_erb___4092361779176196837_47088457291840'
  20. test/controllers/static_pages_controller_test.rb:9:in `block in <class:StaticPagesControllerTest>'
  21.  
  22. require 'test_helper'
  23.  
  24. class SiteLayoutTest < ActionDispatch::IntegrationTest
  25. def setup
  26. ActionMailer::Base.deliveries.clear
  27. @user = users(:john)
  28. end
  29.  
  30. test "non-signed in user layout links" do
  31. get root_path
  32. assert_template 'static_pages/home'
  33. assert_select "a[href=?]", root_path, count: 2
  34. assert_select "a[href=?]", about_path
  35. assert_select "a[href=?]", new_user_session_path, count: 2
  36. assert_select "a[href=?]", new_user_registration_path, count: 1
  37. end
  38.  
  39. test "signed in user layout links" do
  40. get new_user_session_path
  41. assert_template 'devise/sessions/new'
  42. post user_session_path, params: { user: { email: @user.email, password: 'password' } }
  43. assert_not flash.empty?
  44. assert_redirected_to root_path
  45. follow_redirect!
  46. assert_template 'static_pages/home'
  47. assert_select "a[href=?]", new_user_session_path, count: 0
  48. assert_select "a[href=?]", new_user_registration_path, count: 0
  49. assert_select "a[href=?]", edit_user_registration_path
  50. assert_select "a[href=?]", destroy_user_session_path
  51. assert_select "a[href=?]", new_pin_path
  52. end
  53. end
  54.  
  55. require 'test_helper'
  56.  
  57. class StaticPagesControllerTest < ActionDispatch::IntegrationTest
  58. def setup
  59. @user = users(:john)
  60. end
  61.  
  62. test "should get home" do
  63. get root_url
  64. assert_response :success
  65. assert_select "title", full_title
  66. end
  67.  
  68. test "should get about" do
  69. get about_url
  70. assert_response :success
  71. assert_select "title", full_title("About")
  72. end
  73. end
  74.  
  75. john:
  76. name: John Rockefeller
  77. email: john@rockefeller.com
  78. encrypted_password: <%= Devise::Encryptor.digest(User, 'password') %>
  79. created_at: <%= Time.zone.now %>
  80.  
  81. andrew:
  82. name: Andrew Carnegie
  83. email: andrew@carnegie.com
  84. encrypted_password: <%= Devise::Encryptor.digest(User, 'password') %>
  85. created_at: <%= Time.zone.now %>
  86.  
  87. quote:
  88. description: "Lorem quote"
  89. created_at: <%= 10.minutes.ago %>
  90. user: john
  91.  
  92. recipe:
  93. description: "Lorem recipe"
  94. created_at: <%= 3.years.ago %>
  95.  
  96. most_recent:
  97. description: "Lorem most recent"
  98. created_at: <%= Time.zone.now %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement