Sha256: 15c218699c817aa2742843ab00cd9fa9565ec683feb28996aabc85423db2574b

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe BitBucket::ApiFactory do
  subject(:factory) { described_class }

  context '#new' do
    it 'throws error if klass type is ommitted' do
      expect { factory.new nil }.to raise_error(ArgumentError)
    end

    it 'instantiates a new object' do
      expect(factory.new('Issues')).to be_a BitBucket::Issues
    end
  end

  context '#create_instance' do
    it 'creates class instance' do
      expect(factory.create_instance('User', {})).to be_kind_of(BitBucket::User)
    end
  end

  context '#convert_to_constant' do
    it 'knows how to convert nested classes' do
      expect(factory.convert_to_constant('Repos::Changesets')).to eql(BitBucket::Repos::Changesets)
    end
  end
end # BitBucket::ApiFactory

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitbuckets-0.2.0 spec/bitbucket_rest_api/api_factory_spec.rb