Sha256: c073f85ff7f16688fa97107d6a685685ad74b3ffe4f8000e4b00a439f54aed28
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
require 'spec_helper' require 'faye/authentication' describe Faye::Authentication do let(:secret) { 'helloworld' } describe '#valid?' do it 'returns true if the message is correctly signed' do message = {'channel' => '/foo/bar', 'clientId' => '42', 'text' => 'whatever'} signature = Faye::Authentication.sign(message, secret) message['signature'] = signature expect(Faye::Authentication.valid?(message, secret)).to be(true) end it 'returns false if the message if keys differ' do message = {'channel' => '/foo/bar', 'clientId' => '42', 'text' => 'whatever'} signature = Faye::Authentication.sign(message, secret) message['signature'] = signature expect(Faye::Authentication.valid?(message, secret + 'foo')).to be(false) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faye-authentication-0.1.0 | spec/lib/faye/authentication_spec.rb |