Guest User

Untitled

a guest
Jan 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
  2. <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  3.  
  4. require 'test_helper'
  5.  
  6. class CategoryTest < ActiveSupport::TestCase
  7.  
  8. def setup
  9. @category = Category.new(name: "sports")
  10. end
  11.  
  12.  
  13. test "category should be valid" do
  14. assert @category.valid?
  15. end
  16.  
  17. test "name should be present" do
  18. @category.name = " "
  19. assert_not @category.valid?
  20. end
  21.  
  22. test "name should be unique" do
  23. @category.save
  24. category2 = Category.new(name: "sports")
  25. assert_not category2.valid?
  26. end
  27.  
  28. test "name should not be too long" do
  29. @category.name = "a" * 26
  30. assert_not @category.valid?
  31. end
  32.  
  33. test "name should not be too short" do
  34. @category.name = "aa"
  35. assert_not @category.valid?
  36. end
  37.  
  38.  
  39. end
  40.  
  41. 1) Error:
  42. CategoriesControllerTest#test_should_get_show:
  43. ActionView::Template::Error: undefined method `[]' for nil:NilClass
  44. app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1500379652327484675_33850180'
  45. test/controllers/categories_controller_test.rb:20:in `block in <class:CategoriesControllerTest>'
  46.  
  47. 2) Error:
  48. CategoriesControllerTest#test_should_get_categories_index:
  49. ActionView::Template::Error: undefined method `[]' for nil:NilClass
  50. app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1500379652327484675_33850180'
  51. test/controllers/categories_controller_test.rb:10:in `block in <class:CategoriesControllerTest>'
  52.  
  53. 3) Error:
  54. CategoriesControllerTest#test_should_get_new:
  55. ActionView::Template::Error: undefined method `[]' for nil:NilClass
  56. app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1500379652327484675_33850180'
  57. test/controllers/categories_controller_test.rb:15:in `block in <class:CategoriesControllerTest>'
Add Comment
Please, Sign In to add comment