travis-api/spec/lib/services/find_repo_spec.rb
Aakriti Gupta 65f1a29d86 Move travis-core files from /vendor to /lib.
- Re-factor
- Remove code for notifications
- Remove addons
- Remove travis-core gem.
- Ignore logs directory only
- Move core tests to spec/lib
2016-07-20 11:22:25 +02:00

31 lines
896 B
Ruby

describe Travis::Services::FindRepo do
let!(:repo) { Factory(:repository, :owner_name => 'travis-ci', :name => 'travis-core') }
let(:service) { described_class.new(stub('user'), params) }
attr_reader :params
describe 'run' do
it 'finds a repository by the given id' do
@params = { :id => repo.id }
service.run.should == repo
end
it 'finds a repository by the given owner_name and name' do
@params = { :owner_name => repo.owner_name, :name => repo.name }
service.run.should == repo
end
it 'does not raise if the repository could not be found' do
@params = { :id => repo.id + 1 }
lambda { service.run }.should_not raise_error
end
end
describe 'updated_at' do
it 'returns jobs updated_at attribute' do
@params = { :id => repo.id }
service.updated_at.to_s.should == repo.updated_at.to_s
end
end
end