Sha256: 0b9c57c1ef1cd88ef80eb1e852a0991754f8a37df45432b192f09d24137514ed

Contents?: true

Size: 812 Bytes

Versions: 4

Compression:

Stored size: 812 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::API::Factory 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('Client::Repos')).to be_a Github::Client::Repos
    end
  end

  context '#create_instance' do
    it 'creates class instance' do
      expect(factory.create_instance('Client::Issues::Labels', {})).to be_kind_of(Github::Client::Issues::Labels)
    end
  end

  context '#convert_to_constant' do
    it 'knows how to convert nested classes' do
      expect(factory.convert_to_constant('Client::Issues::Labels')).to eql(Github::Client::Issues::Labels)
    end
  end
end # Github::ApiFactory

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/api_factory_spec.rb
github_api-0.12.2 spec/github/api_factory_spec.rb
github_api-0.12.1 spec/github/api_factory_spec.rb
github_api-0.12.0 spec/github/api_factory_spec.rb