Sha256: aea159ab1312f93e5040bf519cfef0211edfbe95f569d83684c374e53f0b1c40

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

RSpec.describe Wechat::Api::Util do
  subject { Wechat::Api::Client.new('APPID', 'APPSECRET') }

  before do
    subject.logger.level = Logger::DEBUG
  end

  it :js_config do
    allow(SecureRandom).to receive(:hex).and_return('Wm3WZYTPz0wzccnW')
    allow_any_instance_of(Time).to receive(:to_i).and_return(1414587457)
    allow(subject).to receive(:js_ticket).and_return(expires_in: 7200, ticket: 'sM4AOVdWfPE4DxkXGEs8VMCPGGVi4C3VM0P37wVUCFvkVAy_90u5h9nbSlYy3-Sl-HhTdfl2fzFy1AOcHKP7qg')
    js = subject.js_config(url: 'http://mp.weixin.qq.com?params=value')
    expect(js).not_to be_nil
    expect(js).to include(signature: '0f9de62fce790f9a083d5c99e95740ceb90c27ed')
    expect(js).to have_key :appId
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wechat-api-0.4.1 spec/wechat/api/util_spec.rb
wechat-api-0.4.0 spec/wechat/api/util_spec.rb