created items and configured back office ui a bit
This commit is contained in:
49
test/controllers/items_controller_test.rb
Normal file
49
test/controllers/items_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ItemsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@item = items(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:items)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create item" do
|
||||
assert_difference('Item.count') do
|
||||
post :create, item: { code: @item.code, current_input_price: @item.current_input_price, description: @item.description, list_price: @item.list_price, name: @item.name, on_display: @item.on_display, stock: @item.stock, sub_category_id: @item.sub_category_id, unit_id: @item.unit_id, units_in_pack: @item.units_in_pack }
|
||||
end
|
||||
|
||||
assert_redirected_to item_path(assigns(:item))
|
||||
end
|
||||
|
||||
test "should show item" do
|
||||
get :show, id: @item
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @item
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update item" do
|
||||
patch :update, id: @item, item: { code: @item.code, current_input_price: @item.current_input_price, description: @item.description, list_price: @item.list_price, name: @item.name, on_display: @item.on_display, stock: @item.stock, sub_category_id: @item.sub_category_id, unit_id: @item.unit_id, units_in_pack: @item.units_in_pack }
|
||||
assert_redirected_to item_path(assigns(:item))
|
||||
end
|
||||
|
||||
test "should destroy item" do
|
||||
assert_difference('Item.count', -1) do
|
||||
delete :destroy, id: @item
|
||||
end
|
||||
|
||||
assert_redirected_to items_path
|
||||
end
|
||||
end
|
||||
49
test/controllers/media_types_controller_test.rb
Normal file
49
test/controllers/media_types_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class MediaTypesControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@media_type = media_types(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:media_types)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create media_type" do
|
||||
assert_difference('MediaType.count') do
|
||||
post :create, media_type: { name: @media_type.name }
|
||||
end
|
||||
|
||||
assert_redirected_to media_type_path(assigns(:media_type))
|
||||
end
|
||||
|
||||
test "should show media_type" do
|
||||
get :show, id: @media_type
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @media_type
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update media_type" do
|
||||
patch :update, id: @media_type, media_type: { name: @media_type.name }
|
||||
assert_redirected_to media_type_path(assigns(:media_type))
|
||||
end
|
||||
|
||||
test "should destroy media_type" do
|
||||
assert_difference('MediaType.count', -1) do
|
||||
delete :destroy, id: @media_type
|
||||
end
|
||||
|
||||
assert_redirected_to media_types_path
|
||||
end
|
||||
end
|
||||
49
test/controllers/multi_media_descriptions_controller_test.rb
Normal file
49
test/controllers/multi_media_descriptions_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class MultiMediaDescriptionsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@multi_media_description = multi_media_descriptions(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:multi_media_descriptions)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create multi_media_description" do
|
||||
assert_difference('MultiMediaDescription.count') do
|
||||
post :create, multi_media_description: { item_id: @multi_media_description.item_id, media_type_id: @multi_media_description.media_type_id, url: @multi_media_description.url }
|
||||
end
|
||||
|
||||
assert_redirected_to multi_media_description_path(assigns(:multi_media_description))
|
||||
end
|
||||
|
||||
test "should show multi_media_description" do
|
||||
get :show, id: @multi_media_description
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @multi_media_description
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update multi_media_description" do
|
||||
patch :update, id: @multi_media_description, multi_media_description: { item_id: @multi_media_description.item_id, media_type_id: @multi_media_description.media_type_id, url: @multi_media_description.url }
|
||||
assert_redirected_to multi_media_description_path(assigns(:multi_media_description))
|
||||
end
|
||||
|
||||
test "should destroy multi_media_description" do
|
||||
assert_difference('MultiMediaDescription.count', -1) do
|
||||
delete :destroy, id: @multi_media_description
|
||||
end
|
||||
|
||||
assert_redirected_to multi_media_descriptions_path
|
||||
end
|
||||
end
|
||||
49
test/controllers/units_controller_test.rb
Normal file
49
test/controllers/units_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class UnitsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@unit = units(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:units)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create unit" do
|
||||
assert_difference('Unit.count') do
|
||||
post :create, unit: { name: @unit.name, short_name: @unit.short_name }
|
||||
end
|
||||
|
||||
assert_redirected_to unit_path(assigns(:unit))
|
||||
end
|
||||
|
||||
test "should show unit" do
|
||||
get :show, id: @unit
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @unit
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update unit" do
|
||||
patch :update, id: @unit, unit: { name: @unit.name, short_name: @unit.short_name }
|
||||
assert_redirected_to unit_path(assigns(:unit))
|
||||
end
|
||||
|
||||
test "should destroy unit" do
|
||||
assert_difference('Unit.count', -1) do
|
||||
delete :destroy, id: @unit
|
||||
end
|
||||
|
||||
assert_redirected_to units_path
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user