forked from piotrmurach/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_factory_spec.rb
More file actions
30 lines (23 loc) · 761 Bytes
/
api_factory_spec.rb
File metadata and controls
30 lines (23 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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