2016-11-04 08:23:06 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe DeploymentEntity do
|
2017-03-06 13:22:23 -05:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:request) { double('request') }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(request).to receive(:user).and_return(user)
|
|
|
|
end
|
2017-03-11 12:22:08 -05:00
|
|
|
|
2016-11-04 08:23:06 -04:00
|
|
|
let(:entity) do
|
2017-03-06 13:22:23 -05:00
|
|
|
described_class.new(deployment, request: request)
|
2016-11-04 08:23:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:deployment) { create(:deployment) }
|
|
|
|
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
it 'exposes internal deployment id' do
|
|
|
|
expect(subject).to include(:iid)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'exposes nested information about branch' do
|
|
|
|
expect(subject[:ref][:name]).to eq 'master'
|
2016-11-17 10:08:05 -05:00
|
|
|
expect(subject[:ref][:ref_path]).not_to be_empty
|
2016-11-04 08:23:06 -04:00
|
|
|
end
|
|
|
|
end
|