Sha256: 710f5f6fb9de4d3183e969a93d61a14acc70a3de7c5224a091bef7f6a273d07a
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe BitBucket::Repos::Sources do let(:subject) { BitBucket::Repos::Sources.new } describe '#list' do context 'when some parameters are missing' do it 'raises an error' do expect do subject.list( 'mock_username', 'mock_repo' ) end.to raise_error(ArgumentError) end end context 'when path parameter is empty' do before do expect(subject).to receive(:request).with( :get, '/1.0/repositories/mock_username/mock_repo/src/moch_sha/', {}, {} ) end it 'sends a GET request for a list of all source files' do subject.list('mock_username', 'mock_repo', 'moch_sha', '') end end context 'when path parameter is defined' do before do expect(subject).to receive(:request).with( :get, '/1.0/repositories/mock_username/mock_repo/src/moch_sha/app/controller', {}, {} ) end it 'send a GET request for a list of the source files under the specified path' do subject.list('mock_username', 'mock_repo', 'moch_sha', 'app/controller') end end end describe '#get' do context 'when some parameters are missing' do it 'raises an error' do expect do subject.get( 'mock_username', 'mock_repo', 'moch_sha' ) end.to raise_error(ArgumentError) end end context 'when path parameter is defined' do before do expect(subject).to receive(:request).with( :get, '/1.0/repositories/mock_username/mock_repo/raw/moch_sha/app/assets/images/logo.jpg', {}, {} ) end it "send a GET request for a source file's size and contents" do subject.get('mock_username', 'mock_repo', 'moch_sha', 'app/assets/images/logo.jpg') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bitbuckets-0.2.0 | spec/bitbucket_rest_api/repos/sources_spec.rb |