Sha256: cc02d3c00da8d44fd70d96dc48add052ab02757fc7c699cf9ef6f9c93acfd43a
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
require 'spec_helper' describe Uploadcare::UserAgent do subject(:user_agent) { described_class.new.call(options) } before do stub_const('Uploadcare::VERSION', '123') allow(Gem).to receive(:ruby_version) { '456' } end context 'when user_agent option is set' do let(:options) do { user_agent: 'predefined user agent' } end it { is_expected.to eq('predefined user agent') } end context 'when user_agent_environment option is set' do let(:options) do { public_key: 'pubkey', user_agent_environment: { framework_name: 'rails', framework_version: '5.1.0', extension_name: 'UploadcareRails', extension_version: '1.1.0' } } end it do is_expected.to eq( 'UploadcareRuby/123/pubkey (Ruby/456; rails/5.1.0; UploadcareRails/1.1.0)' ) end end context 'when user_agent_environment option is not set' do let(:options) do { public_key: 'pubkey' } end it { is_expected.to eq('UploadcareRuby/123/pubkey (Ruby/456)') } end end
Version data entries
4 entries across 4 versions & 1 rubygems