created item groups and link banners and their associations and fixed bugs with join tables
This commit is contained in:
49
back-office/test/controllers/item_groups_controller_test.rb
Normal file
49
back-office/test/controllers/item_groups_controller_test.rb
Normal 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
|
||||
49
back-office/test/controllers/link_banners_controller_test.rb
Normal file
49
back-office/test/controllers/link_banners_controller_test.rb
Normal 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
|
||||
@@ -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
|
||||
11
back-office/test/fixtures/item_groups.yml
vendored
Normal file
11
back-office/test/fixtures/item_groups.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
description: MyText
|
||||
visible: false
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
description: MyText
|
||||
visible: false
|
||||
@@ -10,8 +10,11 @@ one:
|
||||
thank_you_page: false
|
||||
search_result_page: false
|
||||
checkout_page: false
|
||||
beginning: 2015-03-18
|
||||
ending: 2015-03-18
|
||||
beginning: 2015-03-22
|
||||
ending: 2015-03-22
|
||||
footer: false
|
||||
header: false
|
||||
link_url: MyString
|
||||
|
||||
two:
|
||||
image_url: MyString
|
||||
@@ -23,5 +26,8 @@ two:
|
||||
thank_you_page: false
|
||||
search_result_page: false
|
||||
checkout_page: false
|
||||
beginning: 2015-03-18
|
||||
ending: 2015-03-18
|
||||
beginning: 2015-03-22
|
||||
ending: 2015-03-22
|
||||
footer: false
|
||||
header: false
|
||||
link_url: MyString
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SpecialOfferTest < ActiveSupport::TestCase
|
||||
class ItemGroupTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
7
back-office/test/models/link_banner_test.rb
Normal file
7
back-office/test/models/link_banner_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class LinkBannerTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user