Sha256: 33663db1c21855c429c223168d28f13f91882d96deedf94944a66ea8925a0cf1

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
                                                   name: :janus_instance do
  let(:model) { RubyRabbitmqJanus::Models::JanusInstance }
  let(:parameter_mongo) do
    {
      'id' => '_id',
      'session_id' => 'session',
      'thread_id' => 'thread',
      'thread_id_adm' => 'thread_adm',
      'instance' => '_id'
    }
  end
  let(:parameter_sqlite) do
    {
      'instance' => 'id',
      'session_id' => 'session',
      'thread_id_adm' => 'thread_adm',
      'thread_id' => 'thread'
    }
  end

  context 'Janus Instance model definition' do
    if ENV['MONGO'].match?('true')
      it { expect(model.attribute_names).to include('_id') }
      it do
        expect(model.aliased_fields).to eq(parameter_mongo)
      end
    else
      it { expect(model.attribute_names).to include('id') }
      it do
        expect(model.attribute_aliases).to eq(parameter_sqlite)
      end
    end
    it { expect(model.attribute_names).to include('session') }
    it { expect(model.attribute_names).to include('enable') }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.5.1.pre.217 spec/rrj/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.5.1 spec/rrj/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.5.1.pre.215 spec/rrj/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.5.0 spec/rrj/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.5.0.pre.213 spec/rrj/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.5.0.pre.210 spec/rrj/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.5.0.pre.209 spec/rrj/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.4.0.pre.208 spec/rrj/models/janus_instance_definition_spec.rb