Sha256: 3e23ff04bd1690b688146341d5aa85189098231be00c0ecab4f5e2c4e6553da8

Contents?: true

Size: 761 Bytes

Versions: 15

Compression:

Stored size: 761 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/api_factory_spec.rb
github_api-0.11.2 spec/github/api_factory_spec.rb
github_api-0.11.1 spec/github/api_factory_spec.rb
github_api-0.11.0 spec/github/api_factory_spec.rb
github_api-0.10.2 spec/github/api_factory_spec.rb
github_api-0.10.1 spec/github/api_factory_spec.rb
github_api-0.10.0 spec/github/api_factory_spec.rb
github_api-0.9.7 spec/github/api_factory_spec.rb
github_api-0.9.6 spec/github/api_factory_spec.rb
github_api-0.9.5 spec/github/api_factory_spec.rb
github_api-0.9.4 spec/github/api_factory_spec.rb
github_api-0.9.3 spec/github/api_factory_spec.rb
github_api-0.9.2 spec/github/api_factory_spec.rb
github_api-0.9.1 spec/github/api_factory_spec.rb
github_api-0.9.0 spec/github/api_factory_spec.rb