Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
e608ffd1
Commit
e608ffd1
authored
Sep 20, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix merchant requests spec
parent
41793608
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
10 deletions
+72
-10
order_spec.rb
...generators/templates/spec/requests/merchant/order_spec.rb
+18
-3
product_series_spec.rb
...s/templates/spec/requests/merchant/product_series_spec.rb
+17
-2
product_snapshot_spec.rb
...templates/spec/requests/merchant/product_snapshot_spec.rb
+17
-1
product_spec.rb
...nerators/templates/spec/requests/merchant/product_spec.rb
+20
-4
No files found.
lib/generators/templates/spec/requests/merchant/order_spec.rb
View file @
e608ffd1
...
...
@@ -2,7 +2,9 @@ require 'swagger_helper'
namespace
=
'<%= @namespace %>'
RSpec
.
describe
"
#{
namespace
}
/orders"
,
type: :request
,
capture_examples:
true
,
tags:
[
"
#{
namespace
}
API"
,
"order"
]
do
before
do
@products
=
create_list
(
:product
,
3
)
@merchant
=
create
(
:merchant
)
@products
=
create_list
(
:product
,
3
,
manager:
@merchant
)
@product_1
=
@products
.
first
@series_1
=
create
(
:product_series
,
...
...
@@ -45,6 +47,11 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
let
(
:page
)
{
1
}
let
(
:per_page
)
{
100
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
produces
'application/json'
consumes
'application/json'
response
(
200
,
description:
'successful'
)
do
...
...
@@ -62,9 +69,13 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
path
"/
#{
namespace
}
/orders/{id}"
do
parameter
'id'
,
in: :path
,
type: :string
let
(
:id
)
{
@order_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商户 订单详情'
)
do
produces
'application/json'
consumes
'application/json'
...
...
@@ -106,9 +117,13 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
path
"/
#{
namespace
}
/orders/{id}/send_out"
do
parameter
'id'
,
in: :path
,
type: :string
let
(
:id
)
{
@order_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
post
(
summary:
'商户 确认订单开始配送'
)
do
before
{
@order_1
.
pay!
}
produces
'application/json'
...
...
lib/generators/templates/spec/requests/merchant/product_series_spec.rb
View file @
e608ffd1
...
...
@@ -2,10 +2,12 @@ require 'swagger_helper'
namespace
=
'<%= @namespace %>'
RSpec
.
describe
"
#{
namespace
}
/products/:product_id/product_series"
,
type: :request
,
capture_examples:
true
,
tags:
[
"
#{
namespace
}
API"
,
"product_series"
]
do
before
do
@merchant
=
create
(
:merchant
)
@clothes
=
Catalog
.
create!
(
name:
'衣服'
)
@jacket
=
Catalog
.
create!
(
name:
'上衣'
,
super_catalog:
@clothes
)
@products
=
create_list
(
:product
,
3
)
@products
=
create_list
(
:product
,
3
,
manager:
@merchant
)
@product_1
=
@products
.
first
@product_1
.
update
(
catalog_list:
[
'衣服'
])
@series_1
=
create
(
...
...
@@ -31,11 +33,19 @@ RSpec.describe "#{namespace}/products/:product_id/product_series", type: :reques
parameter
:product_id
,
in: :path
,
type: :string
let
(
:product_id
)
{
@product_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商家 某商品的 商品系列 列表'
)
do
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
parameter
:page
,
in: :query
,
type: :string
parameter
:per_page
,
in: :query
,
type: :string
let
(
:page
)
{
1
}
let
(
:per_page
)
{
100
}
...
...
@@ -106,6 +116,11 @@ RSpec.describe "#{namespace}/products/:product_id/product_series", type: :reques
parameter
:id
,
in: :path
,
type: :string
let
(
:id
)
{
@series_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商户 商品系列的详情'
)
do
produces
'application/json'
consumes
'application/json'
...
...
lib/generators/templates/spec/requests/merchant/product_snapshot_spec.rb
View file @
e608ffd1
...
...
@@ -2,7 +2,8 @@ require 'swagger_helper'
namespace
=
'<%= @namespace %>'
RSpec
.
describe
"
#{
namespace
}
/product_snapshots"
,
type: :request
,
capture_examples:
true
,
tags:
[
"
#{
namespace
}
API"
,
"product_snapshots"
]
do
before
do
@products
=
create_list
(
:product
,
3
)
@merchant
=
create
(
:merchant
)
@products
=
create_list
(
:product
,
3
,
manager:
@merchant
)
@product_1
=
@products
.
first
@series_1
=
create
(
...
...
@@ -37,6 +38,11 @@ RSpec.describe "#{namespace}/product_snapshots", type: :request, capture_example
parameter
:product_id
,
in: :path
,
type: :string
let
(
:product_series_id
)
{
@series_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商家 (某商品系列中) 的已“在订单中”的快照列表'
)
do
parameter
:page
,
in: :query
,
type: :string
...
...
@@ -59,6 +65,11 @@ RSpec.describe "#{namespace}/product_snapshots", type: :request, capture_example
parameter
:order_id
,
in: :path
,
type: :string
let
(
:order_id
)
{
@order
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商家 (某订单中) 的快照列表'
)
do
parameter
:page
,
in: :query
,
type: :string
...
...
@@ -81,6 +92,11 @@ RSpec.describe "#{namespace}/product_snapshots", type: :request, capture_example
parameter
:id
,
in: :path
,
type: :string
let
(
:id
)
{
@snapshot_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商户 商品快照的详情'
)
do
produces
'application/json'
consumes
'application/json'
...
...
lib/generators/templates/spec/requests/merchant/product_spec.rb
View file @
e608ffd1
...
...
@@ -8,13 +8,17 @@ RSpec.describe "#{namespace}/products", type: :request, capture_examples: true,
@clothes
=
Catalog
.
create!
(
name:
'衣服'
)
@jacket
=
Catalog
.
create!
(
name:
'上衣'
,
super_catalog:
@clothes
)
@products
=
create_list
(
:product
,
3
)
@products
=
create_list
(
:product
,
3
,
manager:
@merchant
)
@product_1
=
@products
.
first
@product_1
.
update
(
catalog_list:
[
'衣服'
])
@series
=
create
(
:product_series
,
product:
@product_1
)
end
path
"/
#{
namespace
}
/products"
do
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商家 商品列表'
)
do
parameter
:manager_type
,
in: :query
,
type: :string
...
...
@@ -110,9 +114,13 @@ RSpec.describe "#{namespace}/products", type: :request, capture_examples: true,
path
"/
#{
namespace
}
/products/{id}"
do
parameter
'id'
,
in: :path
,
type: :string
let
(
:id
)
{
@product_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
get
(
summary:
'商户 商品详情'
)
do
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
...
...
@@ -192,9 +200,13 @@ RSpec.describe "#{namespace}/products", type: :request, capture_examples: true,
path
"/
#{
namespace
}
/products/{id}/put_on_shelf"
do
parameter
'id'
,
in: :path
,
type: :string
let
(
:id
)
{
@product_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
post
(
summary:
'商户 上架商品'
)
do
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
...
...
@@ -211,9 +223,13 @@ RSpec.describe "#{namespace}/products", type: :request, capture_examples: true,
path
"/
#{
namespace
}
/products/{id}/sold_out"
do
parameter
'id'
,
in: :path
,
type: :string
let
(
:id
)
{
@product_1
.
id
}
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
let
(
:manager_id
)
{
@merchant
.
id
}
let
(
:manager_type
)
{
@merchant
.
class
.
name
}
post
(
summary:
'商户 下架商品'
)
do
parameter
:manager_type
,
in: :query
,
type: :string
parameter
:manager_id
,
in: :query
,
type: :integer
...
...
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