Sha256: 45b6527ecc53ac127385d713b16bd3bbaa89267d31cd9258d0a7924b1557081f

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

module Vxod
  describe App do
    let(:response){ double('response') }
    let(:request){ double('request') }
    let(:rack_app){ double('rack_app', response: response, request: request) }
    let(:app){ App.new(rack_app) }

    describe '#authentify' do
      it 'set cookie with for whole domain with 10 years expires' do
        auth_key = rnd('auth_key')
        host = rnd('host')
        allow(request).to receive(:host){ host }

        expect(response).to receive(:set_cookie).with('vxod.auth',
          value: auth_key,
          path: '/',
          expires: Time.new(DateTime.now.year + 10, 1, 1),
          httponly: true
        )

        app.authentify(auth_key)
      end
    end

    describe '#authentify_for_fill_user_data' do
      it 'set cookie for fill user data only' do
        auth_key = rnd('auth_key')
        host = rnd('host')
        allow(request).to receive(:host){ host }

        expect(response).to receive(:set_cookie).with('vxod.auth_fill_user_data',
          value: auth_key,
          path: Vxod.config.fill_user_data_path,
          httponly: true
        )

        app.authentify_for_fill_user_data(auth_key)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vxod-0.0.2 spec/lib/app_spec.rb