Sha256: edd460049a34365c3ba35e8281a3bf3a9c2375edfa9bcf29de5fe3c2c4bfc951

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

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

RSpec.describe ServerMetaInfo do
  let(:integrator) { 'TestIntegrator' }
  let(:server_meta_info) { 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

2 entries across 2 versions & 1 rubygems

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