travis-api/spec/lib/services/find_request_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

24 lines
741 B
Ruby

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