Sha256: 7b2c2460fab7153bd6426cb64c378b3413d34e3a54fd09e4e46dfc86e3566128
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 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: '526d8e130a14a9d846001d96' } } 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/526d8e130a14a9d846001d96') 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.9 | test/lib/troo/api/endpoints_test.rb |