creation of categories ready
This commit is contained in:
0
test/controllers/.keep
Normal file
0
test/controllers/.keep
Normal file
49
test/controllers/categories_controller_test.rb
Normal file
49
test/controllers/categories_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class CategoriesControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@category = categories(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:categories)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create category" do
|
||||
assert_difference('Category.count') do
|
||||
post :create, category: { name: @category.name }
|
||||
end
|
||||
|
||||
assert_redirected_to category_path(assigns(:category))
|
||||
end
|
||||
|
||||
test "should show category" do
|
||||
get :show, id: @category
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @category
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update category" do
|
||||
patch :update, id: @category, category: { name: @category.name }
|
||||
assert_redirected_to category_path(assigns(:category))
|
||||
end
|
||||
|
||||
test "should destroy category" do
|
||||
assert_difference('Category.count', -1) do
|
||||
delete :destroy, id: @category
|
||||
end
|
||||
|
||||
assert_redirected_to categories_path
|
||||
end
|
||||
end
|
||||
0
test/fixtures/.keep
vendored
Normal file
0
test/fixtures/.keep
vendored
Normal file
7
test/fixtures/categories.yml
vendored
Normal file
7
test/fixtures/categories.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
0
test/helpers/.keep
Normal file
0
test/helpers/.keep
Normal file
0
test/integration/.keep
Normal file
0
test/integration/.keep
Normal file
0
test/mailers/.keep
Normal file
0
test/mailers/.keep
Normal file
0
test/models/.keep
Normal file
0
test/models/.keep
Normal file
7
test/models/category_test.rb
Normal file
7
test/models/category_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class CategoryTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
10
test/test_helper.rb
Normal file
10
test/test_helper.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
||||
fixtures :all
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
end
|
||||
Reference in New Issue
Block a user