Sha256: e4f0bb3c460da2910867856edb856468011a0cf96c11052eacb09d3eca632d48

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'
require_relative '../../lib/PCP-server-Ruby-SDK.rb'

RSpec.describe PCPServerSDK::Utils::ServerMetaInfo do
  let(:integrator) { 'TestIntegrator' }
  let(:server_meta_info) { PCPServerSDK::Utils::ServerMetaInfo.new(integrator) }

  describe '#initialize' do
    it 'sets the platform identifier' do
      expected_platform_identifier = "#{RbConfig::CONFIG['host_os']}, ruby version is: #{RUBY_VERSION}"
      expect(server_meta_info.platform_identifier).to eq(expected_platform_identifier)
    end

    it 'sets the SDK identifier' do
      expect(server_meta_info.sdk_identifier).to eq('RubyServerSDK/v1.0.0')
    end

    it 'sets the SDK creator' do
      expect(server_meta_info.sdk_creator).to eq('PAYONE GmbH')
    end

    it 'sets the integrator' do
      expect(server_meta_info.integrator).to eq(integrator)
    end
  end

  describe '#to_json' do
    let(:json_output) { JSON.parse(server_meta_info.to_json) }

    it 'includes the platform identifier' do
      expected_platform_identifier = "#{RbConfig::CONFIG['host_os']}, ruby version is: #{RUBY_VERSION}"
      expect(json_output['platform_identifier']).to eq(expected_platform_identifier)
    end

    it 'includes the SDK identifier' do
      expect(json_output['sdk_identifier']).to eq('RubyServerSDK/v1.0.0')
    end

    it 'includes the SDK creator' do
      expect(json_output['sdk_creator']).to eq('PAYONE GmbH')
    end

    it 'includes the integrator' do
      expect(json_output['integrator']).to eq(integrator)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pcp-server-ruby-sdk-1.0.0 spec/utils/server_meta_info_spec.rb