created item groups and link banners and their associations and fixed bugs with join tables

This commit is contained in:
Senad Uka
2015-03-22 06:17:05 +01:00
parent 38548e3e33
commit bbedb4a877
20 changed files with 219 additions and 81 deletions

View File

@@ -0,0 +1,49 @@
require 'test_helper'
class ItemGroupsControllerTest < ActionController::TestCase
setup do
@item_group = item_groups(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:item_groups)
end
test "should get new" do
get :new
assert_response :success
end
test "should create item_group" do
assert_difference('ItemGroup.count') do
post :create, item_group: { description: @item_group.description, name: @item_group.name, visible: @item_group.visible }
end
assert_redirected_to item_group_path(assigns(:item_group))
end
test "should show item_group" do
get :show, id: @item_group
assert_response :success
end
test "should get edit" do
get :edit, id: @item_group
assert_response :success
end
test "should update item_group" do
patch :update, id: @item_group, item_group: { description: @item_group.description, name: @item_group.name, visible: @item_group.visible }
assert_redirected_to item_group_path(assigns(:item_group))
end
test "should destroy item_group" do
assert_difference('ItemGroup.count', -1) do
delete :destroy, id: @item_group
end
assert_redirected_to item_groups_path
end
end

View File

@@ -0,0 +1,49 @@
require 'test_helper'
class LinkBannersControllerTest < ActionController::TestCase
setup do
@link_banner = link_banners(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:link_banners)
end
test "should get new" do
get :new
assert_response :success
end
test "should create link_banner" do
assert_difference('LinkBanner.count') do
post :create, link_banner: { beginning: @link_banner.beginning, category_id: @link_banner.category_id, checkout_page: @link_banner.checkout_page, ending: @link_banner.ending, footer: @link_banner.footer, header: @link_banner.header, image_url: @link_banner.image_url, item_id: @link_banner.item_id, link_url: @link_banner.link_url, search_result_page: @link_banner.search_result_page, section_id: @link_banner.section_id, start_page: @link_banner.start_page, sub_category_id: @link_banner.sub_category_id, thank_you_page: @link_banner.thank_you_page }
end
assert_redirected_to link_banner_path(assigns(:link_banner))
end
test "should show link_banner" do
get :show, id: @link_banner
assert_response :success
end
test "should get edit" do
get :edit, id: @link_banner
assert_response :success
end
test "should update link_banner" do
patch :update, id: @link_banner, link_banner: { beginning: @link_banner.beginning, category_id: @link_banner.category_id, checkout_page: @link_banner.checkout_page, ending: @link_banner.ending, footer: @link_banner.footer, header: @link_banner.header, image_url: @link_banner.image_url, item_id: @link_banner.item_id, link_url: @link_banner.link_url, search_result_page: @link_banner.search_result_page, section_id: @link_banner.section_id, start_page: @link_banner.start_page, sub_category_id: @link_banner.sub_category_id, thank_you_page: @link_banner.thank_you_page }
assert_redirected_to link_banner_path(assigns(:link_banner))
end
test "should destroy link_banner" do
assert_difference('LinkBanner.count', -1) do
delete :destroy, id: @link_banner
end
assert_redirected_to link_banners_path
end
end

View File

@@ -1,49 +0,0 @@
require 'test_helper'
class SpecialOffersControllerTest < ActionController::TestCase
setup do
@special_offer = special_offers(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:special_offers)
end
test "should get new" do
get :new
assert_response :success
end
test "should create special_offer" do
assert_difference('SpecialOffer.count') do
post :create, special_offer: { beginning: @special_offer.beginning, category_id: @special_offer.category_id, checkout_page: @special_offer.checkout_page, ending: @special_offer.ending, image_url: @special_offer.image_url, item_id: @special_offer.item_id, search_result_page: @special_offer.search_result_page, section_id: @special_offer.section_id, start_page: @special_offer.start_page, sub_category_id: @special_offer.sub_category_id, thank_you_page: @special_offer.thank_you_page }
end
assert_redirected_to special_offer_path(assigns(:special_offer))
end
test "should show special_offer" do
get :show, id: @special_offer
assert_response :success
end
test "should get edit" do
get :edit, id: @special_offer
assert_response :success
end
test "should update special_offer" do
patch :update, id: @special_offer, special_offer: { beginning: @special_offer.beginning, category_id: @special_offer.category_id, checkout_page: @special_offer.checkout_page, ending: @special_offer.ending, image_url: @special_offer.image_url, item_id: @special_offer.item_id, search_result_page: @special_offer.search_result_page, section_id: @special_offer.section_id, start_page: @special_offer.start_page, sub_category_id: @special_offer.sub_category_id, thank_you_page: @special_offer.thank_you_page }
assert_redirected_to special_offer_path(assigns(:special_offer))
end
test "should destroy special_offer" do
assert_difference('SpecialOffer.count', -1) do
delete :destroy, id: @special_offer
end
assert_redirected_to special_offers_path
end
end