Sha256: 47b6cf95e3f0f58326f8ddbcd7cdda1c5a37b89566ebd96d0e94cd529e7aa32d

Contents?: true

Size: 1.1 KB

Versions: 23

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
                                                   name: :janus_instance do
  let(:model) { described_class }
  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 'when 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

23 entries across 23 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.7.1 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.7.1.pre.274 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.7.0.pre.272 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.7.0 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.7.0.pre.269 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.7.0.pre.267 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.263 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.261 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.260 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.259 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.258 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.247 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.246 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.244 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.240 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.239 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.238 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.233 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb
ruby_rabbitmq_janus-2.6.0.pre.229 spec/ruby_rabbitmq_janus/models/janus_instance_definition_spec.rb