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
ac4a3164
Commit
ac4a3164
authored
Nov 11, 2013
by
vulehuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change some url when move some card functions to other actions
parent
e8c1157b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
18 deletions
+13
-18
venshop_app/spec/requests/card_pages_spec.rb
+13
-18
No files found.
venshop_app/spec/requests/card_pages_spec.rb
View file @
ac4a3164
...
...
@@ -24,12 +24,10 @@ end
describe
"CardPages"
do
subject
{
page
}
before
(
:
all
)
do
before
(
:
each
)
do
@product_category
=
FactoryGirl
.
create
(
:product_category
)
@user
=
FactoryGirl
.
create
(
:user
)
end
before
(
:each
)
do
5
.
times
{
FactoryGirl
.
create
(
:product
,
product_category_id:
@product_category
.
id
,
user_id:
@user
.
id
)
}
Product
.
all
.
each
do
|
product
|
visit
product_path
(
product
)
...
...
@@ -37,13 +35,10 @@ describe "CardPages" do
end
end
after
(
:all
)
do
User
.
delete_all
ProductCategory
.
delete_all
end
after
(
:each
)
do
Product
.
delete_all
User
.
delete_all
ProductCategory
.
delete_all
end
describe
"step 1"
do
...
...
@@ -51,7 +46,7 @@ describe "CardPages" do
describe
"with invalid information"
do
describe
"when product not exist"
do
before
do
visit
cards_path
(
card_
action:
'update'
,
product_id:
0
,
quantity:
"abc"
)
visit
url_for
(
controller:
'cards'
,
action:
'update'
,
product_id:
0
,
quantity:
"abc"
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Invalid'
)
}
...
...
@@ -60,7 +55,7 @@ describe "CardPages" do
describe
"when quantity is not a number"
do
before
do
product
=
Product
.
first
visit
cards_path
(
card_
action:
'update'
,
product_id:
product
.
id
,
quantity:
"abc"
)
visit
url_for
(
controller:
'cards'
,
action:
'update'
,
product_id:
product
.
id
,
quantity:
"abc"
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Invalid'
)
}
...
...
@@ -69,7 +64,7 @@ describe "CardPages" do
describe
"when quantity < 0"
do
before
do
product
=
Product
.
first
visit
cards_path
(
card_
action:
'update'
,
product_id:
product
.
id
,
quantity:
-
1
)
visit
url_for
(
controller:
'cards'
,
action:
'update'
,
product_id:
product
.
id
,
quantity:
-
1
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Invalid'
)
}
...
...
@@ -78,7 +73,7 @@ describe "CardPages" do
describe
"when quantity = 0"
do
before
do
product
=
Product
.
first
visit
cards_path
(
card_
action:
'update'
,
product_id:
product
.
id
,
quantity:
0
)
visit
url_for
(
controller:
'cards'
,
action:
'update'
,
product_id:
product
.
id
,
quantity:
0
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Invalid'
)
}
...
...
@@ -91,7 +86,7 @@ describe "CardPages" do
let
(
:product
)
{
Product
.
first
}
before
do
visit
cards_path
(
card_
action:
'update'
,
product_id:
product
.
id
,
quantity:
amount
)
visit
url_for
(
controller:
'cards'
,
action:
'update'
,
product_id:
product
.
id
,
quantity:
amount
)
end
it
do
...
...
@@ -116,7 +111,7 @@ describe "CardPages" do
describe
"when product not exist"
do
before
do
visit
cards_path
(
card_
action:
'update'
,
product_id:
0
)
visit
url_for
(
controller:
'cards'
,
action:
'update'
,
product_id:
0
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Invalid'
)
}
...
...
@@ -126,7 +121,7 @@ describe "CardPages" do
let
(
:product_not_in_card
)
{
FactoryGirl
.
create
(
:product
,
product_category_id:
@product_category
.
id
,
user_id:
@user
.
id
)
}
before
do
visit
cards_path
(
card_
action:
'remove'
,
product_id:
product_not_in_card
.
id
)
visit
url_for
(
controller:
'cards'
,
action:
'remove'
,
product_id:
product_not_in_card
.
id
)
end
it
{
should
have_selector
(
'.alert.alert-error'
,
text:
'Invalid'
)
}
...
...
@@ -140,7 +135,7 @@ describe "CardPages" do
total
=
0
before
do
visit
cards_path
(
card_
action:
'remove'
,
product_id:
product
.
id
)
visit
url_for
(
controller:
'cards'
,
action:
'remove'
,
product_id:
product
.
id
)
total
=
0
Product
.
all
.
each
do
|
obj
|
total
+=
obj
.
price
...
...
@@ -179,7 +174,7 @@ describe "CardPages" 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
)
visit
url_for
(
controller:
'cards'
,
action:
'remove'
,
product_id:
product
.
id
)
end
visit
url_for
(
controller:
'cards'
,
action:
'checkout'
)
...
...
@@ -305,7 +300,7 @@ describe "CardPages" 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
)
visit
url_for
(
controller:
'cards'
,
action:
'remove'
,
product_id:
product
.
id
)
end
visit
url_for
(
controller:
'cards'
,
action:
'confirm_checkout'
)
...
...
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