special offers backoffice is ready now

This commit is contained in:
Senad Uka
2015-03-18 06:25:40 +01:00
parent 3b95500635
commit 658fe4931d
17 changed files with 208 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
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

View File

@@ -0,0 +1,27 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
image_url: MyString
start_page: false
section_id: 1
category_id: 1
sub_category_id: 1
item_id: 1
thank_you_page: false
search_result_page: false
checkout_page: false
beginning: 2015-03-18
ending: 2015-03-18
two:
image_url: MyString
start_page: false
section_id: 1
category_id: 1
sub_category_id: 1
item_id: 1
thank_you_page: false
search_result_page: false
checkout_page: false
beginning: 2015-03-18
ending: 2015-03-18

View File

@@ -0,0 +1,7 @@
require 'test_helper'
class SpecialOfferTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end