Sha256: 3c81a3525d577a8c49b7babefcf8547edf62da0b5138b2a1830ef2c2c42132e4
Contents?: true
Size: 1.9 KB
Versions: 2
Compression:
Stored size: 1.9 KB
Contents
require 'spec_helper' require 'vocker/docker_client' require 'ventriloquist/services_builder' describe VagrantPlugins::Ventriloquist::ServicesBuilder do Service = VagrantPlugins::Ventriloquist::Service verify_contract(:services_builder) fake(:docker_client) let(:pg_cfg) { {image: 'user/pg', tag: '9.2'} } let(:custom_mapping) { {'mysql' => custom_service} } let(:custom_service) { Class.new(Service) } let(:svcs_configs) { [ {pg: pg_cfg}, ['some-service'], 'mysql:1.2', {name: {type: 'mysql'}}, {api_db: {vimage: 'mysql'}} ] } let(:services) { described_class.new(svcs_configs, custom_mapping).build(docker_client) } let(:pg) { services[0] } let(:other) { services[1] } let(:mysql) { services[2] } let(:mysql_2) { services[3] } let(:vimage_ex) { services[4] } it 'builds a list of service objects' do expect(services).to have(5).items expect(services.all?{|s| s.is_a?(Service)}).to be_true end it 'uses container name as type' do expect(mysql).to be_a(custom_service) end it 'looks up service class by type name' do expect(mysql_2).to be_a(custom_service) end it 'sets the docker client for services' do expect(pg.docker_client).to eq(docker_client) end it 'configures services using defined configs' do expect(pg.config).to eq(pg_cfg) end it 'extracts tag from image name' do expect(mysql.config[:tag]).to eq('1.2') end it 'defaults tag to "latest"' do expect(other.config[:tag]).to eq('latest') end it 'prepends "fgrehm/ventriloquist-" to image names if image config is not provided' do expect(mysql.config[:image]).to eq('fgrehm/ventriloquist-mysql:1.2') end it 'expands vimage' do expect(vimage_ex.config[:image]).to eq('fgrehm/ventriloquist-mysql:latest') end it 'sets the service name' do expect(pg.name).to eq('pg') expect(mysql.name).to eq('mysql') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ventriloquist-0.4.1 | spec/unit/services_builder_spec.rb |
ventriloquist-0.4.0 | spec/unit/services_builder_spec.rb |