Skip to content

Commit

Permalink
Some more controller tests...
Browse files Browse the repository at this point in the history
  • Loading branch information
guineveresaenger committed Oct 28, 2016
1 parent b13f664 commit c1931f4
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 11 deletions.
20 changes: 12 additions & 8 deletions test/controllers/orders_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
require 'test_helper'

class OrdersControllerTest < ActionController::TestCase
# setup do
# @order = orders(:one)
# end
#
# test "should get index" do
# get orders_url
# assert_response :success
# end
setup do
@order = orders(:one)
end

# test "get index shows all orders" do
# session[:merchant_id] = merchants(:one).id
# order_one = orders(:one)
#
# assert_response :success
# assert_template :index
#
# end
#
# test "should get new" do
# get new_order_url
Expand Down
35 changes: 33 additions & 2 deletions test/controllers/payment_details_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
require 'test_helper'

class PaymentDetailsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
test "should show payment detail" do
get :show, {id: payment_details(:payment_card).id}
assert_response :success
end

test "should get new" do
get :new, order_id: payment_details(:payment_card).id

assert_response :success
end

# test "should create payment detail" do
# order_id = payment_details(:controller_test_card).order_id
# # assert_difference('PaymentDetail.count', 1) do
# post :create, { payment_detail:
# {
# order_id: order_id,
# buyer_name: "Testing Person",
# email: "[email protected]",
# street: "Hauptstrasse",
# city: "Hamburg",
# state: "Germany",
# zip: 54321,
# cc_four_digits: 5105,
# cc_expiration_date: "2017-10-24 13:53:49 -0700",
# time_placed: "2016-10-24 12:53:49 -0700",
# CVV: 111
# }, order_id: order_id
# }
# # end
#
# assert_response :redirect
# assert_redirected_to payment_details_path
# end
end
16 changes: 15 additions & 1 deletion test/fixtures/payment_details.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,19 @@ payment_card:
zip: 12345
cc_four_digits: xxxx
cc_expiration_date: ????
time_placed: $$$$
time_placed: "2016-10-24 12:53:49 -0700"
CVV: ???

controller_test_card:
order: filter_order_complete_shipped
buyer_name: "Ada Lovelace"
email: "[email protected]"
street: "Fourth Avenue"
city: "Seattle"
state: "WA"
zip: 12345
cc_four_digits: xxxx
cc_expiration_date: ????
time_placed: "2016-10-24 12:53:49 -0700"
CVV: ???

0 comments on commit c1931f4

Please sign in to comment.