Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
- require 'test_helper'
- class CategoryTest < ActiveSupport::TestCase
- def setup
- @category = Category.new(name: "sports")
- end
- test "category should be valid" do
- assert @category.valid?
- end
- test "name should be present" do
- @category.name = " "
- assert_not @category.valid?
- end
- test "name should be unique" do
- @category.save
- category2 = Category.new(name: "sports")
- assert_not category2.valid?
- end
- test "name should not be too long" do
- @category.name = "a" * 26
- assert_not @category.valid?
- end
- test "name should not be too short" do
- @category.name = "aa"
- assert_not @category.valid?
- end
- end
- 1) Error:
- CategoriesControllerTest#test_should_get_show:
- ActionView::Template::Error: undefined method `[]' for nil:NilClass
- app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1500379652327484675_33850180'
- test/controllers/categories_controller_test.rb:20:in `block in <class:CategoriesControllerTest>'
- 2) Error:
- CategoriesControllerTest#test_should_get_categories_index:
- ActionView::Template::Error: undefined method `[]' for nil:NilClass
- app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1500379652327484675_33850180'
- test/controllers/categories_controller_test.rb:10:in `block in <class:CategoriesControllerTest>'
- 3) Error:
- CategoriesControllerTest#test_should_get_new:
- ActionView::Template::Error: undefined method `[]' for nil:NilClass
- app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1500379652327484675_33850180'
- test/controllers/categories_controller_test.rb:15:in `block in <class:CategoriesControllerTest>'
Add Comment
Please, Sign In to add comment