added sections

This commit is contained in:
Edin Dazdarevic
2015-01-17 23:59:26 +01:00
parent e5809207a9
commit 6d1ac88a7f
8 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
require 'test_helper'
class SectionsControllerTest < ActionController::TestCase
setup do
@section = sections(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:sections)
end
test "should get new" do
get :new
assert_response :success
end
test "should create section" do
assert_difference('Section.count') do
post :create, section: { name: @section.name }
end
assert_redirected_to section_path(assigns(:section))
end
test "should show section" do
get :show, id: @section
assert_response :success
end
test "should get edit" do
get :edit, id: @section
assert_response :success
end
test "should update section" do
patch :update, id: @section, section: { name: @section.name }
assert_redirected_to section_path(assigns(:section))
end
test "should destroy section" do
assert_difference('Section.count', -1) do
delete :destroy, id: @section
end
assert_redirected_to sections_path
end
end