Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venshop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huanvl
venshop
Commits
cc365895
Commit
cc365895
authored
Nov 04, 2013
by
vulehuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rspec: card - step 4
parent
ce237467
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
venshop_app/app/controllers/cards_controller.rb
+6
-2
venshop_app/spec/requests/card_pages_spec.rb
+19
-2
No files found.
venshop_app/app/controllers/cards_controller.rb
View file @
cc365895
...
...
@@ -169,7 +169,7 @@ class CardsController < ApplicationController
end
xml_data
+=
'<total>'
+
total
.
to_s
+
'</total>'
xml_data
+=
'</root>'
MyCard
.
create!
(
new_card
=
MyCard
.
create!
(
full_name:
customer_info
[
:full_name
],
email:
customer_info
[
:email
],
phone:
customer_info
[
:phone
],
...
...
@@ -178,11 +178,15 @@ class CardsController < ApplicationController
items:
xml_data
)
UserMailer
.
card_send_to_consignee
(
customer_info
[
:email
],
@card_infos
).
deliver
redirect_to
url_for
(
action:
'thankyou'
)
redirect_to
url_for
(
action:
'thankyou'
,
card_id:
new_card
.
id
)
end
end
def
thankyou
if
params
[
:card_id
].
nil?
||
!
MyCard
.
exists?
(
params
[
:card_id
])
flash
[
:error
]
=
"Invalid card request"
redirect_to
root_path
and
return
end
add_breadcrumb
"Thank out"
,
url_for
(
action:
'thankyou'
)
session
[
:SHOPPING_CARD_SESSION_NAME
]
=
nil
render
:layout
=>
"application_one_col"
...
...
venshop_app/spec/requests/card_pages_spec.rb
View file @
cc365895
...
...
@@ -372,8 +372,25 @@ describe "CardPages" do
end
describe
"step 4"
do
before
{
visit
url_for
(
controller:
'cards'
,
action:
'thankyou'
)
}
describe
"when not pass step 3"
do
before
{
visit
url_for
(
controller:
'cards'
,
action:
'thankyou'
)
}
it
{
should
have_title
(
'Thank you'
)
}
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Invalid'
)
}
end
describe
"when pass step 3"
do
before
do
# step 1
click_link
"Check out"
# step 2
fill_in_order_form
()
click_button
"Continue"
# step 3
click_button
"Correct, click here"
end
it
{
should
have_title
(
full_title
(
'Thank you'
))
}
it
{
should
have_content
(
'Thank you'
)
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment