Sha256: 2fa5114c04f8c53057e5a2eb2afbe11e633b653cfad9d7aed86a208e7cb8b5af

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

require 'spec_helper'
require 'battlenet/authentication'

describe Battlenet::Authentication do
  let(:auth) { Battlenet::Authentication.new 'private' }

  before(:each) do
    time = Time.utc 2011, 11, 5, 3, 36, 24
    Timecop.freeze(time)
  end

  after(:each) do
    Timecop.return
  end

  context "#sign" do
    it "signs the request" do
      signed = auth.sign :get, '/api/wow/test', Time.now
      signed.should == "7PaeI8+WiIMxdodL+aZz+6bA2sc=\n"
    end
  end

  context "#string_to_sign" do
    it "contains the verb, time, and path" do
      string = auth.string_to_sign :get, '/test', Time.now
      string.should =~ /GET/
      string.should =~ /Sat, 05 Nov 2011 03:36:24 GMT/
      string.should =~ /\/test/
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
battlenet-1.2.0 spec/unit/battlenet_authentication_spec.rb
battlenet-1.1.1 spec/unit/battlenet_authentication_spec.rb