Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weixin_authorize
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
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
weixin_authorize
Commits
9a502c60
Commit
9a502c60
authored
Feb 26, 2015
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加模板消息单元测试
parent
289b645d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
9 deletions
+44
-9
lib/weixin_authorize/api.rb
+3
-9
spec/api/template_spec.rb
+40
-0
spec/spec_helper.rb
+1
-0
No files found.
lib/weixin_authorize/api.rb
View file @
9a502c60
require
"weixin_authorize/api/user"
Dir
[
"
#{
File
.
dirname
(
__FILE__
)
}
/api/*.rb"
].
each
do
|
path
|
require
"weixin_authorize/api/menu"
require
path
require
"weixin_authorize/api/custom"
end
require
"weixin_authorize/api/groups"
require
"weixin_authorize/api/qrcode"
require
"weixin_authorize/api/media"
require
"weixin_authorize/api/mass"
require
"weixin_authorize/api/oauth"
require
"weixin_authorize/api/template"
spec/api/template_spec.rb
0 → 100644
View file @
9a502c60
describe
WeixinAuthorize
::
Api
::
Template
do
# {{first.DATA}}
# 项目名称:{{class.DATA}}
# 时间:{{time.DATA}}
# 地点:{{add.DATA}}
# {{remark.DATA}}
it
"can send template msg"
do
url
=
"http://www.baidu.com"
data
=
{
first:
{
value:
"报名结果通知"
,
color:
"#173277"
},
class:
{
value:
"领导与管理课程培训/人格测评"
,
color:
"#173177"
},
time:
{
value:
"11月6日—11月7日(周三—周五)"
,
color:
"#274177"
},
add:
{
value:
"F302室"
,
color:
"#274377"
},
remark:
{
value:
"您可点击【详情】查看详细信息。"
,
color:
"#274377"
}
}
msg_result
=
$client
.
send_template_msg
(
ENV
[
"OPENID"
],
ENV
[
"TEMPLATE_ID"
],
url
,
"#173177"
,
data
)
expect
(
msg_result
.
code
).
to
eq
(
WeixinAuthorize
::
OK_CODE
)
end
end
spec/spec_helper.rb
View file @
9a502c60
...
@@ -41,6 +41,7 @@ CodeClimate::TestReporter.start
...
@@ -41,6 +41,7 @@ CodeClimate::TestReporter.start
ENV
[
"APPID"
]
=
"wx986f04063d341d04"
ENV
[
"APPID"
]
=
"wx986f04063d341d04"
ENV
[
"APPSECRET"
]
=
"1a941cd88cb4579ba98ec06b6813af03"
ENV
[
"APPSECRET"
]
=
"1a941cd88cb4579ba98ec06b6813af03"
ENV
[
"OPENID"
]
=
"o9k6BuB0kydAcPTc7sPxppB1GQqA"
ENV
[
"OPENID"
]
=
"o9k6BuB0kydAcPTc7sPxppB1GQqA"
ENV
[
"TEMPLATE_ID"
]
=
"-8ooXrOK3VD3HuSS8--nH154PO9Lw2E7T-RV1uTaGLc"
# Comment to test for ClientStorage
# Comment to test for ClientStorage
redis
=
Redis
.
new
(
host:
"127.0.0.1"
,
port:
"6379"
,
db:
15
)
redis
=
Redis
.
new
(
host:
"127.0.0.1"
,
port:
"6379"
,
db:
15
)
...
...
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