Sha256: fd12d3e23dbe266b5d45942dc42e9b64267daf672d9d8a09d7fc7fd6aabfdeb7
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require_relative '../../../test_helper' module Troo module API describe Endpoints do let(:described_class) { Endpoints } let(:file) {} let(:version) {} let(:endpoints) { { board_by_id: '/boards/%{id}' } } before do YAML.stubs(:load_file).returns(endpoints) end describe '.load' do subject { described_class.load(file, version) } it 'returns a new instance of the class' do subject.must_be_instance_of(Endpoints) end end describe '#interpolate!' do let(:endpoint) { :board_by_id } let(:value) { { id: '20001' } } subject do described_class.new(endpoints) .interpolate!(endpoint, value) end context 'when the endpoint exists' do it 'returns the interpolated endpoint' do subject.must_equal('/boards/20001') end end context 'when the endpoint does not exist' do let(:endpoint) { :wrong_endpoint } it 'raises an exception' do proc { subject }.must_raise(EndpointNotFound) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.11 | test/lib/troo/api/endpoints_test.rb |
troo-0.0.10 | test/lib/troo/api/endpoints_test.rb |