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
a28faf92
Commit
a28faf92
authored
Nov 04, 2013
by
vulehuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rspec: card - step 3: when not pass step 1 and step 2
parent
80df58aa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
venshop_app/app/controllers/cards_controller.rb
+8
-2
venshop_app/spec/requests/card_pages_spec.rb
+20
-3
No files found.
venshop_app/app/controllers/cards_controller.rb
View file @
a28faf92
...
...
@@ -147,8 +147,14 @@ class CardsController < ApplicationController
if
!
session
[
:SHOPPING_CARD_SESSION_NAME
].
nil?
@card_infos
=
session
[
:SHOPPING_CARD_SESSION_NAME
]
end
if
@card_infos
.
empty?
redirect_to
cards_path
if
@card_infos
.
empty?
||
@card_infos
[
:card_items
].
empty?
||
@card_infos
[
:customer_info
].
empty?
if
@card_infos
[
:card_items
].
empty?
flash
[
:error
]
=
"Please order before check out"
redirect_to
products_path
and
return
else
flash
[
:error
]
=
"Please enter your shipping information before check out"
redirect_to
url_for
(
action:
'checkout'
)
and
return
end
end
if
request
.
post?
customer_info
=
@card_infos
[
:customer_info
]
...
...
venshop_app/spec/requests/card_pages_spec.rb
View file @
a28faf92
...
...
@@ -83,8 +83,8 @@ describe "CardPages" do
it
do
should
have_xpath
(
"//input[@id='cart-quantity-
#{
product
.
id
}
'][@value='
#{
amount
}
']"
)
should
have_selector
(
"
.
cart-unit-price-
#{
product
.
id
}
"
,
text:
ActionController
::
Base
.
helpers
.
number_with_delimiter
(
product
.
price
))
should
have_selector
(
"
.
cart-total-price-
#{
product
.
id
}
"
,
text:
ActionController
::
Base
.
helpers
.
number_with_delimiter
(
product
.
price
*
amount
))
should
have_selector
(
"
#
cart-unit-price-
#{
product
.
id
}
"
,
text:
ActionController
::
Base
.
helpers
.
number_with_delimiter
(
product
.
price
))
should
have_selector
(
"
#
cart-total-price-
#{
product
.
id
}
"
,
text:
ActionController
::
Base
.
helpers
.
number_with_delimiter
(
product
.
price
*
amount
))
total
=
0
Product
.
all
.
each
do
|
obj
|
...
...
@@ -297,7 +297,24 @@ describe "CardPages" do
end
describe
"step 3"
do
describe
"when not pass step 1 and step 2"
do
describe
"when not pass step 1"
do
before
do
Product
.
all
.
each
do
|
product
|
visit
cards_path
(
card_action:
'remove'
,
product_id:
product
.
id
)
end
visit
url_for
(
controller:
'cards'
,
action:
'confirm_checkout'
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Please order'
)
}
end
describe
"when not pass step 2"
do
before
do
visit
url_for
(
controller:
'cards'
,
action:
'confirm_checkout'
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Please enter your shipping information'
)
}
end
describe
"when click product name"
do
...
...
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