Files
old-ribica/back-office/test/controllers/special_offers_controller_test.rb
2015-03-18 06:25:40 +01:00

50 lines
2.0 KiB
Ruby

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