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
|
||||
25
test/fixtures/items.yml
vendored
Normal file
25
test/fixtures/items.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
code: MyString
|
||||
current_input_price: 9.99
|
||||
list_price: 9.99
|
||||
unit_id: 1
|
||||
units_in_pack: 9.99
|
||||
description: MyText
|
||||
sub_category_id: 1
|
||||
stock: 1
|
||||
on_display: false
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
code: MyString
|
||||
current_input_price: 9.99
|
||||
list_price: 9.99
|
||||
unit_id: 1
|
||||
units_in_pack: 9.99
|
||||
description: MyText
|
||||
sub_category_id: 1
|
||||
stock: 1
|
||||
on_display: false
|
||||
7
test/fixtures/media_types.yml
vendored
Normal file
7
test/fixtures/media_types.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
|
||||
11
test/fixtures/multi_media_descriptions.yml
vendored
Normal file
11
test/fixtures/multi_media_descriptions.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
url: MyString
|
||||
item_id: 1
|
||||
media_type_id: 1
|
||||
|
||||
two:
|
||||
url: MyString
|
||||
item_id: 1
|
||||
media_type_id: 1
|
||||
9
test/fixtures/units.yml
vendored
Normal file
9
test/fixtures/units.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
short_name: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
short_name: MyString
|
||||
7
test/models/item_test.rb
Normal file
7
test/models/item_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ItemTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
7
test/models/media_type_test.rb
Normal file
7
test/models/media_type_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class MediaTypeTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
7
test/models/multi_media_description_test.rb
Normal file
7
test/models/multi_media_description_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class MultiMediaDescriptionTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
7
test/models/unit_test.rb
Normal file
7
test/models/unit_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class UnitTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user